This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #441 from pculture/master

Removed dependency on deprecated Youtube data API v2.
  • Loading branch information...
ScottDowne committed Jun 5, 2015
2 parents 076087c + 8c632b4 commit 8ae202a33d51344d385955e84211cb5e0846118c
Showing with 19 additions and 30 deletions.
  1. +19 −30 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
@@ -256,6 +256,11 @@
function onBuffering() {
impl.networkState = self.NETWORK_LOADING;
var newDuration = player.getDuration();
if (impl.duration !== newDuration) {
impl.duration = newDuration;
self.dispatchEvent( "durationchange" );
}
self.dispatchEvent( "waiting" );
}
@@ -406,38 +411,22 @@
// Get video ID out of youtube url
aSrc = regexYouTube.exec( aSrc )[ 1 ];
var xhrURL = "https://gdata.youtube.com/feeds/api/videos/" + aSrc + "?v=2&alt=jsonc&callback=?";
// Get duration value.
Popcorn.getJSONP( xhrURL, function( resp ) {
var warning = "failed to retreive duration data, reason: ";
if ( resp.error ) {
console.warn( warning + resp.error.message );
return ;
} else if ( !resp.data ) {
console.warn( warning + "no response data" );
return;
player = new YT.Player( elem, {
width: "100%",
height: "100%",
wmode: playerVars.wmode,
videoId: aSrc,
playerVars: playerVars,
events: {
'onReady': onPlayerReady,
'onError': onPlayerError,
'onStateChange': onPlayerStateChange
}
impl.duration = resp.data.duration;
self.dispatchEvent( "durationchange" );
player = new YT.Player( elem, {
width: "100%",
height: "100%",
wmode: playerVars.wmode,
videoId: aSrc,
playerVars: playerVars,
events: {
'onReady': onPlayerReady,
'onError': onPlayerError,
'onStateChange': onPlayerStateChange
}
});
impl.networkState = self.NETWORK_LOADING;
self.dispatchEvent( "loadstart" );
self.dispatchEvent( "progress" );
});
impl.networkState = self.NETWORK_LOADING;
self.dispatchEvent( "loadstart" );
self.dispatchEvent( "progress" );
}
function monitorCurrentTime() {

0 comments on commit 8ae202a

Please sign in to comment.