Skip to content

Commit

Permalink
Fix obsolete function from Youtube API
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoVS committed Nov 14, 2017
1 parent 1f6a764 commit e3b1b81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

$scope.play = function(youtube_id) {
youtubePlayerApi.loadPlayer().then(function(player){
if(player.getVideoData().video_id === youtube_id) return;
if(player.getVideoData && player.getVideoData().video_id === youtube_id) return;
player.cueVideoById(youtube_id);
});
};
Expand Down
7 changes: 3 additions & 4 deletions core/static/js/lesson/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
$scope.section = 'video';

youtubePlayerApi.loadPlayer().then(function(player){
if(player.getVideoData() &&
player.getVideoData().video_id === youtube_id) return;
player.cueVideoById(youtube_id);
if(player.getVideoData && player.getVideoData() &&
player.getVideoData().video_id === youtube_id) return;
player.cueVideoById(youtube_id);
});
} else {
if($scope.currentUnit.content) {
Expand Down Expand Up @@ -346,7 +346,6 @@
var lastState = -1;

function onPlayerStateChange (event) {
var video_id = event.target.getVideoData().video_id;

if (event.data == YT.PlayerState.ENDED){
if(! (lastState === YT.PlayerState.PAUSED || // workaround, YT in html5 mode will fire
Expand Down

0 comments on commit e3b1b81

Please sign in to comment.