-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Uncaught TypeError: Cannot read property 'apply' of undefined #24
Comments
Can you please elaborate, how this is avoidable if we set up the |
I think the problem lies mostly in onYouTubeIframeAPIReady not being called in certain circumstances, I would advise you to implement something like this in your module. To forcefully call the function after the iframe has been loaded. var onLoadEvent = '';
if (!window.onNgYtIframeLoad){
window.onNgYtIframeLoad = function(){
window.onYouTubeIframeAPIReady();
}
}
if(window.onNgYtIframeLoad){
onLoadEvent = 'onLoad="onNgYtIframeLoad()"';
}
var iFrame = '<iframe id=" --etc-- '+ onLoadEvent +'></iframe>'; The pull request from atulingale009 includes very good improvements you should take a look at. |
Hi @Shrekie, I did try to test out the PR but I was facing a few errors - Were you able to make it work by any chance? |
PR #23 worked for me, and solved my issue with the API not working for subsequent videos that show up on the page when using ng-if. I haven't run into any new issues yet. |
The PR has been merged. Feel free to try the new version out. |
Gets logged every refresh and play, even worse is sometimes the events don't bind. Meaning the playerReady and playerStateChanged don't ever get called. I am unable to see a pattern, but exactly the same code refreshed seems to sometimes result in these events not getting bound. Happens like 10% of the time.
the tags are set up like this:
The JS is this:
Seems to be a issue of the widgetapi, however this error is avoidable if this module would set up the onYouTubePlayerAPIReady callback in a different way.
Even worse is the events not getting bound sometimes.
The text was updated successfully, but these errors were encountered: