Skip to content

Commit e3b1b81

Browse files
committed
Fix obsolete function from Youtube API
1 parent 1f6a764 commit e3b1b81

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

administration/static/app/controllers/admin.lesson.controllers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
$scope.play = function(youtube_id) {
5252
youtubePlayerApi.loadPlayer().then(function(player){
53-
if(player.getVideoData().video_id === youtube_id) return;
53+
if(player.getVideoData && player.getVideoData().video_id === youtube_id) return;
5454
player.cueVideoById(youtube_id);
5555
});
5656
};

core/static/js/lesson/controllers.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
$scope.section = 'video';
6363

6464
youtubePlayerApi.loadPlayer().then(function(player){
65-
if(player.getVideoData() &&
66-
player.getVideoData().video_id === youtube_id) return;
67-
player.cueVideoById(youtube_id);
65+
if(player.getVideoData && player.getVideoData() &&
66+
player.getVideoData().video_id === youtube_id) return;
67+
player.cueVideoById(youtube_id);
6868
});
6969
} else {
7070
if($scope.currentUnit.content) {
@@ -346,7 +346,6 @@
346346
var lastState = -1;
347347

348348
function onPlayerStateChange (event) {
349-
var video_id = event.target.getVideoData().video_id;
350349

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

0 commit comments

Comments
 (0)