Reputation: 13555
I have used the iframe youtube api to work with the video . It works well on chrome and fx, but when it is implemented on IE 8 , it return error of 'video' is undefined. How to fix the problem ? thanks
function loadAPI(){
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
// add youtube movie
$(target).append("<iframe class = '" + className + "' id = '" + id + "' src = '" + src + "?wmode=transparent' ></iframe>");
function bindYouTube() {
var player;
player = new YT.Player(currYoutubeID, {
videoId: currYoutubeLink,
events: {
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerStateChange (event) {
if (event.data == 0)
$("#" + event.target.a.id).remove();
}
p.s. I believe the code i am using is not the root of problem since it works as expected on chrome and fx. Thanks
Upvotes: 0
Views: 1265
Reputation: 1124
In some browsers, a Flash embed (Flash is used by the iframe embed on non-HTML5 platforms) won't initialize if the element is hidden. It's been that way for a long time unfortunately. Positioning the embed off screen is a good way to get around it. To start debugging this, make sure your element is visible.
Upvotes: 1