This has been bugging me for a while now, I am using this generic script to create a player
var player = new YT.Player(videoArray[0], { videoId : videoArray[0], events : { 'onStateChange' : onPlayerStateChange } });
I have the callback function set up with just a simple console.log the problem is when I change the state of a player the console throws
https://www.youtube.com/get_video?noflv=1&video_id=ghUA.... GET 404 from the file html5player-en_US-vfloyxzv5.js:39 witch I asume is loaded by the YouTube Iframe API.
Any ideeas or posibile solutions will be greatly apreciated.
Sadly, this is one of the numerous little things you'll have to cope with using the Youtube Player API. I don't think there is any solution, and we can only wait for a Youtube fix.
A bug report has already been created, feel free to vote for it.
Youtube player is updated every tuesday. Hopefully, this will be fixed someday.
I found out what I was doing wrong, I am posting this maybe it will help someone along the way.
Since the videoArray was holding jQuery object, I used this piece of code to get it all working.
if(isYouTubeVideo) {
videoID = iframeSrc.substr(baseUrlLength);
}
videoArray[i] = {};
videoArray[i].id = videoID;
jQuery.ajax({
dataType: 'JSON',
url: 'https://gdata.youtube.com/feeds/api/videos/' + videoID + '?v=2&alt=json'
})
.done(function(data) {
videoArray[i].title = data.entry.title.$t;
});
jQuery(this).attr('id', videoID);
playerArray[i] = new YT.Player(videoArray[i].id, { event : //Events here})
I hope this helps someone :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With