0

I try to use videojs player inside an advertisement which gets loaded from the adserver asynchronously. It seems the videojs object is not existing. It cannot be a matter of load time, must be something with the context or scope getting lost on the way to DOMContentloaded. I googled a lot now, there is a similar question here but it is not answered. "Uncaught ReferenceError: videojs is not defined. videojs async loading" As I have not enough reputation I cannot post a comment on that one, that´s why I repost the question here.

Would be of great help to get some news here..

Cheers Steve

  • Look into using a callback once the script has loaded, e.g. http://stackoverflow.com/a/8586564/740233 – misterben Nov 20 '16 at 09:50
  • I tried this in several ways, even when I put the complete rest of the code into the onload of the script, videojs remains undefined for further operations. – Stefan Vesper Nov 20 '16 at 14:14
  • It seems like a general mistake I am making, it has to do with loading an external script inside an IIFE via "document.createElement('script')" and keeping it in a global scope, so that classes from inside that script can be reached from the functions of the IIFE. What am I doing wrong here? – Stefan Vesper Nov 20 '16 at 19:59
  • Please post a jsfiddle code sample so that people can help in detail. Thanks. – Rob R Dec 05 '16 at 21:52

0 Answers0