I\'m not able to get the correct video duration/length (in seconds) of a loaded/cued video via the getDuration() method of the YouTube Player API; the same method, however,
Using jQuery
var youTubeURL = 'http://gdata.youtube.com/feeds/api/videos/oHg5SJYRHA0?v=2&alt=json';
var json = (function () {
$.ajax({
'async': false,
'global': false,
'url': youTubeURL,
'dataType': "jsonp", // necessary for IE9
crossDomain: true,
'success': function (data) {
var duration = data.entry.media$group.yt$duration.seconds;
}
});
})();