Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.YT.Player is not a constructor #58

Open
joker-777 opened this issue Sep 29, 2016 · 1 comment
Open

window.YT.Player is not a constructor #58

joker-777 opened this issue Sep 29, 2016 · 1 comment

Comments

@joker-777
Copy link

Happens here which is called here.
It mostly happens on windows.

@viperfx07
Copy link

viperfx07 commented Dec 12, 2016

You can change ifameIsReady to something like this for the time being:

iframeIsReady = function iframeIsReady(callback) {
      // Listen for Gobal YT player callback
      if (typeof YT === 'undefined' && typeof window.loadingPlayer === 'undefined') {
        // Prevents Ready Event from being called twice
        window.loadingPlayer = true;

        
        // Creates deferred so, other players know when to wait.
        window.dfd = $.Deferred();
        window.onYouTubeIframeAPIReady = function() {
          window.onYouTubeIframeAPIReady = null;
          window.dfd.resolve( "done" );
          callback();
        };
      } else if (typeof YT === 'object')  {
        if(typeof YT.Player !== 'undefined'){
          callback();
        } else{
          window.dfd = $.Deferred();
          window.onYouTubeIframeAPIReady = function() {
            window.onYouTubeIframeAPIReady = null;
            window.dfd.resolve( "done" );
            callback();
          };
        }
        
      } else {
        window.dfd.done(function( name ) {
          callback();
        });
      }
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants