mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
Merge branch 'MDL-72407-master' of git://github.com/sarjona/moodle
This commit is contained in:
commit
3868d359ba
@ -36,7 +36,6 @@ class filter_mediaplugin_testcase extends advanced_testcase {
|
||||
|
||||
// We need to enable the media plugins.
|
||||
\core\plugininfo\media::set_enabled_plugins('vimeo,youtube,videojs,html5video,html5audio');
|
||||
set_config('useflash', true, 'media_videojs');
|
||||
|
||||
$filterplugin = new filter_mediaplugin(null, array());
|
||||
|
||||
@ -59,7 +58,6 @@ class filter_mediaplugin_testcase extends advanced_testcase {
|
||||
'<a href="http://youtu.be/JghQgA2HMX8" class="href=css">test file</a>',
|
||||
'<a href="http://y2u.be/JghQgA2HMX8" class="href=css">test file</a>',
|
||||
'<a class="youtube" href="http://www.youtube.com/watch?v=JghQgA2HMX8">test file</a>',
|
||||
'<a class="_blanktarget" href="http://moodle.org/testfile/test.flv?d=100x100">test flv</a>',
|
||||
'<a class="hrefcss" href="http://www.youtube.com/watch?v=JghQgA2HMX8">test file</a>',
|
||||
'<a class="content" href="http://moodle.org/testfile/test.ogg">test ogg</a>',
|
||||
'<a id="audio" href="http://moodle.org/testfile/test.mp3">test mp3</a>',
|
||||
|
2
media/player/videojs/amd/build/loader.min.js
vendored
2
media/player/videojs/amd/build/loader.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("media_videojs/loader",["exports","core/ajax","core/config","core_filters/events","core/localstorage","core/notification","jquery"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.setUp=void 0;b=h(b);c=h(c);e=h(e);f=h(f);g=h(g);var o="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function h(a){return a&&a.__esModule?a:{default:a}}function i(a,b){return n(a)||m(a,b)||k(a,b)||j()}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(a,b){if(!a)return;if("string"==typeof a)return l(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return l(a,b)}function l(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function m(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function n(a){if(Array.isArray(a))return a}var p,q,r;a.setUp=function setUp(a){q=a;p=!0;s({detail:{nodes:document.body}});document.addEventListener(d.eventTypes.filterContentUpdated,s)};var s=function(a){var b=(0,g.default)(a.detail.nodes),d=".mediaplugin_videojs",e=t();b.find(d).addBack(d).find("audio, video").each(function(a,b){var d=(0,g.default)(b).attr("id"),h=(0,g.default)(b).data("setup-lazy"),j=["function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/video-lazy"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&o.require&&"component"===o.require.loader?Promise.resolve(require(("media_videojs/video-lazy"))):Promise.resolve(o["media_videojs/video-lazy"])];if(h.techOrder&&-1!==h.techOrder.indexOf("youtube")){j.push("function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/Youtube-lazy"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&o.require&&"component"===o.require.loader?Promise.resolve(require(("media_videojs/Youtube-lazy"))):Promise.resolve(o["media_videojs/Youtube-lazy"]))}if(h.techOrder&&-1!==h.techOrder.indexOf("flash")){j.push("function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/videojs-flash-lazy"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&o.require&&"component"===o.require.loader?Promise.resolve(require(("media_videojs/videojs-flash-lazy"))):Promise.resolve(o["media_videojs/videojs-flash-lazy"]))}Promise.all([e].concat(j)).then(function(a){var b=i(a,2),e=b[0],f=b[1];if(p){f.options.flash.swf="".concat(c.default.wwwroot,"/media/player/videojs/videojs/video-js.swf");f.options.playbackRates=[.5,.75,1,1.25,1.5,1.75,2];f.options.userActions={hotkeys:!0};f.addLanguage(q,e);p=!1}f(d,h)}).catch(f.default.exception)})},t=function(){if(r){return Promise.resolve(r)}var a="media_videojs/".concat(q),c=e.default.get(a);if(c){var f=JSON.parse(c);r=f;return Promise.resolve(r)}var d={methodname:"media_videojs_get_language",args:{lang:q}};return b.default.call([d])[0].then(function(b){e.default.set(a,b);return b}).then(function(a){return JSON.parse(a)}).then(function(a){r=a;return a})}});
|
||||
define ("media_videojs/loader",["exports","core/ajax","core_filters/events","core/localstorage","core/notification","jquery"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.setUp=void 0;b=g(b);d=g(d);e=g(e);f=g(f);var o="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function g(a){return a&&a.__esModule?a:{default:a}}function h(a,b){return n(a)||m(a,b)||k(a,b)||j()}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(a,b){if(!a)return;if("string"==typeof a)return l(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return l(a,b)}function l(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function m(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function n(a){if(Array.isArray(a))return a}var p,q,r;a.setUp=function setUp(a){q=a;p=!0;s({detail:{nodes:document.body}});document.addEventListener(c.eventTypes.filterContentUpdated,s)};var s=function(a){var b=(0,f.default)(a.detail.nodes),c=".mediaplugin_videojs",d=t();b.find(c).addBack(c).find("audio, video").each(function(a,b){var c=(0,f.default)(b).attr("id"),g=(0,f.default)(b).data("setup-lazy"),i=["function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/video-lazy"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&o.require&&"component"===o.require.loader?Promise.resolve(require(("media_videojs/video-lazy"))):Promise.resolve(o["media_videojs/video-lazy"])];if(g.techOrder&&-1!==g.techOrder.indexOf("youtube")){i.push("function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/Youtube-lazy"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&o.require&&"component"===o.require.loader?Promise.resolve(require(("media_videojs/Youtube-lazy"))):Promise.resolve(o["media_videojs/Youtube-lazy"]))}Promise.all([d].concat(i)).then(function(a){var b=h(a,2),d=b[0],e=b[1];if(p){e.options.playbackRates=[.5,.75,1,1.25,1.5,1.75,2];e.options.userActions={hotkeys:!0};e.addLanguage(q,d);p=!1}e(c,g)}).catch(e.default.exception)})},t=function(){if(r){return Promise.resolve(r)}var a="media_videojs/".concat(q),c=d.default.get(a);if(c){var f=JSON.parse(c);r=f;return Promise.resolve(r)}var e={methodname:"media_videojs_get_language",args:{lang:q}};return b.default.call([e])[0].then(function(b){d.default.set(a,b);return b}).then(function(a){return JSON.parse(a)}).then(function(a){r=a;return a})}});
|
||||
//# sourceMappingURL=loader.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
import Ajax from 'core/ajax';
|
||||
import Config from 'core/config';
|
||||
import {eventTypes} from 'core_filters/events';
|
||||
import LocalStorage from 'core/localstorage';
|
||||
import Notification from 'core/notification';
|
||||
@ -88,14 +87,10 @@ const notifyVideoJS = e => {
|
||||
// Add YouTube to the list of modules we require.
|
||||
modulePromises.push(import('media_videojs/Youtube-lazy'));
|
||||
}
|
||||
if (config.techOrder && config.techOrder.indexOf('flash') !== -1) {
|
||||
// Add Flash to the list of modules we require.
|
||||
modulePromises.push(import('media_videojs/videojs-flash-lazy'));
|
||||
}
|
||||
|
||||
Promise.all([langStrings, ...modulePromises])
|
||||
.then(([langJson, videojs]) => {
|
||||
if (firstLoad) {
|
||||
videojs.options.flash.swf = `${Config.wwwroot}/media/player/videojs/videojs/video-js.swf`;
|
||||
videojs.options.playbackRates = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
videojs.options.userActions = {
|
||||
hotkeys: true,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -72,10 +72,8 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
$hasposter = self::get_attribute($text, 'poster') !== null;
|
||||
}
|
||||
|
||||
// Currently Flash in VideoJS does not support responsive layout. If Flash is enabled try to guess
|
||||
// if HTML5 player will be engaged for the user and then set it to responsive.
|
||||
$responsive = (get_config('media_videojs', 'useflash') && !$this->youtube) ? null : true;
|
||||
$flashtech = false;
|
||||
// Try to guess if HTML5 player will be engaged for the user and then set it to responsive.
|
||||
$responsive = (!$this->youtube) ? null : true;
|
||||
|
||||
// Build list of source tags.
|
||||
foreach ($urls as $url) {
|
||||
@ -101,10 +99,6 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
if ($responsive === null) {
|
||||
$responsive = core_useragent::supports_html5($extension);
|
||||
}
|
||||
if (($url->get_scheme() === 'rtmp' || !core_useragent::supports_html5($extension))
|
||||
&& get_config('media_videojs', 'useflash')) {
|
||||
$flashtech = true;
|
||||
}
|
||||
}
|
||||
$sources = implode("\n", $sources);
|
||||
|
||||
@ -123,8 +117,6 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
|
||||
$sources = ''; // Do not specify <source> tags - it may confuse browser.
|
||||
$isaudio = false; // Just in case.
|
||||
} else if ($flashtech) {
|
||||
$datasetup[] = '"techOrder": ["flash", "html5"]';
|
||||
}
|
||||
|
||||
// Add a language.
|
||||
@ -258,8 +250,8 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
get_config('media_videojs', 'audioextensions'))));
|
||||
|
||||
$this->extensions = file_get_typegroup('extension', $filetypes);
|
||||
if ($this->extensions && !get_config('media_videojs', 'useflash')) {
|
||||
// If Flash is disabled get extensions supported by player that don't rely on flash.
|
||||
if ($this->extensions) {
|
||||
// Get extensions supported by player.
|
||||
$supportedextensions = array_merge(file_get_typegroup('extension', 'html_video'),
|
||||
file_get_typegroup('extension', 'html_audio'), file_get_typegroup('extension', 'media_source'));
|
||||
$this->extensions = array_intersect($this->extensions, $supportedextensions);
|
||||
@ -283,17 +275,9 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
}
|
||||
|
||||
$extensions = $this->get_supported_extensions();
|
||||
$rtmpallowed = get_config('media_videojs', 'rtmp') && get_config('media_videojs', 'useflash');
|
||||
foreach ($urls as $url) {
|
||||
// If RTMP support is disabled, skip the URL that is using RTMP (which
|
||||
// might have been picked to the list by its valid extension).
|
||||
if (!$rtmpallowed && ($url->get_scheme() === 'rtmp')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If RTMP support is allowed, URL with RTMP scheme is supported irrespective to extension.
|
||||
if ($rtmpallowed && ($url->get_scheme() === 'rtmp')) {
|
||||
$result[] = $url;
|
||||
// Skip the URL that is using RTMP (which might have been picked to the list by its valid extension).
|
||||
if ($url->get_scheme() === 'rtmp') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -305,15 +289,7 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!get_config('media_videojs', 'useflash')) {
|
||||
return parent::list_supported_urls($urls, $options);
|
||||
} else {
|
||||
// If Flash fallback is enabled we can not check if/when browser supports flash.
|
||||
// We assume it will be able to handle any other extensions that player supports.
|
||||
if (in_array($ext, $extensions)) {
|
||||
$result[] = $url;
|
||||
}
|
||||
}
|
||||
return parent::list_supported_urls($urls, $options);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -381,9 +357,6 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
if (get_config('media_videojs', 'youtube')) {
|
||||
$supports .= ($supports ? '<br>' : '') . get_string('youtube', 'media_videojs');
|
||||
}
|
||||
if (get_config('media_videojs', 'rtmp') && get_config('media_videojs', 'useflash')) {
|
||||
$supports .= ($supports ? '<br>' : '') . get_string('rtmp', 'media_videojs');
|
||||
}
|
||||
return $supports;
|
||||
}
|
||||
|
||||
@ -393,10 +366,6 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
if (get_config('media_videojs', 'youtube')) {
|
||||
$markers = array_merge($markers, array('youtube.com', 'youtube-nocookie.com', 'youtu.be', 'y2u.be'));
|
||||
}
|
||||
// Add RTMP support if enabled.
|
||||
if (get_config('media_videojs', 'rtmp') && get_config('media_videojs', 'useflash')) {
|
||||
$markers[] = 'rtmp://';
|
||||
}
|
||||
|
||||
return $markers;
|
||||
}
|
||||
|
66
media/player/videojs/db/upgrade.php
Normal file
66
media/player/videojs/db/upgrade.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* VideoJS media player upgrade code
|
||||
*
|
||||
* This file keeps track of upgrades to
|
||||
* the videojs media player.
|
||||
*
|
||||
* Sometimes, changes between versions involve
|
||||
* alterations to database structures and other
|
||||
* major things that may break installations.
|
||||
*
|
||||
* The upgrade function in this file will attempt
|
||||
* to perform all the necessary actions to upgrade
|
||||
* your older installation to the current version.
|
||||
*
|
||||
* If there's something it cannot do itself, it
|
||||
* will tell you what you need to do.
|
||||
*
|
||||
* The commands in here will all be database-neutral,
|
||||
* using the methods of database_manager class
|
||||
*
|
||||
* Please do not forget to use upgrade_set_timeout()
|
||||
* before any action that may take longer time to finish.
|
||||
*
|
||||
* @package media_videojs
|
||||
* @copyright 2021 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Main upgrade tasks to be executed on plugin version bump.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_media_videojs_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
if ($oldversion < 2021052503) {
|
||||
// Remove useflash and rtmp settings.
|
||||
unset_config('useflash', 'media_videojs');
|
||||
unset_config('rtmp', 'media_videojs');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052503, 'media', 'videojs');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
4
media/player/videojs/lang/en/deprecated.txt
Normal file
4
media/player/videojs/lang/en/deprecated.txt
Normal file
@ -0,0 +1,4 @@
|
||||
configrtmp,media_videojs
|
||||
configuseflash,media_videojs
|
||||
rtmp,media_videojs
|
||||
useflash,media_videojs
|
@ -27,19 +27,21 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$string['audiocssclass'] = 'CSS class for audio';
|
||||
$string['audioextensions'] = 'Audio file extensions';
|
||||
$string['configaudiocssclass'] = 'A CSS class that will be added to the <audio> element.';
|
||||
$string['configaudioextensions'] = 'A comma-separated list of supported audio file extensions. VideoJS will try to use the browser\'s native video player when available or native VideoJS functionality, and fall back to a Flash player for other formats if Flash is supported by the browser and Flash fallback is enabled below.';
|
||||
$string['configaudioextensions'] = 'A comma-separated list of supported audio file extensions. VideoJS will try to use the browser\'s native video player when available or native VideoJS functionality.';
|
||||
$string['configlimitsize'] = 'If enabled, and width and height are not specified, the video will display with default width and height. Otherwise it will stretch to the maximum possible width.';
|
||||
$string['configrtmp'] = 'If enabled, links that start with rtmp:// will be handled by the plugin, irrespective of whether the extension is enabled in the Video file extensions (videoextensions) setting. Flash fallback must be enabled for RTMP to work.';
|
||||
$string['configvideocssclass'] = 'A CSS class that will be added to the <video> element. For example, the CSS class "vjs-big-play-centered" will place the play button in the middle. For details, including how to set a custom skin, see docs.videojs.com.';
|
||||
$string['configvideoextensions'] = 'A comma-separated list of supported video file extensions. VideoJS will try to use the browser\'s native video player when available, and fall back to a Flash player for other formats if Flash is supported by the browser and Flash fallback is enabled below.';
|
||||
$string['configvideoextensions'] = 'A comma-separated list of supported video file extensions. VideoJS will try to use the browser\'s native video player when available.';
|
||||
$string['configyoutube'] = 'Use VideoJS to play YouTube videos. Note that YouTube playlists are not yet supported by VideoJS.';
|
||||
$string['configuseflash'] = 'Use Flash player if video format is not natively supported by the browser and/or natively by the VideoJS player. If enabled, VideoJS will be engaged for any file extension from the above list without browser check. Please note that Flash is not available in mobile browsers and discouraged in many desktop ones.';
|
||||
$string['limitsize'] = 'Limit size';
|
||||
$string['pluginname'] = 'VideoJS player';
|
||||
$string['pluginname_help'] = 'A JavaScript wrapper for video files played by the browser\'s native video player with a Flash player fallback. (Format support depends on the browser.)';
|
||||
$string['pluginname_help'] = 'A JavaScript wrapper for video files played by the browser\'s native video player. (Format support depends on the browser.)';
|
||||
$string['privacy:metadata'] = 'The VideoJS player media plugin does not store any personal data.';
|
||||
$string['rtmp'] = 'RTMP streams';
|
||||
$string['videoextensions'] = 'Video file extensions';
|
||||
$string['useflash'] = 'Use Flash fallback';
|
||||
$string['videocssclass'] = 'CSS class for video';
|
||||
$string['youtube'] = 'YouTube videos';
|
||||
|
||||
// Deprecated since Moodle 4.0.
|
||||
$string['configrtmp'] = 'If enabled, links that start with rtmp:// will be handled by the plugin, irrespective of whether the extension is enabled in the Video file extensions (videoextensions) setting. Flash fallback must be enabled for RTMP to work.';
|
||||
$string['configuseflash'] = 'Use Flash player if video format is not natively supported by the browser and/or natively by the VideoJS player. If enabled, VideoJS will be engaged for any file extension from the above list without browser check. Please note that Flash is not available in mobile browsers and discouraged in many desktop ones.';
|
||||
$string['rtmp'] = 'RTMP streams';
|
||||
$string['useflash'] = 'Use Flash fallback';
|
||||
|
@ -26,14 +26,3 @@ Import plugins:
|
||||
define(['videojs']
|
||||
with
|
||||
define(['media_videojs/video-lazy']
|
||||
|
||||
2. Download the latest release from https://github.com/videojs/videojs-flash
|
||||
Run "npm install"
|
||||
Copy 'dist/videojs-flash.js' into 'amd/src/videojs-flash-lazy.js'
|
||||
In the beginning of the js file replace
|
||||
define(['videojs']
|
||||
with
|
||||
define(['media_videojs/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'
|
@ -38,14 +38,6 @@ if ($ADMIN->fulltree) {
|
||||
'html_audio',
|
||||
array('onlytypes' => array('audio', 'web_audio', 'html_audio'))));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('media_videojs/rtmp',
|
||||
new lang_string('rtmp', 'media_videojs'),
|
||||
new lang_string('configrtmp', 'media_videojs'), 0));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('media_videojs/useflash',
|
||||
new lang_string('useflash', 'media_videojs'),
|
||||
new lang_string('configuseflash', 'media_videojs'), 0));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('media_videojs/youtube',
|
||||
new lang_string('youtube', 'media_videojs'),
|
||||
new lang_string('configyoutube', 'media_videojs'), 1));
|
||||
|
@ -22,7 +22,12 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace media_videojs;
|
||||
|
||||
use core_media_manager;
|
||||
use html_writer;
|
||||
use media_videojs_plugin;
|
||||
use moodle_url;
|
||||
|
||||
/**
|
||||
* Test script for media embedding.
|
||||
@ -31,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class media_videojs_player_testcase extends advanced_testcase {
|
||||
class player_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Pre-test setup. Preserves $CFG.
|
||||
@ -46,7 +51,7 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
\core\plugininfo\media::set_enabled_plugins('videojs');
|
||||
|
||||
// Pretend to be using Firefox browser (must support ogg for tests to work).
|
||||
core_useragent::instance(true, 'Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0 ');
|
||||
\core_useragent::instance(true, 'Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0 ');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,8 +69,6 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
$supportedextensions = array_merge(file_get_typegroup('extension', 'html_video'),
|
||||
file_get_typegroup('extension', 'html_audio'), file_get_typegroup('extension', 'media_source'));
|
||||
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
|
||||
// Make sure that the list of extensions from the setting is filtered to HTML5 natively supported extensions.
|
||||
$player = new media_videojs_plugin();
|
||||
$this->assertTrue(in_array('.mp3', $player->get_supported_extensions()));
|
||||
@ -79,18 +82,11 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
$this->assertFalse(in_array('.ra', $player->get_supported_extensions()));
|
||||
$this->assertEmpty(array_diff($player->get_supported_extensions(), $supportedextensions));
|
||||
|
||||
// Try to use flash extensions and make sure they are not returned as supported.
|
||||
// Check flash extensions are not returned as supported.
|
||||
set_config('videoextensions', '.flv,.f4v', 'media_videojs');
|
||||
$player = new media_videojs_plugin();
|
||||
$this->assertFalse(in_array('.flv', $player->get_supported_extensions()));
|
||||
$this->assertFalse(in_array('.f4v', $player->get_supported_extensions()));
|
||||
|
||||
// Enable flash and test if flash extenstions are supported.
|
||||
set_config('useflash', 1, 'media_videojs');
|
||||
set_config('videoextensions', '.flv,.f4v', 'media_videojs');
|
||||
$player = new media_videojs_plugin();
|
||||
$this->assertTrue(in_array('.flv', $player->get_supported_extensions()));
|
||||
$this->assertTrue(in_array('.f4v', $player->get_supported_extensions()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,7 +255,6 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function test_youtube() {
|
||||
set_config('youtube', 1, 'media_videojs');
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
|
||||
$manager = core_media_manager::instance();
|
||||
|
||||
@ -316,7 +311,6 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function test_youtube_start_time(string $url, int $expectedstart) {
|
||||
set_config('youtube', 1, 'media_videojs');
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
|
||||
$embedcode = core_media_manager::instance()->embed_url(new moodle_url($url));
|
||||
|
||||
@ -335,23 +329,11 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that VideoJS can embed flash videos.
|
||||
* Test that VideoJS can not embed flash videos.
|
||||
*/
|
||||
public function test_flash() {
|
||||
public function test_flash_behaviour() {
|
||||
$manager = core_media_manager::instance();
|
||||
|
||||
// Flash enabled.
|
||||
set_config('useflash', 1, 'media_videojs');
|
||||
$url = new moodle_url('http://example.org/some_filename.flv');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->flash_plugin_engaged($t);
|
||||
$this->assertMatchesRegularExpression('~</video>~', $t);
|
||||
$this->assertMatchesRegularExpression('~<source src="http://example.org/some_filename.flv"~', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<a class="mediafallbacklink" href="http://example.org/some_filename.flv">some_filename.flv</a>~', $t);
|
||||
|
||||
// Flash disabled.
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
$url = new moodle_url('http://example.org/some_filename.flv');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->assertStringNotContainsString('mediaplugin_videojs', $t);
|
||||
@ -360,51 +342,15 @@ class media_videojs_player_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that VideoJS can embed RTMP streams.
|
||||
* Test that VideoJS can not embed RTMP streams.
|
||||
*/
|
||||
public function test_rtmp() {
|
||||
public function test_rtmp_behaviour() {
|
||||
$manager = core_media_manager::instance();
|
||||
|
||||
// RTMP disabled, flash disabled.
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
set_config('rtmp', 0, 'media_videojs');
|
||||
$url = new moodle_url('rtmp://example.com/fms&mp4:path/to/file.mp4');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->assertStringNotContainsString('mediaplugin_videojs', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<a class="mediafallbacklink" href="rtmp://example.com/fms&mp4:path/to/file.mp4">file.mp4</a>~', $t);
|
||||
|
||||
// RTMP enabled, flash disabled.
|
||||
set_config('useflash', 0, 'media_videojs');
|
||||
set_config('rtmp', 1, 'media_videojs');
|
||||
$url = new moodle_url('rtmp://example.com/fms&mp4:path/to/file.mp4');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->assertStringNotContainsString('mediaplugin_videojs', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<a class="mediafallbacklink" href="rtmp://example.com/fms&mp4:path/to/file.mp4">file.mp4</a>~', $t);
|
||||
|
||||
// RTMP enabled, flash enabled, rtmp/mp4 type expected.
|
||||
set_config('useflash', 1, 'media_videojs');
|
||||
set_config('rtmp', 1, 'media_videojs');
|
||||
$url = new moodle_url('rtmp://example.com/fms&mp4:path/to/file.mp4');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->flash_plugin_engaged($t);
|
||||
$this->assertMatchesRegularExpression('~</video>~', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<source src="rtmp://example.com/fms&mp4:path/to/file.mp4" type="rtmp/mp4"~', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<a class="mediafallbacklink" href="rtmp://example.com/fms&mp4:path/to/file.mp4">file.mp4</a>~', $t);
|
||||
|
||||
// RTMP enabled, flash enabled, rtmp/flv type expected.
|
||||
set_config('useflash', 1, 'media_videojs');
|
||||
set_config('rtmp', 1, 'media_videojs');
|
||||
$url = new moodle_url('rtmp://example.com/fms&flv:path/to/file.flv');
|
||||
$t = $manager->embed_url($url);
|
||||
$this->flash_plugin_engaged($t);
|
||||
$this->assertMatchesRegularExpression('~</video>~', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<source src="rtmp://example.com/fms&flv:path/to/file.flv" type="rtmp/flv"~', $t);
|
||||
$this->assertMatchesRegularExpression(
|
||||
'~<a class="mediafallbacklink" href="rtmp://example.com/fms&flv:path/to/file.flv">file.flv</a>~', $t);
|
||||
}
|
||||
}
|
||||
|
@ -21,18 +21,4 @@
|
||||
<version>7.10.0</version>
|
||||
<licenseversion>2.0</licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
<location>amd/src/videojs-flash-lazy.js</location>
|
||||
<name>The Flash tech for video.js </name>
|
||||
<license>Apache</license>
|
||||
<version>2.2.1</version>
|
||||
<licenseversion>2.0</licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
<location>videojs/video-js.swf</location>
|
||||
<name>Custom Flash Player for VideoJS</name>
|
||||
<license>Apache</license>
|
||||
<version>5.4.2</version>
|
||||
<licenseversion>2.0</licenseversion>
|
||||
</library>
|
||||
</libraries>
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2021052502; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2021052503; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2021052500; // Requires this Moodle version.
|
||||
$plugin->component = 'media_videojs'; // Full name of the plugin (used for diagnostics).
|
||||
|
@ -1,13 +0,0 @@
|
||||
Copyright Brightcove, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
Binary file not shown.
@ -1,6 +1,11 @@
|
||||
This files describes API changes in /media/ plugins,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 4.0 ===
|
||||
* The videojs-flash-lazy.js and videojs/video-js-swf libraries have been removed, because the Flash Player was deprecated
|
||||
in 2017 and officially discontinued on 31 December 2020. Besides, the rtmp and useflash settings have been removed because
|
||||
they are not required anymore, now that the flash support has been removed from the videojs media player.
|
||||
|
||||
=== 3.8 ===
|
||||
* The final deprecation of core_media_manager::setup() means that this function will no longer be called.
|
||||
The setup is now done in ::instance() so there is no need to call this.
|
||||
|
Loading…
x
Reference in New Issue
Block a user