"'tagName' is empty or not an object" issue
So, in your ReplaceVideoElements() you overwrite functions appendChild, replaceChild and insertBefore where you use: element.tagName.toLowerCase().
This is unacceptable, because element not always has tagName (exampne is nodeType=11 - DOCUMENT_FRAGMENT_NODE).
What you should do, is add simple IF checking, if tagName is defined.
It took us very long time to debug the reason, and I have to say that during this time we lost many customers. In short words - your fault cause us financial loss.