Commit 4487612c authored by Tom Dickman's avatar Tom Dickman Committed by Matt Porritt
Browse files

MDL-63453 media_videojs: Upgrade Video.JS to 7.5.5.

Upgrade Video.JS to 7.5.5
Upgrade videojs-youtube plugin to 2.6.0
Upgrade videojs-flash plugin to 2.2.2

Added additional AMD modules for bootstrapping the DOM
window and document objects to Video.JS in line with the
updates made to Video.JS.
parent 6735197c
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
/* The MIT License (MIT)
Copyright (c) 2014-2015 Benoit Tremblay <trembl.ben@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
......@@ -22,7 +18,8 @@ THE SOFTWARE. */
/*global define, YT*/
(function (root, factory) {
if(typeof exports==='object' && typeof module!=='undefined') {
module.exports = factory(require('video.js'));
var videojs = require('video.js');
module.exports = factory(videojs.default || videojs);
} else if(typeof define === 'function' && define.amd) {
define(['media_videojs/video-lazy'], function(videojs){
return (root.Youtube = factory(videojs));
......@@ -33,7 +30,7 @@ THE SOFTWARE. */
}(this, function(videojs) {
'use strict';
var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_ANDROID;
var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;
var Tech = videojs.getTech('Tech');
var Youtube = videojs.extend(Tech, {
......@@ -145,10 +142,6 @@ THE SOFTWARE. */
playerVars.disablekb = this.options_.disablekb;
}
if (typeof this.options_.end !== 'undefined') {
playerVars.end = this.options_.end;
}
if (typeof this.options_.color !== 'undefined') {
playerVars.color = this.options_.color;
}
......@@ -160,6 +153,11 @@ THE SOFTWARE. */
playerVars.fs = this.options_.fs;
}
if (this.options_.source.src.indexOf('end=') !== -1) {
var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);
this.options_.end = parseInt(srcEndTime[1]);
}
if (typeof this.options_.end !== 'undefined') {
playerVars.end = this.options_.end;
}
......@@ -205,6 +203,11 @@ THE SOFTWARE. */
playerVars.showinfo = this.options_.showinfo;
}
if (this.options_.source.src.indexOf('start=') !== -1) {
var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);
this.options_.start = parseInt(srcStartTime[1]);
}
if (typeof this.options_.start !== 'undefined') {
playerVars.start = this.options_.start;
}
......@@ -224,7 +227,7 @@ THE SOFTWARE. */
this.activeVideoId = this.url ? this.url.videoId : null;
this.activeList = playerVars.list;
this.ytPlayer = new YT.Player(this.options_.techId, {
var playerConfig = {
videoId: this.activeVideoId,
playerVars: playerVars,
events: {
......@@ -235,7 +238,13 @@ THE SOFTWARE. */
onVolumeChange: this.onPlayerVolumeChange.bind(this),
onError: this.onPlayerError.bind(this)
}
});
};
if (typeof this.options_.enablePrivacyEnhancedMode !== 'undefined' && this.options_.enablePrivacyEnhancedMode) {
playerConfig.host = 'https://www.youtube-nocookie.com';
}
this.ytPlayer = new YT.Player(this.options_.techId, playerConfig);
},
onPlayerReady: function() {
......@@ -617,9 +626,40 @@ THE SOFTWARE. */
preload: function() {},
load: function() {},
reset: function() {},
networkState: function () {
if (!this.ytPlayer) {
return 0; //NETWORK_EMPTY
}
switch (this.ytPlayer.getPlayerState()) {
case -1: //unstarted
return 0; //NETWORK_EMPTY
case 3: //buffering
return 2; //NETWORK_LOADING
default:
return 1; //NETWORK_IDLE
}
},
readyState: function () {
if (!this.ytPlayer) {
return 0; //HAVE_NOTHING
}
switch (this.ytPlayer.getPlayerState()) {
case -1: //unstarted
return 0; //HAVE_NOTHING
case 5: //video cued
return 1; //HAVE_METADATA
case 3: //buffering
return 2; //HAVE_CURRENT_DATA
default:
return 4; //HAVE_ENOUGH_DATA
}
},
supportsFullScreen: function() {
return true;
return document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled;
},
// Tries to get the highest resolution thumbnail available for the video
......@@ -746,4 +786,4 @@ THE SOFTWARE. */
} else {
videojs.registerComponent('Youtube', Youtube);
}
}));
}));
\ No newline at end of file
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* AMD module to access the DOM global document object.
*
* @package media_videojs
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define([], function() {
return document;
});
This diff is collapsed.
/**
* videojs-flash
* @version 2.0.0
* @copyright 2017 Brightcove, Inc.
* @version 2.2.0
* @copyright 2019 Brightcove, Inc.
* @license Apache-2.0
*/
(function (global, factory) {
......@@ -10,11 +10,11 @@
(global.videojsFlash = factory(global.videojs));
}(this, (function (videojs) { 'use strict';
videojs = 'default' in videojs ? videojs['default'] : videojs;
videojs = videojs && videojs.hasOwnProperty('default') ? videojs['default'] : videojs;
var version = "5.4.1";
var version = "5.4.2";
var version$1 = "2.0.0";
var version$1 = "2.2.0";
/**
* @file flash-rtmp.js
......@@ -88,7 +88,7 @@ function FlashRtmpDecorator(Flash) {
// Look for the normal URL separator we expect, '&'.
// If found, we split the URL into two pieces around the
// first '&'.
var connEnd = src.search(/&(?!\w+=)/);
var connEnd = src.search(/&(?![\w-]+=)/);
var streamBegin = void 0;
if (connEnd !== -1) {
......@@ -242,16 +242,6 @@ var classCallCheck = function (instance, Constructor) {
}
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
......@@ -268,16 +258,6 @@ var inherits = function (subClass, superClass) {
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
......@@ -313,14 +293,14 @@ var Flash = function (_Tech) {
inherits(Flash, _Tech);
/**
* Create an instance of this Tech.
*
* @param {Object} [options]
* The key/value store of player options.
*
* @param {Component~ReadyCallback} ready
* Callback function to call when the `Flash` Tech is ready.
*/
* Create an instance of this Tech.
*
* @param {Object} [options]
* The key/value store of player options.
*
* @param {Component~ReadyCallback} ready
* Callback function to call when the `Flash` Tech is ready.
*/
function Flash(options, ready) {
classCallCheck(this, Flash);
......@@ -377,7 +357,7 @@ var Flash = function (_Tech) {
// Otherwise this adds a CDN url.
// The CDN also auto-adds a swf URL for that specific version.
if (!options.swf) {
options.swf = '//vjs.zencdn.net/swf/' + version + '/video-js.swf';
options.swf = 'https://vjs.zencdn.net/swf/' + version + '/video-js.swf';
}
// Generate ID for swf object
......@@ -1121,12 +1101,16 @@ for (var _i = 0; _i < _readOnly.length; _i++) {
* Check if the Flash tech is currently supported.
*
* @return {boolean}
* - True if the flash tech is supported.
* - False otherwise.
* - True for Chrome and Safari Desktop and Microsoft Edge and if flash tech is supported
* - False otherwise
*/
Flash.isSupported = function () {
// for Chrome Desktop and Safari Desktop
if (videojs.browser.IS_CHROME && !videojs.browser.IS_ANDROID || videojs.browser.IS_SAFARI && !videojs.browser.IS_IOS || videojs.browser.IS_EDGE) {
return true;
}
// for other browsers
return Flash.version()[0] >= 10;
// return swfobject.hasFlashPlayerVersion('10');
};
// Add Source Handler pattern functions to this tech
......@@ -1329,7 +1313,12 @@ Flash.onError = function (swfID, err) {
}
// trigger a custom error
tech.error('FLASH: ' + err);
if (typeof err === 'string') {
tech.error('FLASH: ' + err);
} else {
err.origin = 'flash';
tech.error(err);
}
};
/**
......
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* AMD module to access the DOM global window object.
*
* @package media_videojs
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define([], function() {
return window;
});
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMid meet">
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="VideoJS" horiz-adv-x="1792">
<font-face font-family="VideoJS"
......@@ -97,6 +97,12 @@
<glyph glyph-name="audio"
unicode="&#xF11E;"
horiz-adv-x="1792" d=" M896 1717.3333333333333C524.9066666666668 1717.3333333333333 224 1416.4266666666667 224 1045.3333333333333V522.6666666666665C224 399.0933333333333 324.4266666666667 298.6666666666665 448 298.6666666666665H672V896H373.3333333333334V1045.3333333333333C373.3333333333334 1333.92 607.4133333333334 1568 896 1568S1418.6666666666667 1333.92 1418.6666666666667 1045.3333333333333V896H1120V298.6666666666665H1344C1467.5733333333335 298.6666666666665 1568 399.0933333333333 1568 522.6666666666665V1045.3333333333333C1568 1416.4266666666667 1267.0933333333332 1717.3333333333333 896 1717.3333333333333z" />
<glyph glyph-name="next-item"
unicode="&#xF11F;"
horiz-adv-x="1792" d=" M448 448L1082.6666666666667 896L448 1344V448zM1194.6666666666667 1344V448H1344V1344H1194.6666666666667z" />
<glyph glyph-name="previous-item"
unicode="&#xF120;"
horiz-adv-x="1792" d=" M448 1344H597.3333333333334V448H448zM709.3333333333334 896L1344 448V1344z" />
</font>
</defs>
</svg>
No preview for this file type
No preview for this file type
VideoJS 6.3.2
VideoJS 7.5.5
-------------
https://github.com/videojs/video.js
......@@ -7,13 +7,12 @@ Instructions to import VideoJS player into Moodle:
1. Download the latest release from https://github.com/videojs/video.js/releases
(do not choose "Source code")
2. copy 'video.js' into 'amd/src/video-lazy.js'
In the beginning of the js file replace
define(['global/window', 'global/document']
with
define(['./window', './document']
3. copy 'font/' into 'fonts/' folder
4. copy 'video-js.css' into 'styles.css'
Replace
url("font/VideoJS.eot?#iefix")
with
url([[font:media_videojs|VideoJS.eot]])
Search for other relative URLs in this file.
Add stylelint-disable in the beginning.
Add "Modifications of player made by Moodle" to the end of the styles file.
Check status of:
......@@ -26,7 +25,7 @@ Import plugins:
In the beginning of the js file replace
define(['videojs']
with
define(['media_videojs/video-lazy']
define(['./video-lazy']
2. Download the latest release from https://github.com/videojs/videojs-flash
Run "npm install"
......@@ -34,7 +33,7 @@ Import plugins:
In the beginning of the js file replace
define(['videojs']
with
define(['media_videojs/video-lazy']
define(['./video-lazy']
3. Download https://github.com/videojs/video-js-swf/blob/master/dist/video-js.swf
and place it into 'videojs/video-js.swf'
\ No newline at end of file
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment