DEV Community

Wesley Howard
Wesley Howard

Posted on

Having trouble with the YouTube API in IE 11

I'm hoping one of you might have an idea why my script isn't working in IE 11. Everything works in both Chrome and Firefox and partly works in IE. The issue though is that IE doesn't seem to like some of the functions I'm calling. IE Console - ("Object doesn't support this property or method 'pauseVideo'"). I cant escape the feeling that its some syntax error I'm not seeing.

Page displaying error -

<script type="text/javascript" src=""></script>

<script type="text/javascript">
window.onYouTubeIframeAPIReady = function() {
for (item in players_list) {
players[players_list[item]] = new YT.Player(players_list[item], {});
var tag = document.createElement('script');
tag.src = "";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var players = new Array();
var players_list = [

function pauseVideo() {
for (item in players_list) {

function swapvid(id) {
$('.video-slider').css('display', 'none');
$('#' + id).closest('.video-slider').css('display', 'inline');  
Enter fullscreen mode Exit fullscreen mode

Top comments (0)