This commit is contained in:
Sara Arjona 2022-06-07 17:20:41 +02:00
commit c6cca5f1fe
4 changed files with 6 additions and 6 deletions

View File

@ -1,3 +1,3 @@
define("media_videojs/loader",["exports","core/ajax","core/config","core_filters/events","core/localstorage","core/notification","jquery"],(function(_exports,_ajax,_config,_events,_localstorage,_notification,_jquery){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setUp=void 0,_ajax=_interopRequireDefault(_ajax),_config=_interopRequireDefault(_config),_localstorage=_interopRequireDefault(_localstorage),_notification=_interopRequireDefault(_notification),_jquery=_interopRequireDefault(_jquery);var _systemImportTransformerGlobalIdentifier="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}let firstLoad,language,langStringCache;_exports.setUp=lang=>{language=lang,firstLoad=!0,notifyVideoJS({detail:{nodes:document.body}}),document.addEventListener(_events.eventTypes.filterContentUpdated,notifyVideoJS)};const notifyVideoJS=e=>{const nodes=(0,_jquery.default)(e.detail.nodes),langStrings=getLanguageJson();nodes.find(".mediaplugin_videojs").addBack(".mediaplugin_videojs").find("audio, video").each(((index,element)=>{const id=(0,_jquery.default)(element).attr("id"),config=(0,_jquery.default)(element).data("setup-lazy"),modulePromises=["function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/video-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/video-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/video-lazy"])];config.techOrder&&-1!==config.techOrder.indexOf("youtube")&&modulePromises.push("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/Youtube-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/Youtube-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/Youtube-lazy"])),config.techOrder&&-1!==config.techOrder.indexOf("OgvJS")&&(config.ogvjs={worker:!0,wasm:!0,base:_config.default.wwwroot+"/media/player/videojs/ogvloader.php/"+_config.default.jsrev+"/"},modulePromises.push("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/videojs-ogvjs-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/videojs-ogvjs-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/videojs-ogvjs-lazy"]))),Promise.all([langStrings,...modulePromises]).then((_ref=>{let[langJson,videojs]=_ref;firstLoad&&(videojs.options.playbackRates=[.5,.75,1,1.25,1.5,1.75,2],videojs.options.userActions={hotkeys:!0},videojs.addLanguage(language,langJson),firstLoad=!1),videojs(id,config)})).catch(_notification.default.exception)}))},getLanguageJson=()=>{if(langStringCache)return Promise.resolve(langStringCache);const cacheKey="media_videojs/".concat(language),rawCacheContent=_localstorage.default.get(cacheKey);if(rawCacheContent){const cacheContent=JSON.parse(rawCacheContent);return langStringCache=cacheContent,Promise.resolve(langStringCache)}const request={methodname:"media_videojs_get_language",args:{lang:language}};return _ajax.default.call([request])[0].then((langStringData=>(_localstorage.default.set(cacheKey,langStringData),langStringData))).then((result=>JSON.parse(result))).then((langStrings=>(langStringCache=langStrings,langStrings)))}}));
define("media_videojs/loader",["exports","core/ajax","core/config","core_filters/events","core/localstorage","core/notification","jquery"],(function(_exports,_ajax,_config,_events,_localstorage,_notification,_jquery){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setUp=void 0,_ajax=_interopRequireDefault(_ajax),_config=_interopRequireDefault(_config),_localstorage=_interopRequireDefault(_localstorage),_notification=_interopRequireDefault(_notification),_jquery=_interopRequireDefault(_jquery);var _systemImportTransformerGlobalIdentifier="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}let firstLoad,language,langStringCache;_exports.setUp=lang=>{language=lang,firstLoad=!0,notifyVideoJS({detail:{nodes:document.body}}),document.addEventListener(_events.eventTypes.filterContentUpdated,notifyVideoJS)};const notifyVideoJS=e=>{const nodes=(0,_jquery.default)(e.detail.nodes),langStrings=getLanguageJson();nodes.find(".mediaplugin_videojs").addBack(".mediaplugin_videojs").find("audio, video").each(((index,element)=>{const id=(0,_jquery.default)(element).attr("id"),config=(0,_jquery.default)(element).data("setup-lazy"),modulePromises=["function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/video-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/video-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/video-lazy"])];config.techOrder&&-1!==config.techOrder.indexOf("youtube")&&modulePromises.push("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/Youtube-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/Youtube-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/Youtube-lazy"])),config.techOrder&&-1!==config.techOrder.indexOf("OgvJS")&&(config.ogvjs={worker:!0,wasm:!0,base:_config.default.wwwroot+"/media/player/videojs/ogvloader.php/"+_config.default.jsrev+"/"},modulePromises.push("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["media_videojs/videojs-ogvjs-lazy"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("media_videojs/videojs-ogvjs-lazy")):Promise.resolve(_systemImportTransformerGlobalIdentifier["media_videojs/videojs-ogvjs-lazy"]))),Promise.all([langStrings,...modulePromises]).then((_ref=>{let[langJson,videojs]=_ref;firstLoad&&(videojs.addLanguage(language,langJson),firstLoad=!1),videojs(id,config)})).catch(_notification.default.exception)}))},getLanguageJson=()=>{if(langStringCache)return Promise.resolve(langStringCache);const cacheKey="media_videojs/".concat(language),rawCacheContent=_localstorage.default.get(cacheKey);if(rawCacheContent){const cacheContent=JSON.parse(rawCacheContent);return langStringCache=cacheContent,Promise.resolve(langStringCache)}const request={methodname:"media_videojs_get_language",args:{lang:language}};return _ajax.default.call([request])[0].then((langStringData=>(_localstorage.default.set(cacheKey,langStringData),langStringData))).then((result=>JSON.parse(result))).then((langStrings=>(langStringCache=langStrings,langStrings)))}}));
//# sourceMappingURL=loader.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -100,10 +100,6 @@ const notifyVideoJS = e => {
Promise.all([langStrings, ...modulePromises])
.then(([langJson, videojs]) => {
if (firstLoad) {
videojs.options.playbackRates = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
videojs.options.userActions = {
hotkeys: true,
};
videojs.addLanguage(language, langJson);
firstLoad = false;

View File

@ -154,6 +154,10 @@ class media_videojs_plugin extends core_media_player_native {
$datasetup[] = '"aspectRatio": "1:0"';
}
// Additional setup for playback rate and user actions.
$datasetup[] = '"playbackRates": [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]';
$datasetup[] = '"userActions": {"hotkeys": true}';
// Attributes for the video/audio tag.
// We use data-setup-lazy as the attribute name for the config instead of
// data-setup because data-setup will cause video.js to load the player as soon as the library is loaded,