brightcove.js 886 B

1234567891011121314151617181920212223242526272829
  1. /* global brightcove, brightcoveData */
  2. (function($){
  3. var script = document.createElement('script'),
  4. tld = 'co.jp' === brightcoveData.tld ? 'co.jp' : 'com',
  5. timer = false;
  6. // Load Brightcove script
  7. script.src = 'https://sadmin.brightcove.' + tld + '/js/BrightcoveExperiences.js';
  8. script.type = 'text/javascript';
  9. script.language = 'JavaScript';
  10. document.head.appendChild( script );
  11. // Start detection for Brightcove script loading in its object
  12. try_brightcove();
  13. // Detect if Brightcove script has loaded and bind some events once loaded
  14. function try_brightcove() {
  15. clearTimeout( timer );
  16. if ( 'object' === typeof brightcove ) {
  17. $( document ).ready( brightcove.createExperiences );
  18. $( 'body' ).on( 'post-load', brightcove.createExperiences );
  19. brightcove.createExperiences();
  20. } else {
  21. timer = setTimeout( try_brightcove, 100 );
  22. }
  23. }
  24. })(jQuery);