I am using a Javascript solution that asynchronously loads the YouTube player API. When watching a video, the entire script should be played on the screen. It works in all browsers, as well as in IE (11), but sometimes in IE. I get an error in Developer Tools: SCRIPT445 (Object does not support this action).
Youtube Player still works, but it seems to break other scripts. I looked around the Internet as well as here on Stackoverflow. There seem to be others who have similar problems, but they were too specific. Maybe someone can help me with this. Here is the piece of code that creates the problem:
var yt_int, yt_players={}, initYT = function() { $(".ytplayer").each(function() { yt_players[this.id] = new YT.Player(this.id); <-- Error line }); }; $.getScript("//www.youtube.com/player_api", function() { yt_int = setInterval(function(){ if(typeof YT === "object"){ initYT(); clearInterval(yt_int); } },500); });
javascript youtube internet-explorer-11
cyclux
source share