Skip to content

Commit

Permalink
MDL-59274 media_videojs: upgrade video.js library and plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Oct 10, 2017
1 parent d8e9a23 commit ce1500a
Show file tree
Hide file tree
Showing 28 changed files with 22,179 additions and 21,787 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ lib/validateurlsyntax.php
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
media/player/videojs/amd/src/videojs-flash-lazy.js
media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
Expand Down
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ lib/validateurlsyntax.php
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
media/player/videojs/amd/src/videojs-flash-lazy.js
media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
Expand Down
2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/Youtube-lazy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/loader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions media/player/videojs/amd/build/video-lazy.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions media/player/videojs/amd/build/videojs-flash-lazy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 26 additions & 17 deletions media/player/videojs/amd/src/Youtube-lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,32 @@ THE SOFTWARE. */

// Set the vjs-youtube class to the player
// Parent is not set yet so we have to wait a tick
setTimeout(function() {
this.el_.parentNode.className += ' vjs-youtube';
this.setTimeout(function() {
if (this.el_) {
this.el_.parentNode.className += ' vjs-youtube';

if (_isOnMobile) {
this.el_.parentNode.className += ' vjs-youtube-mobile';
}
if (_isOnMobile) {
this.el_.parentNode.className += ' vjs-youtube-mobile';
}

if (Youtube.isApiReady) {
this.initYTPlayer();
} else {
Youtube.apiReadyQueue.push(this);
if (Youtube.isApiReady) {
this.initYTPlayer();
} else {
Youtube.apiReadyQueue.push(this);
}
}
}.bind(this));
},

dispose: function() {
if (this.ytPlayer) {
//Dispose of the YouTube Player
this.ytPlayer.stopVideo();
this.ytPlayer.destroy();
if (this.ytPlayer.stopVideo) {
this.ytPlayer.stopVideo();
}
if (this.ytPlayer.destroy) {
this.ytPlayer.destroy();
}
} else {
//YouTube API hasn't finished loading or the player is already disposed
var index = Youtube.apiReadyQueue.indexOf(this);
Expand Down Expand Up @@ -226,6 +232,7 @@ THE SOFTWARE. */
onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),
onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),
onStateChange: this.onPlayerStateChange.bind(this),
onVolumeChange: this.onPlayerVolumeChange.bind(this),
onError: this.onPlayerError.bind(this)
}
});
Expand Down Expand Up @@ -308,6 +315,10 @@ THE SOFTWARE. */
}
},

onPlayerVolumeChange: function() {
this.trigger('volumechange');
},

onPlayerError: function(e) {
this.errorNumber = e.data;
this.trigger('pause');
Expand Down Expand Up @@ -568,10 +579,6 @@ THE SOFTWARE. */
}

this.ytPlayer.setVolume(percentAsDecimal * 100.0);
this.setTimeout( function(){
this.trigger('volumechange');
}, 50);

},

muted: function() {
Expand Down Expand Up @@ -728,8 +735,10 @@ THE SOFTWARE. */

Youtube.apiReadyQueue = [];

loadScript('https://www.youtube.com/iframe_api', apiLoaded);
injectCss();
if (typeof document !== 'undefined'){
loadScript('https://www.youtube.com/iframe_api', apiLoaded);
injectCss();
}

// Older versions of VJS5 doesn't have the registerTech function
if (typeof videojs.registerTech !== 'undefined') {
Expand Down
4 changes: 4 additions & 0 deletions media/player/videojs/amd/src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ define(['jquery', 'core/event'], function($, Event) {
// Add YouTube to the list of modules we require.
modules.push('media_videojs/Youtube-lazy');
}
if (config.techOrder && config.techOrder.indexOf('flash') !== -1) {
// Add Flash to the list of modules we require.
modules.push('media_videojs/videojs-flash-lazy');
}
require(modules, function(videojs) {
if (onload) {
onload(videojs);
Expand Down
Loading

0 comments on commit ce1500a

Please sign in to comment.