mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-65943 media_videojs: add videojs-ogvjs plugin
VideoJS now support to play Ogg Vorbis/Opus/Theora and WebM VP8/VP9/AV1 video on: - Safari on Mac OS - Safari on iPhone OS - Safari on iPad OS
This commit is contained in:
parent
ea0487cdef
commit
ed3f7bb078
56 changed files with 2303 additions and 3 deletions
129
lib/wasmlib.php
Normal file
129
lib/wasmlib.php
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?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/>.
|
||||
|
||||
/**
|
||||
* This file contains various Web Assembly related functions,
|
||||
* all functions here are self-contained and can be used in ABORT_AFTER_CONFIG scripts.
|
||||
*
|
||||
* @package core_lib
|
||||
* @copyright 2021 Huong Nguyen <huongnv13@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Send Web Assembly file content with as much caching as possible
|
||||
*
|
||||
* @param string $wasmpath Path to Web Assembly file
|
||||
* @param string $etag Etag
|
||||
* @param string $filename File name to be served
|
||||
*/
|
||||
function wasm_send_cached(string $wasmpath, string $etag, string $filename = 'wasm.php'): void {
|
||||
require(__DIR__ . '/xsendfilelib.php');
|
||||
|
||||
// 90 days only - based on Moodle point release cadence being every 3 months.
|
||||
$lifetime = 60 * 60 * 24 * 90;
|
||||
|
||||
header('Etag: "' . $etag . '"');
|
||||
header('Content-Disposition: inline; filename="' . $filename . '"');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($wasmpath)) . ' GMT');
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
|
||||
header('Pragma: ');
|
||||
header('Cache-Control: public, max-age=' . $lifetime . ', immutable');
|
||||
header('Accept-Ranges: none');
|
||||
header('Content-Type: application/wasm');
|
||||
|
||||
if (xsendfile($wasmpath)) {
|
||||
die;
|
||||
}
|
||||
|
||||
if (!min_enable_zlib_compression()) {
|
||||
header('Content-Length: ' . filesize($wasmpath));
|
||||
}
|
||||
|
||||
readfile($wasmpath);
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Web Assembly file without any caching
|
||||
*
|
||||
* @param string $wasm Web Assembly file content
|
||||
* @param string $filename File name to be served
|
||||
*/
|
||||
function wasm_send_uncached(string $wasm, string $filename = 'wasm.php'): void {
|
||||
header('Content-Disposition: inline; filename="' . $filename . '"');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2) . ' GMT');
|
||||
header('Pragma: ');
|
||||
header('Accept-Ranges: none');
|
||||
header('Content-Type: application/wasm');
|
||||
header('Content-Length: ' . strlen($wasm));
|
||||
|
||||
echo $wasm;
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Web Assembly file not modified headers
|
||||
*
|
||||
* @param int $lastmodified Last modified timestamp
|
||||
* @param string $etag Etag
|
||||
*/
|
||||
function wasm_send_unmodified(int $lastmodified, string $etag): void {
|
||||
// 90 days only - based on Moodle point release cadence being every 3 months.
|
||||
$lifetime = 60 * 60 * 24 * 90;
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
|
||||
header('Cache-Control: public, max-age=' . $lifetime);
|
||||
header('Content-Type: application/wasm');
|
||||
header('Etag: "' . $etag . '"');
|
||||
if ($lastmodified) {
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT');
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cache file for Web Assembly content
|
||||
*
|
||||
* @param string $file full file path to cache file
|
||||
* @param string $content Web Assembly content
|
||||
*/
|
||||
function wasm_write_cache_file_content(string $file, string $content): void {
|
||||
global $CFG;
|
||||
|
||||
clearstatcache();
|
||||
if (!file_exists(dirname($file))) {
|
||||
@mkdir(dirname($file), $CFG->directorypermissions, true);
|
||||
}
|
||||
|
||||
// Prevent serving of incomplete file from concurrent request,
|
||||
// the rename() should be more atomic than fwrite().
|
||||
ignore_user_abort(true);
|
||||
if ($fp = fopen($file . '.tmp', 'xb')) {
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
rename($file . '.tmp', $file);
|
||||
@chmod($file, $CFG->filepermissions);
|
||||
@unlink($file . '.tmp'); // Just in case anything fails.
|
||||
}
|
||||
ignore_user_abort(false);
|
||||
if (connection_aborted()) {
|
||||
die;
|
||||
}
|
||||
}
|
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/config","core/event","jquery","core/ajax","core/localstorage","core/notification"],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);d=h(d);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,s=function(a){q=a;p=!0;t(null,(0,d.default)("body"));c.default.getLegacyEvents().done(function(a){(0,d.default)(document).on(a.FILTER_CONTENT_UPDATED,t)})};a.setUp=s;var t=function(a,c){var e=u();c.find(".mediaplugin_videojs").addBack(".mediaplugin_videojs").find("audio, video").each(function(a,c){var f=(0,d.default)(c).attr("id"),h=(0,d.default)(c).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 c=i(a,2),d=c[0],e=c[1];if(p){e.options.flash.swf="".concat(b.default.wwwroot,"/media/player/videojs/videojs/video-js.swf");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(f,h)}).catch(g.default.exception)})},u=function(){if(r){return Promise.resolve(r)}var a="media_videojs/".concat(q),b=f.default.get(a);if(b){var d=JSON.parse(b);r=d;return Promise.resolve(r)}var c={methodname:"media_videojs_get_language",args:{lang:q}};return e.default.call([c])[0].then(function(b){f.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/config","core/event","jquery","core/ajax","core/localstorage","core/notification"],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);d=h(d);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,s=function(a){q=a;p=!0;t(null,(0,d.default)("body"));c.default.getLegacyEvents().done(function(a){(0,d.default)(document).on(a.FILTER_CONTENT_UPDATED,t)})};a.setUp=s;var t=function(a,c){var e=u();c.find(".mediaplugin_videojs").addBack(".mediaplugin_videojs").find("audio, video").each(function(a,c){var f=(0,d.default)(c).attr("id"),h=(0,d.default)(c).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"]))}if(h.techOrder&&-1!==h.techOrder.indexOf("OgvJS")){h.ogvjs={worker:!0,wasm:!0,base:b.default.wwwroot+"/media/player/videojs/ogvloader.php/"+b.default.jsrev+"/"};j.push("function"==typeof o.define&&o.define.amd?new Promise(function(a,b){o.require(["media_videojs/videojs-ogvjs-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-ogvjs-lazy"))):Promise.resolve(o["media_videojs/videojs-ogvjs-lazy"]))}Promise.all([e].concat(j)).then(function(a){var c=i(a,2),d=c[0],e=c[1];if(p){e.options.flash.swf="".concat(b.default.wwwroot,"/media/player/videojs/videojs/video-js.swf");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(f,h)}).catch(g.default.exception)})},u=function(){if(r){return Promise.resolve(r)}var a="media_videojs/".concat(q),b=f.default.get(a);if(b){var d=JSON.parse(b);r=d;return Promise.resolve(r)}var c={methodname:"media_videojs_get_language",args:{lang:q}};return e.default.call([c])[0].then(function(b){f.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
2
media/player/videojs/amd/build/local/ogv/ogv.min.js
vendored
Normal file
2
media/player/videojs/amd/build/local/ogv/ogv.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
media/player/videojs/amd/build/local/ogv/ogv.min.js.map
Normal file
1
media/player/videojs/amd/build/local/ogv/ogv.min.js.map
Normal file
File diff suppressed because one or more lines are too long
2
media/player/videojs/amd/build/videojs-ogvjs-lazy.min.js
vendored
Normal file
2
media/player/videojs/amd/build/videojs-ogvjs-lazy.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -85,6 +85,15 @@ const notifyVideoJS = (e, nodes) => {
|
|||
// Add Flash to the list of modules we require.
|
||||
modulePromises.push(import('media_videojs/videojs-flash-lazy'));
|
||||
}
|
||||
if (config.techOrder && config.techOrder.indexOf('OgvJS') !== -1) {
|
||||
config.ogvjs = {
|
||||
worker: true,
|
||||
wasm: true,
|
||||
base: Config.wwwroot + '/media/player/videojs/ogvloader.php/' + Config.jsrev + '/'
|
||||
};
|
||||
// Add Ogv.JS to the list of modules we require.
|
||||
modulePromises.push(import('media_videojs/videojs-ogvjs-lazy'));
|
||||
}
|
||||
Promise.all([langStrings, ...modulePromises])
|
||||
.then(([langJson, videojs]) => {
|
||||
if (firstLoad) {
|
||||
|
|
2
media/player/videojs/amd/src/local/ogv/ogv.js
Normal file
2
media/player/videojs/amd/src/local/ogv/ogv.js
Normal file
File diff suppressed because one or more lines are too long
853
media/player/videojs/amd/src/videojs-ogvjs-lazy.js
Normal file
853
media/player/videojs/amd/src/videojs-ogvjs-lazy.js
Normal file
|
@ -0,0 +1,853 @@
|
|||
/**
|
||||
* videojs-ogvjs
|
||||
* @version 0.1.2
|
||||
* @copyright 2021 Huong Nguyen <huongnv13@gmail.com>
|
||||
* @license MIT
|
||||
*/
|
||||
/*! @name videojs-ogvjs @version 0.1.2 @license MIT */
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('OGVCompat'), require('OGVLoader'), require('OGVPlayer')) :
|
||||
typeof define === 'function' && define.amd ? define(['media_videojs/video-lazy', './local/ogv/ogv'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojsOgvjs = factory(global.videojs, global.OGVCompat, global.OGVLoader, global.OGVPlayer));
|
||||
}(this, (function (videojs, ogvBase) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
|
||||
var OGVCompat__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVCompat);
|
||||
var OGVLoader__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVLoader);
|
||||
var OGVPlayer__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVPlayer);
|
||||
|
||||
function createCommonjsModule(fn, basedir, module) {
|
||||
return module = {
|
||||
path: basedir,
|
||||
exports: {},
|
||||
require: function (path, base) {
|
||||
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
||||
}
|
||||
}, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
function commonjsRequire () {
|
||||
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
||||
}
|
||||
|
||||
var setPrototypeOf = createCommonjsModule(function (module) {
|
||||
function _setPrototypeOf(o, p) {
|
||||
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
module.exports = _setPrototypeOf;
|
||||
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
||||
});
|
||||
|
||||
var inheritsLoose = createCommonjsModule(function (module) {
|
||||
function _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
module.exports = _inheritsLoose;
|
||||
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
||||
});
|
||||
|
||||
var Tech = videojs__default['default'].getComponent('Tech');
|
||||
var androidOS = 'Android';
|
||||
var iPhoneOS = 'iPhoneOS';
|
||||
var iPadOS = 'iPadOS';
|
||||
var otherOS = 'Other';
|
||||
/**
|
||||
* Object.defineProperty but "lazy", which means that the value is only set after
|
||||
* it retrieved the first time, rather than being set right away.
|
||||
*
|
||||
* @param {Object} obj the object to set the property on.
|
||||
* @param {string} key the key for the property to set.
|
||||
* @param {Function} getValue the function used to get the value when it is needed.
|
||||
* @param {boolean} setter whether a setter should be allowed or not.
|
||||
*/
|
||||
|
||||
var defineLazyProperty = function defineLazyProperty(obj, key, getValue, setter) {
|
||||
if (setter === void 0) {
|
||||
setter = true;
|
||||
}
|
||||
|
||||
var set = function set(value) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
writable: true
|
||||
});
|
||||
};
|
||||
|
||||
var options = {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
var value = getValue();
|
||||
set(value);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
if (setter) {
|
||||
options.set = set;
|
||||
}
|
||||
|
||||
return Object.defineProperty(obj, key, options);
|
||||
};
|
||||
/**
|
||||
* Get the device's OS.
|
||||
*
|
||||
* @return {string} Device's OS.
|
||||
*/
|
||||
|
||||
|
||||
var getDeviceOS = function getDeviceOS() {
|
||||
/* global navigator */
|
||||
var ua = navigator.userAgent;
|
||||
|
||||
if (/android/i.test(ua)) {
|
||||
return androidOS;
|
||||
} else if (/iPad|iPhone|iPod/.test(ua)) {
|
||||
return iPhoneOS;
|
||||
} else if (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) {
|
||||
return iPadOS;
|
||||
}
|
||||
|
||||
return otherOS;
|
||||
};
|
||||
/**
|
||||
* OgvJS Media Controller - Wrapper for ogv.js Media API
|
||||
*
|
||||
* @mixes Tech~SourceHandlerAdditions
|
||||
* @extends Tech
|
||||
*/
|
||||
|
||||
|
||||
var OgvJS = /*#__PURE__*/function (_Tech) {
|
||||
inheritsLoose(OgvJS, _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 `OgvJS` Tech is ready.
|
||||
*/
|
||||
function OgvJS(options, ready) {
|
||||
var _this;
|
||||
|
||||
_this = _Tech.call(this, options, ready) || this;
|
||||
_this.el_.src = options.source.src;
|
||||
OgvJS.setIfAvailable(_this.el_, 'autoplay', options.autoplay);
|
||||
OgvJS.setIfAvailable(_this.el_, 'loop', options.loop);
|
||||
OgvJS.setIfAvailable(_this.el_, 'poster', options.poster);
|
||||
OgvJS.setIfAvailable(_this.el_, 'preload', options.preload);
|
||||
|
||||
_this.on('loadedmetadata', function () {
|
||||
if (getDeviceOS() === iPhoneOS) {
|
||||
// iPhoneOS add some inline styles to the canvas, we need to remove it.
|
||||
var canvas = this.el_.getElementsByTagName('canvas')[0];
|
||||
canvas.style.removeProperty('width');
|
||||
canvas.style.removeProperty('margin');
|
||||
}
|
||||
|
||||
this.triggerReady();
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Create the 'OgvJS' Tech's DOM element.
|
||||
*
|
||||
* @return {Element} The element that gets created.
|
||||
*/
|
||||
|
||||
|
||||
var _proto = OgvJS.prototype;
|
||||
|
||||
_proto.createEl = function createEl() {
|
||||
var options = this.options_;
|
||||
|
||||
if (options.base) {
|
||||
OGVLoader__default['default'].base = options.base;
|
||||
} else {
|
||||
throw new Error('Please specify the base for the ogv.js library');
|
||||
}
|
||||
|
||||
var el = new OGVPlayer__default['default'](options);
|
||||
el.className += ' vjs-tech';
|
||||
options.tag = el;
|
||||
return el;
|
||||
}
|
||||
/**
|
||||
* Start playback
|
||||
*
|
||||
* @method play
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.play = function play() {
|
||||
this.el_.play();
|
||||
}
|
||||
/**
|
||||
* Get the current playback speed.
|
||||
*
|
||||
* @return {number}
|
||||
* @method playbackRate
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.playbackRate = function playbackRate() {
|
||||
return this.el_.playbackRate || 1;
|
||||
}
|
||||
/**
|
||||
* Set the playback speed.
|
||||
*
|
||||
* @param {number} val Speed for the player to play.
|
||||
* @method setPlaybackRate
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setPlaybackRate = function setPlaybackRate(val) {
|
||||
if (this.el_.hasOwnProperty('playbackRate')) {
|
||||
this.el_.playbackRate = val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a TimeRanges object that represents the ranges of the media resource that the user agent has played.
|
||||
*
|
||||
* @return {TimeRangeObject} the range of points on the media timeline that has been reached through normal playback
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.played = function played() {
|
||||
return this.el_.played;
|
||||
}
|
||||
/**
|
||||
* Pause playback
|
||||
*
|
||||
* @method pause
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.pause = function pause() {
|
||||
this.el_.pause();
|
||||
}
|
||||
/**
|
||||
* Is the player paused or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method paused
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.paused = function paused() {
|
||||
return this.el_.paused;
|
||||
}
|
||||
/**
|
||||
* Get current playing time.
|
||||
*
|
||||
* @return {number}
|
||||
* @method currentTime
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.currentTime = function currentTime() {
|
||||
return this.el_.currentTime;
|
||||
}
|
||||
/**
|
||||
* Set current playing time.
|
||||
*
|
||||
* @param {number} seconds Current time of audio/video.
|
||||
* @method setCurrentTime
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setCurrentTime = function setCurrentTime(seconds) {
|
||||
try {
|
||||
this.el_.currentTime = seconds;
|
||||
} catch (e) {
|
||||
videojs__default['default'].log(e, 'Media is not ready. (Video.JS)');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get media's duration.
|
||||
*
|
||||
* @return {number}
|
||||
* @method duration
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.duration = function duration() {
|
||||
if (this.el_.duration && this.el_.duration !== Infinity) {
|
||||
return this.el_.duration;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Get a TimeRange object that represents the intersection
|
||||
* of the time ranges for which the user agent has all
|
||||
* relevant media.
|
||||
*
|
||||
* @return {TimeRangeObject}
|
||||
* @method buffered
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.buffered = function buffered() {
|
||||
return this.el_.buffered;
|
||||
}
|
||||
/**
|
||||
* Get current volume level.
|
||||
*
|
||||
* @return {number}
|
||||
* @method volume
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.volume = function volume() {
|
||||
return this.el_.hasOwnProperty('volume') ? this.el_.volume : 1;
|
||||
}
|
||||
/**
|
||||
* Set current playing volume level.
|
||||
*
|
||||
* @param {number} percentAsDecimal Volume percent as a decimal.
|
||||
* @method setVolume
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setVolume = function setVolume(percentAsDecimal) {
|
||||
if (getDeviceOS() !== iPhoneOS && this.el_.hasOwnProperty('volume')) {
|
||||
this.el_.volume = percentAsDecimal;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Is the player muted or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method muted
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.muted = function muted() {
|
||||
return this.el_.muted;
|
||||
}
|
||||
/**
|
||||
* Mute the player.
|
||||
*
|
||||
* @param {boolean} muted True to mute the player.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setMuted = function setMuted(muted) {
|
||||
this.el_.muted = !!muted;
|
||||
}
|
||||
/**
|
||||
* Is the player muted by default or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method defaultMuted
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.defaultMuted = function defaultMuted() {
|
||||
return this.el_.defaultMuted || false;
|
||||
}
|
||||
/**
|
||||
* Get the player width.
|
||||
*
|
||||
* @return {number}
|
||||
* @method width
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.width = function width() {
|
||||
return this.el_.offsetWidth;
|
||||
}
|
||||
/**
|
||||
* Get the player height.
|
||||
*
|
||||
* @return {number}
|
||||
* @method height
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.height = function height() {
|
||||
return this.el_.offsetHeight;
|
||||
}
|
||||
/**
|
||||
* Get the video width.
|
||||
*
|
||||
* @return {number}
|
||||
* @method videoWidth
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.videoWidth = function videoWidth() {
|
||||
return this.el_.videoWidth;
|
||||
}
|
||||
/**
|
||||
* Get the video height.
|
||||
*
|
||||
* @return {number}
|
||||
* @method videoHeight
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.videoHeight = function videoHeight() {
|
||||
return this.el_.videoHeight;
|
||||
}
|
||||
/**
|
||||
* Get/set media source.
|
||||
*
|
||||
* @param {Object=} src Source object
|
||||
* @return {Object}
|
||||
* @method src
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.src = function src(_src) {
|
||||
if (typeof _src === 'undefined') {
|
||||
return this.el_.src;
|
||||
}
|
||||
|
||||
this.el_.src = _src;
|
||||
}
|
||||
/**
|
||||
* Load the media into the player.
|
||||
*
|
||||
* @method load
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.load = function load() {
|
||||
this.el_.load();
|
||||
}
|
||||
/**
|
||||
* Get current media source.
|
||||
*
|
||||
* @return {Object}
|
||||
* @method currentSrc
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.currentSrc = function currentSrc() {
|
||||
if (this.currentSource_) {
|
||||
return this.currentSource_.src;
|
||||
}
|
||||
|
||||
return this.el_.currentSrc;
|
||||
}
|
||||
/**
|
||||
* Get media poster URL.
|
||||
*
|
||||
* @return {string}
|
||||
* @method poster
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.poster = function poster() {
|
||||
return this.el_.poster;
|
||||
}
|
||||
/**
|
||||
* Set media poster URL.
|
||||
*
|
||||
* @param {string} url the poster image's url.
|
||||
* @method
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setPoster = function setPoster(url) {
|
||||
this.el_.poster = url;
|
||||
}
|
||||
/**
|
||||
* Is the media preloaded or not.
|
||||
*
|
||||
* @return {string}
|
||||
* @method preload
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.preload = function preload() {
|
||||
return this.el_.preload || 'none';
|
||||
}
|
||||
/**
|
||||
* Set the media preload method.
|
||||
*
|
||||
* @param {string} val Value for preload attribute.
|
||||
* @method setPreload
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setPreload = function setPreload(val) {
|
||||
if (this.el_.hasOwnProperty('preload')) {
|
||||
this.el_.preload = val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Is the media auto-played or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method autoplay
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.autoplay = function autoplay() {
|
||||
return this.el_.autoplay || false;
|
||||
}
|
||||
/**
|
||||
* Set media autoplay method.
|
||||
*
|
||||
* @param {boolean} val Value for autoplay attribute.
|
||||
* @method setAutoplay
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setAutoplay = function setAutoplay(val) {
|
||||
if (this.el_.hasOwnProperty('autoplay')) {
|
||||
this.el_.autoplay = !!val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Does the media has controls or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method controls
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.controls = function controls() {
|
||||
return this.el_.controls || false;
|
||||
}
|
||||
/**
|
||||
* Set the media controls method.
|
||||
*
|
||||
* @param {boolean} val Value for controls attribute.
|
||||
* @method setControls
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setControls = function setControls(val) {
|
||||
if (this.el_.hasOwnProperty('controls')) {
|
||||
this.el_.controls = !!val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Is the media looped or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method loop
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.loop = function loop() {
|
||||
return this.el_.loop || false;
|
||||
}
|
||||
/**
|
||||
* Set the media loop method.
|
||||
*
|
||||
* @param {boolean} val Value for loop attribute.
|
||||
* @method setLoop
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.setLoop = function setLoop(val) {
|
||||
if (this.el_.hasOwnProperty('loop')) {
|
||||
this.el_.loop = !!val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get a TimeRanges object that represents the
|
||||
* ranges of the media resource to which it is possible
|
||||
* for the user agent to seek.
|
||||
*
|
||||
* @return {TimeRangeObject}
|
||||
* @method seekable
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.seekable = function seekable() {
|
||||
return this.el_.seekable;
|
||||
}
|
||||
/**
|
||||
* Is player in the "seeking" state or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method seeking
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.seeking = function seeking() {
|
||||
return this.el_.seeking;
|
||||
}
|
||||
/**
|
||||
* Is the media ended or not.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @method ended
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.ended = function ended() {
|
||||
return this.el_.ended;
|
||||
}
|
||||
/**
|
||||
* Get the current state of network activity
|
||||
* NETWORK_EMPTY (numeric value 0)
|
||||
* NETWORK_IDLE (numeric value 1)
|
||||
* NETWORK_LOADING (numeric value 2)
|
||||
* NETWORK_NO_SOURCE (numeric value 3)
|
||||
*
|
||||
* @return {number}
|
||||
* @method networkState
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.networkState = function networkState() {
|
||||
return this.el_.networkState;
|
||||
}
|
||||
/**
|
||||
* Get the current state of the player.
|
||||
* HAVE_NOTHING (numeric value 0)
|
||||
* HAVE_METADATA (numeric value 1)
|
||||
* HAVE_CURRENT_DATA (numeric value 2)
|
||||
* HAVE_FUTURE_DATA (numeric value 3)
|
||||
* HAVE_ENOUGH_DATA (numeric value 4)
|
||||
*
|
||||
* @return {number}
|
||||
* @method readyState
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.readyState = function readyState() {
|
||||
return this.el_.readyState;
|
||||
}
|
||||
/**
|
||||
* Does the player support native fullscreen mode or not. (Mobile devices)
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.supportsFullScreen = function supportsFullScreen() {
|
||||
// iOS devices have some problem with HTML5 fullscreen api so we need to fallback to fullWindow mode.
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Get media player error.
|
||||
*
|
||||
* @return {string}
|
||||
* @method error
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.error = function error() {
|
||||
return this.el_.error;
|
||||
};
|
||||
|
||||
return OgvJS;
|
||||
}(Tech);
|
||||
/**
|
||||
* List of available events of the media player.
|
||||
*
|
||||
* @private
|
||||
* @type {Array}
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.Events = ['loadstart', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'progress', 'play', 'pause', 'ratechange', 'resize', 'volumechange'];
|
||||
/**
|
||||
* Set the value for the player is it has that property.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {string} name
|
||||
* @param value
|
||||
*/
|
||||
|
||||
OgvJS.setIfAvailable = function (el, name, value) {
|
||||
if (el.hasOwnProperty(name)) {
|
||||
el[name] = value;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Check if browser/device is supported by Ogv.JS.
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.isSupported = function () {
|
||||
return OGVCompat__default['default'].supported('OGVPlayer');
|
||||
};
|
||||
/**
|
||||
* Check if the tech can support the given type.
|
||||
*
|
||||
* @param {string} type The mimetype to check
|
||||
* @return {string} 'probably', 'maybe', or '' (empty string)
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.canPlayType = function (type) {
|
||||
return type.indexOf('/ogg') !== -1 || type.indexOf('/webm') ? 'maybe' : '';
|
||||
};
|
||||
/**
|
||||
* Check if the tech can support the given source
|
||||
*
|
||||
* @param srcObj The source object
|
||||
* @return {string} The options passed to the tech
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.canPlaySource = function (srcObj) {
|
||||
return OgvJS.canPlayType(srcObj.type);
|
||||
};
|
||||
/**
|
||||
* Check if the volume can be changed in this browser/device.
|
||||
* Volume cannot be changed in a lot of mobile devices.
|
||||
* Specifically, it can't be changed from 1 on iOS.
|
||||
*
|
||||
* @return {boolean} True if volume can be controlled.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.canControlVolume = function () {
|
||||
if (getDeviceOS() === iPhoneOS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var p = new OGVPlayer__default['default']();
|
||||
return p.hasOwnProperty('volume');
|
||||
};
|
||||
/**
|
||||
* Check if the volume can be muted in this browser/device.
|
||||
*
|
||||
* @return {boolean} True if volume can be muted.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.canMuteVolume = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Check if the playback rate can be changed in this browser/device.
|
||||
*
|
||||
* @return {boolean} True if playback rate can be controlled.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.canControlPlaybackRate = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Check to see if native 'TextTracks' are supported by this browser/device.
|
||||
*
|
||||
* @return {boolean} True if native 'TextTracks' are supported.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.supportsNativeTextTracks = function () {
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Check if the fullscreen resize is supported by this browser/device.
|
||||
*
|
||||
* @return {boolean} True if the fullscreen resize is supported.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.supportsFullscreenResize = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Check if the progress events is supported by this browser/device.
|
||||
*
|
||||
* @return {boolean} True if the progress events is supported.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.supportsProgressEvents = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Check if the time update events is supported by this browser/device.
|
||||
*
|
||||
* @return {boolean} True if the time update events is supported.
|
||||
*/
|
||||
|
||||
|
||||
OgvJS.supportsTimeupdateEvents = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech supports volume control.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.canControlVolume}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech supports muting volume.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.canMuteVolume}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech supports changing the speed at which the media plays.
|
||||
* Examples:
|
||||
* - Set player to play 2x (twice) as fast.
|
||||
* - Set player to play 0.5x (half) as fast.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.canControlPlaybackRate}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech currently supports native 'TextTracks'.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.supportsNativeTextTracks}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech currently supports fullscreen resize.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.supportsFullscreenResize}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech currently supports progress events.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.supportsProgressEvents}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the 'OgvJS' tech currently supports time update events.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default {@link OgvJS.supportsTimeupdateEvents}
|
||||
*/
|
||||
|
||||
|
||||
[['featuresVolumeControl', 'canControlVolume'], ['featuresMuteControl', 'canMuteVolume'], ['featuresPlaybackRate', 'canControlPlaybackRate'], ['featuresNativeTextTracks', 'supportsNativeTextTracks'], ['featuresFullscreenResize', 'supportsFullscreenResize'], ['featuresProgressEvents', 'supportsProgressEvents'], ['featuresTimeupdateEvents', 'supportsTimeupdateEvents']].forEach(function (_ref) {
|
||||
var key = _ref[0],
|
||||
fn = _ref[1];
|
||||
defineLazyProperty(OgvJS.prototype, key, function () {
|
||||
OgvJS[fn]();
|
||||
}, true);
|
||||
});
|
||||
Tech.registerTech('OgvJS', OgvJS);
|
||||
|
||||
return OgvJS;
|
||||
|
||||
})));
|
|
@ -40,6 +40,15 @@ class media_videojs_plugin extends core_media_player_native {
|
|||
protected $extensions = null;
|
||||
/** @var bool is this a youtube link */
|
||||
protected $youtube = false;
|
||||
/** @var bool Need to use Ogv.JS Tech plugin or not. */
|
||||
protected $ogvtech = false;
|
||||
/** @var array Ogv.JS supported extensions */
|
||||
protected $ogvsupportedextensions = [
|
||||
'.ogv',
|
||||
'.webm',
|
||||
'.oga',
|
||||
'.ogg'
|
||||
];
|
||||
|
||||
/**
|
||||
* Generates code required to embed the player.
|
||||
|
@ -127,6 +136,10 @@ class media_videojs_plugin extends core_media_player_native {
|
|||
$datasetup[] = '"techOrder": ["flash", "html5"]';
|
||||
}
|
||||
|
||||
if ($this->ogvtech) {
|
||||
$datasetup[] = '"techOrder": ["OgvJS"]';
|
||||
}
|
||||
|
||||
// Add a language.
|
||||
if ($this->language) {
|
||||
$datasetup[] = '"language": "' . $this->language . '"';
|
||||
|
@ -305,6 +318,15 @@ class media_videojs_plugin extends core_media_player_native {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Ogv.JS Tech.
|
||||
$this->ogvtech = false;
|
||||
if (in_array($ext, $this->ogvsupportedextensions) &&
|
||||
(core_useragent::is_safari() || core_useragent::is_ios())) {
|
||||
$this->ogvtech = true;
|
||||
$result[] = $url;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!get_config('media_videojs', 'useflash')) {
|
||||
return parent::list_supported_urls($urls, $options);
|
||||
} else {
|
||||
|
|
21
media/player/videojs/ogvjs/COPYING
Normal file
21
media/player/videojs/ogvjs/COPYING
Normal file
|
@ -0,0 +1,21 @@
|
|||
ogv.js wrapper and player code
|
||||
|
||||
Copyright (c) 2013-2019 Brion Vibber and other contributors
|
||||
|
||||
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
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
23
media/player/videojs/ogvjs/COPYING-dav1d.txt
Normal file
23
media/player/videojs/ogvjs/COPYING-dav1d.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
Copyright © 2018-2019, VideoLAN and dav1d authors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
media/player/videojs/ogvjs/COPYING-ogg.txt
Normal file
28
media/player/videojs/ogvjs/COPYING-ogg.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
Copyright (c) 2002, Xiph.org Foundation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
44
media/player/videojs/ogvjs/COPYING-opus.txt
Normal file
44
media/player/videojs/ogvjs/COPYING-opus.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
|
||||
Jean-Marc Valin, Timothy B. Terriberry,
|
||||
CSIRO, Gregory Maxwell, Mark Borgerding,
|
||||
Erik de Castro Lopo
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||
names of specific contributors, may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Opus is subject to the royalty-free patent licenses which are
|
||||
specified at:
|
||||
|
||||
Xiph.Org Foundation:
|
||||
https://datatracker.ietf.org/ipr/1524/
|
||||
|
||||
Microsoft Corporation:
|
||||
https://datatracker.ietf.org/ipr/1914/
|
||||
|
||||
Broadcom Corporation:
|
||||
https://datatracker.ietf.org/ipr/1526/
|
28
media/player/videojs/ogvjs/COPYING-theora.txt
Normal file
28
media/player/videojs/ogvjs/COPYING-theora.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
Copyright (C) 2002-2009 Xiph.org Foundation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
media/player/videojs/ogvjs/COPYING-vorbis.txt
Normal file
28
media/player/videojs/ogvjs/COPYING-vorbis.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
Copyright (c) 2002-2018 Xiph.org Foundation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
13
media/player/videojs/ogvjs/LICENSE-nestegg.txt
Normal file
13
media/player/videojs/ogvjs/LICENSE-nestegg.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
Copyright © 2010 Mozilla Foundation
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
31
media/player/videojs/ogvjs/LICENSE-vpx.txt
Normal file
31
media/player/videojs/ogvjs/LICENSE-vpx.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
Copyright (c) 2010, The WebM Project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google, nor the WebM Project, nor the names
|
||||
of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
23
media/player/videojs/ogvjs/PATENTS-vpx.txt
Normal file
23
media/player/videojs/ogvjs/PATENTS-vpx.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
Additional IP Rights Grant (Patents)
|
||||
------------------------------------
|
||||
|
||||
"These implementations" means the copyrightable works that implement the WebM
|
||||
codecs distributed by Google as part of the WebM Project.
|
||||
|
||||
Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
|
||||
royalty-free, irrevocable (except as stated in this section) patent license to
|
||||
make, have made, use, offer to sell, sell, import, transfer, and otherwise
|
||||
run, modify and propagate the contents of these implementations of WebM, where
|
||||
such license applies only to those patent claims, both currently owned by
|
||||
Google and acquired in the future, licensable by Google that are necessarily
|
||||
infringed by these implementations of WebM. This grant does not include claims
|
||||
that would be infringed only as a consequence of further modification of these
|
||||
implementations. If you or your agent or exclusive licensee institute or order
|
||||
or agree to the institution of patent litigation or any other patent
|
||||
enforcement activity against any entity (including a cross-claim or
|
||||
counterclaim in a lawsuit) alleging that any of these implementations of WebM
|
||||
or any code incorporated within any of these implementations of WebM
|
||||
constitute direct or contributory patent infringement, or inducement of
|
||||
patent infringement, then any patent rights granted to you under this License
|
||||
for these implementations of WebM shall terminate as of the date such
|
||||
litigation is filed.
|
382
media/player/videojs/ogvjs/README.md
Normal file
382
media/player/videojs/ogvjs/README.md
Normal file
|
@ -0,0 +1,382 @@
|
|||
ogv.js
|
||||
======
|
||||
|
||||
Media decoder and player for Ogg Vorbis/Opus/Theora and WebM VP8/VP9/AV1 video.
|
||||
|
||||
Based around libogg, libvorbis, libtheora, libopus, libvpx, libnestegg and dav1d compiled to JavaScript and WebAssembly with Emscripten.
|
||||
|
||||
## Updates
|
||||
|
||||
1.8.4 - 2021-07-02
|
||||
* Fix for fix for OGVLoader.base fix
|
||||
|
||||
1.8.3 - 2021-07-02
|
||||
* Fixes for build with emscripten 2.0.25
|
||||
* Fix for nextTick/setImmediate-style polyfill in front-end
|
||||
* Provisional fix for OGVLoader.base not working with CDNs
|
||||
* the fallback code for loading a non-local worker had been broken with WebAssembly for some time, sorry!
|
||||
|
||||
1.8.2 - errored out
|
||||
|
||||
1.8.1 - 2021-02-18
|
||||
* Fixed OGVCompat APIs to correctly return false without WebAssembly and Web Audio
|
||||
|
||||
1.8.0 - 2021-02-09
|
||||
* Dropping IE support and Flash audio backend
|
||||
* Updated to stream-file 0.3.0
|
||||
* Updated to audio-feeder 0.5.0
|
||||
* The old IE 10/11 support _no longer works_ due to the Flash plugin being disabled, and so is being removed
|
||||
* Drop es6-promise shim
|
||||
* Now requires WebAssembly, which requires native Promise support
|
||||
* Build & fixes
|
||||
* Demo fixed (removed test files that are now offline)
|
||||
* Builds with emscripten 2.0.13
|
||||
* Requires latest meson from git pending a fix hitting release
|
||||
|
||||
1.7.0 - 2020-09-28
|
||||
* Builds with emscripten's LLVM upstream backend
|
||||
* Updated to build with emscripten 2.0.4
|
||||
* Reduced amount of memory used between GC runs by reusing frame buffers
|
||||
* Removed `memoryLimit` option
|
||||
* JS, Wasm, and threaded Wasm builds now all use dynamic memory growth
|
||||
* Updated dav1d
|
||||
* Updated libvpx to 1.8.1
|
||||
* Experimental SIMD builds of AV1 decoder optional, with `make SIMD=1`
|
||||
* These work in Chrome with the "WebAssembly SIMD" flag enabled in chrome://flags/
|
||||
* Significant speed boost when available.
|
||||
* Available with and without multithreading.
|
||||
* Must enable explicitly with `simd: true` in `options`.
|
||||
* Experimental SIMD work for VP9 as well, incomplete.
|
||||
|
||||
1.6.1 - 2019-06-18
|
||||
* playbackSpeed attribute now supported
|
||||
* updated audio-feeder to 0.4.21;
|
||||
* mono audio is now less loud, matching native playback better
|
||||
* audio resampling now uses linear interpolation for upscaling
|
||||
* fix for IE in bundling scenarios that use strict mode
|
||||
* tempo change support thanks to a great patch from velochy!
|
||||
* updated yuv-canvas to 1.2.6;
|
||||
* fixes for capturing WebGL canvas as MediaStream
|
||||
* fixes for seeks on low frame rate video
|
||||
* updated emscripten toolchain to 1.38.36
|
||||
* drop OUTLINING_LIMIT from AV1 JS build; doesn't work in newer emscripten and not really needed
|
||||
|
||||
1.6.0 - 2019-02-26
|
||||
* experimental support for AV1 video in WebM
|
||||
* update buildchain to emscripten 1.38.28
|
||||
* fix a stray global
|
||||
* starting to move to ES6 classes and modules
|
||||
* building with babel for ES5/IE11 compat
|
||||
* updated eslint
|
||||
* updated yuv-canvas to 1.2.4; fixes for software GL rendering
|
||||
* updated audio-feeder to 0.4.15; fixes for resampling and Flash perf
|
||||
* retooled buffer copies
|
||||
* sync fix for audio packets with discard padding
|
||||
* clients can pass a custom `StreamFile` instance as `{stream:foo}` in options. This can be useful for custom streaming until MSE interfaces are ready.
|
||||
* refactored WebM keyframe detection
|
||||
* prefill the frame pipeline as well as the audio pipeline before starting audio
|
||||
* removed BINARYEN_IGNORE_IMPLICIT_TRAPS=1 option which can cause intermittent breakages
|
||||
* changed download streaming method to avoid data corruption problem on certain files
|
||||
* fix for seek on very short WebM files
|
||||
* fix for replay-after-end-of-playback in WebM
|
||||
|
||||
See more details and history in [CHANGES.md](https://github.com/brion/ogv.js/blob/master/CHANGES.md)
|
||||
|
||||
## Current status
|
||||
|
||||
Note that as of 2021 ogv.js works pretty nicely but may still have some packagine oddities with tools like webpack. It should work via CDNs again as of 1.8.2 if you can't or don't want to package locally, but this is not documented well yet. Improved documentation will come with the next major update & code cleanup!
|
||||
|
||||
Since August 2015, ogv.js can be seen in action [on Wikipedia and Wikimedia Commons](https://commons.wikimedia.org/wiki/Commons:Video) in Safari and IE/Edge where native Ogg and WebM playback is not available. (See [technical details on MediaWiki integration](https://www.mediawiki.org/wiki/Extension:TimedMediaHandler/ogv.js).)
|
||||
|
||||
See also a standalone demo with performance metrics at https://brionv.com/misc/ogv.js/demo/
|
||||
|
||||
* streaming: yes (with Range header)
|
||||
* seeking: yes for Ogg and WebM (with Range header)
|
||||
* color: yes
|
||||
* audio: yes, with a/v sync (requires Web Audio or Flash)
|
||||
* background threading: yes (video, audio decoders in Workers)
|
||||
* [GPU accelerated drawing: yes (WebGL)](https://github.com/brion/ogv.js/wiki/GPU-acceleration)
|
||||
* GPU accelerated decoding: no
|
||||
* SIMD acceleration: no
|
||||
* Web Assembly: yes (with asm.js fallback)
|
||||
* multithreaded VP8, VP9, AV1: in development (set `options.threading` to `true`; requires flags to be enabled in Firefox 65 and Chrome 72, no support yet in Safari)
|
||||
* controls: no (currently provided by demo or other UI harness)
|
||||
|
||||
Ogg and WebM files are fairly well supported.
|
||||
|
||||
|
||||
## Goals
|
||||
|
||||
Long-form goal is to create a drop-in replacement for the HTML5 video and audio tags which can be used for basic playback of Ogg Theora and Vorbis or WebM media on browsers that don't support Ogg or WebM natively.
|
||||
|
||||
The API isn't quite complete, but works pretty well.
|
||||
|
||||
|
||||
## Compatibility
|
||||
|
||||
ogv.js requires a fast JS engine with typed arrays, and Web Audio for audio playback.
|
||||
|
||||
The primary target browsers are (testing 360p/30fps and up):
|
||||
* Safari 6.1-12 on Mac OS X 10.7-10.14
|
||||
* Safari on iOS 10-11 64-bit
|
||||
|
||||
Older versions of Safari have flaky JIT compilers. IE 9 and below lack typed arrays, and IE 10/11 no longer support an audio channel since the Flash plugin was sunset.
|
||||
|
||||
(Note that Windows and Mac OS X can support Ogg and WebM by installing codecs or alternate browsers with built-in support, but this is not possible on iOS where all browsers are really Safari.)
|
||||
|
||||
Testing browsers (these support .ogv and .webm natively):
|
||||
* Firefox 65
|
||||
* Chrome 73
|
||||
|
||||
|
||||
## Package installation
|
||||
|
||||
Pre-built releases of ogv.js are available as [.zip downloads from the GitHub releases page](https://github.com/brion/ogv.js/releases) and through the npm package manager.
|
||||
|
||||
You can load the `ogv.js` main entry point directly in a script tag, or bundle it through whatever build process you like. The other .js files must be made available for runtime loading, together in the same directory.
|
||||
|
||||
ogv.js will try to auto-detect the path to its resources based on the script element that loads ogv.js or ogv-support.js. If you load ogv.js through another bundler (such as browserify or MediaWiki's ResourceLoader) you may need to override this manually before instantiating players:
|
||||
|
||||
```
|
||||
// Path to ogv-demuxer-ogg.js, ogv-worker-audio.js, etc
|
||||
OGVLoader.base = '/path/to/resources';
|
||||
```
|
||||
|
||||
To fetch from npm:
|
||||
|
||||
```
|
||||
npm install ogv
|
||||
```
|
||||
|
||||
The distribution-ready files will appear in 'node_modules/ogv/dist'.
|
||||
|
||||
To load the player library into your browserify or webpack project:
|
||||
|
||||
```
|
||||
var ogv = require('ogv');
|
||||
|
||||
// Access public classes either as ogv.OGVPlayer or just OGVPlayer.
|
||||
// Your build/lint tools may be happier with ogv.OGVPlayer!
|
||||
ogv.OGVLoader.base = '/path/to/resources';
|
||||
var player = new ogv.OGVPlayer();
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The `OGVPlayer` class implements a player, and supports a subset of the events, properties and methods from [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) and [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
|
||||
|
||||
```
|
||||
// Create a new player with the constructor
|
||||
var player = new OGVPlayer();
|
||||
|
||||
// Or with options
|
||||
var player = new OGVPlayer({
|
||||
debug: true,
|
||||
debugFilter: /demuxer/
|
||||
});
|
||||
|
||||
// Now treat it just like a video or audio element
|
||||
containerElement.appendChild(player);
|
||||
player.src = 'path/to/media.ogv';
|
||||
player.play();
|
||||
player.addEventListener('ended', function() {
|
||||
// ta-da!
|
||||
});
|
||||
```
|
||||
|
||||
To check for compatibility before creating a player, include `ogv-support.js` and use the `OGVCompat` API:
|
||||
|
||||
```
|
||||
if (OGVCompat.supported('OGVPlayer')) {
|
||||
// go load the full player from ogv.js and instantiate stuff
|
||||
}
|
||||
```
|
||||
|
||||
This will check for typed arrays, web audio, blacklisted iOS versions, and super-slow/broken JIT compilers.
|
||||
|
||||
If you need a URL versioning/cache-buster parameter for dynamic loading of `ogv.js`, you can use the `OGVVersion` symbol provided by `ogv-support.js` or the even tinier `ogv-version.js`:
|
||||
|
||||
```
|
||||
var script = document.createElement('script');
|
||||
script.src = 'ogv.js?version=' + encodeURIComponent(OGVVersion);
|
||||
document.querySelector('head').appendChild(script);
|
||||
```
|
||||
|
||||
## Distribution notes
|
||||
|
||||
Entry points:
|
||||
* `ogv.js` contains the main runtime classes, including OGVPlayer, OGVLoader, and OGVCompat.
|
||||
* `ogv-support.js` contains the OGVCompat class and OGVVersion symbol, useful for checking for runtime support before loading the main `ogv.js`.
|
||||
* `ogv-version.js` contains only the OGVVersion symbol.
|
||||
|
||||
These entry points may be loaded directly from a script element, or concatenated into a larger project, or otherwise loaded as you like.
|
||||
|
||||
Further code modules are loaded at runtime, which must be available with their defined names together in a directory. If the files are not hosted same-origin to the web page that includes them, you will need to set up appropriate CORS headers to allow loading of the worker JS modules.
|
||||
|
||||
Dynamically loaded assets:
|
||||
* `ogv-worker-audio.js`, `ogv-worker-video.js`, and `*.worker.js` are Worker entry points, used to run video and audio decoders in the background.
|
||||
* `ogv-demuxer-ogg-wasm.js/.wasm` are used in playing .ogg, .oga, and .ogv files.
|
||||
* `ogv-demuxer-webm-wasm.js/.wasm` are used in playing .webm files.
|
||||
* `ogv-decoder-audio-vorbis-wasm.js/.wasm` and `ogv-decoder-audio-opus-wasm.js/.wasm` are used in playing both Ogg and WebM files containing audio.
|
||||
* `ogv-decoder-video-theora-wasm.js/.wasm` are used in playing .ogg and .ogv video files.
|
||||
* `ogv-decoder-video-vp8-wasm.js/.wasm` and `ogv-decoder-video-vp9-wasm.js/.wasm` are used in playing .webm video files.
|
||||
* `*-mt.js/.wasm` are the multithreaded versions of some of the above modules. They have additional support files.
|
||||
|
||||
If you know you will never use particular formats or codecs you can skip bundling them; for instance if you only need to play Ogg files you don't need `ogv-demuxer-webm-wasm.js` or `ogv-decoder-video-vp8-wasm.js` which are only used for WebM.
|
||||
|
||||
|
||||
## Performance
|
||||
|
||||
(This section is somewhat out of date.)
|
||||
|
||||
As of 2015, for SD-or-less resolution basic Ogg Theora decoding speed is reliable on desktop and newer high-end mobile devices; current high-end desktops and laptops can even reach HD resolutions. Older and low-end mobile devices may have difficulty on any but audio and the lowest-resolution video files.
|
||||
|
||||
WebM VP8/VP9 is slower, but works pretty well at a resolution step below Theora.
|
||||
|
||||
AV1 is slower still, and tops out around 360p for single-threaded decoding on a fast desktop or iOS device.
|
||||
|
||||
*Low-res targets*
|
||||
|
||||
I've gotten acceptable performance for Vorbis audio and 160p/15fps Theora files on 32-bit iOS devices: iPhone 4s, iPod Touch 5th-gen and iPad 3. These have difficulty at 240p and above, and just won't keep up with higher resolutions.
|
||||
|
||||
Meanwhile, newer 64-bit iPhones and iPads are comparable to low-end laptops, and videos at 360p and often 480p play acceptably. Since 32-bit and 64-bit iOS devices have the same user-agent, a benchmark must be used to approximately test minimum CPU speed.
|
||||
|
||||
(On iOS, Safari performs significantly better than some alternative browsers that are unable to enable the JIT due to use of the old UIWebView API. Chrome 49 and Firefox for iOS are known to work using the newer WKWebView API internally. Again, a benchmark must be used to detect slow performance, as the browser remains otherwise compatible.)
|
||||
|
||||
|
||||
Windows on 32-bit ARM platforms is similar... IE 11 on Windows RT 8.1 on a Surface tablet (NVidia Tegra 3) does not work (crashes IE), while Edge on Windows 10 Mobile works ok at low resolutions, having trouble starting around 240p.
|
||||
|
||||
|
||||
In both cases, a native application looms as a possibly better alternative. See [OGVKit](https://github.com/brion/OGVKit) and [OgvRt](https://github.com/brion/OgvRT) projects for experiments in those directions.
|
||||
|
||||
|
||||
Note that at these lower resolutions, Vorbis audio and Theora video decoding are about equally expensive operations -- dual-core phones and tablets should be able to eke out a little parallelism here thanks to audio and video being in separate Worker threads.
|
||||
|
||||
|
||||
*WebGL drawing acceleration*
|
||||
|
||||
Accelerated YCbCr->RGB conversion and drawing is done using WebGL on supporting browsers, or through software CPU conversion if not. This is abstracted in the [yuv-canvas](https://github.com/brion/yuv-canvas) package, now separately installable.
|
||||
|
||||
It may be possible to do further acceleration of actual decoding operations using WebGL shaders, but this could be ... tricky. WebGL is also only available on the main thread, and there are no compute shaders yet so would have to use fragment shaders.
|
||||
|
||||
|
||||
## Difficulties
|
||||
|
||||
*Threading*
|
||||
|
||||
Currently the video and audio codecs run in worker threads by default, while the demuxer and player logic run on the UI thread. This seems to work pretty well.
|
||||
|
||||
There is some overhead in extracting data out of each emscripten module's heap and in the thread-to-thread communications, but the parallelism and smoother main thread makes up for it.
|
||||
|
||||
*Streaming download*
|
||||
|
||||
Streaming buffering is done by chunking the requests at up to a megabyte each, using the HTTP Range header. For cross-site playback, this requires CORS setup to whitelist the Range header! Chunks are downloaded as ArrayBuffers, so a chunk must be loaded in full before demuxing or playback can start.
|
||||
|
||||
Old versions of [Safari have a bug with Range headers](https://bugs.webkit.org/show_bug.cgi?id=82672) which is worked around as necessary with a 'cache-busting' URL string parameter.
|
||||
|
||||
|
||||
*Seeking*
|
||||
|
||||
Seeking is implemented via the HTTP Range: header.
|
||||
|
||||
For Ogg files with keyframe indices in a skeleton index, seeking is very fast. Otherwise, a bisection search is used to locate the target frame or audio position, which is very slow over the internet as it creates a lot of short-lived HTTP requests.
|
||||
|
||||
For WebM files with cues, efficient seeking is supported as well as of 1.1.2. WebM files without cues can be seeked in 1.5.5, but inefficiently via linear seek from the beginning. This is fine for small audio-only files, but might be improved for large files with a bisection in future.
|
||||
|
||||
As with chunked streaming, cross-site playback requires CORS support for the Range header.
|
||||
|
||||
|
||||
*Audio output*
|
||||
|
||||
Audio output is handled through the [AudioFeeder](https://github.com/brion/audio-feeder) library, which encapsulates use of Web Audio API:
|
||||
|
||||
Firefox, Safari, Chrome, and Edge support the W3C Web Audio API.
|
||||
|
||||
IE is no longer supported; the workaround using Flash no longer works due to sunsetting of the Flash plugin.
|
||||
|
||||
A/V synchronization is performed on files with both audio and video, and seems to actually work. Yay!
|
||||
|
||||
Note that autoplay with audio doesn't work on iOS Safari due to limitations with starting audio playback from event handlers; if playback is started outside an event handler, the player will hang due to broken audio.
|
||||
|
||||
As of 1.1.1, muting before script-triggered playback allows things to work:
|
||||
|
||||
```
|
||||
player = new OGVPlayer();
|
||||
player.muted = true;
|
||||
player.src = 'path/to/file-with-audio.ogv';
|
||||
player.play();
|
||||
```
|
||||
|
||||
You can then unmute the video in response to a touch or click handler. Alternately if audio is not required, do not include an audio track in the file.
|
||||
|
||||
|
||||
*WebM*
|
||||
|
||||
WebM support was added in June 2015, with some major issues finally worked out in May 2016. Initial VP9 support was added in February 2017. It's pretty stable in production use at Wikipedia and is enabled by default as of October 2015.
|
||||
|
||||
Beware that performance of WebM VP8 is much slower than Ogg Theora, and VP9 is slightly slower still.
|
||||
|
||||
For best WebM decode speed, consider encoding VP8 with "profile 1" (simple deblocking filter) which will sacrifice quality modestly, mainly in high-motion scenes. When encoding with ffmpeg, this is the `-profile:v 1` option to the `libvpx` codec.
|
||||
|
||||
It is also recommended to use the `-slices` option for VP8, or `-tile-columns` for VP9, to maximize ability to use multithreaded decoding when available in the future.
|
||||
|
||||
*AV1*
|
||||
|
||||
WebM files containing the AV1 codec are supported as of 1.6.0 (February 2019) using the [dav1d](https://code.videolan.org/videolan/dav1d) decoder.
|
||||
|
||||
Currently this is experimental, and does not advertise support via `canPlayType`.
|
||||
|
||||
Performance is about 2-3x slower than VP8 or VP9, and may require bumping down a resolution step or two to maintain frame rate. There may be further optimizations that can be done to improve this a bit, but the best improvements will come from future improvements to WebAssembly multithreading and SIMD.
|
||||
|
||||
Currently AV1 in MP4 container is not supported.
|
||||
|
||||
## Upstream library notes
|
||||
|
||||
We've experimented with tremor (libivorbis), an integer-only variant of libvorbis. This actually does *not* decode faster, but does save about 200kb off our generated JavaScript, presumably thanks to not including an encoder in the library. However on slow devices like iPod Touch 5th-generation, it makes a significant negative impact on the decode time so we've gone back to libvorbis.
|
||||
|
||||
The Ogg Skeleton library (libskeleton) is a bit ... unfinished and is slightly modified here.
|
||||
|
||||
libvpx is slightly modified to work around emscripten threading limitations in the VP8 decoder.
|
||||
|
||||
|
||||
## WebAssembly
|
||||
|
||||
WebAssembly (Wasm) builds are used exclusively as of 1.8.0, as Safari's Wasm support is pretty well established now and IE no longer works due to the Flash plugin deprecation.
|
||||
|
||||
|
||||
## Multithreading
|
||||
|
||||
Experimental multithreaded VP8, VP9, and AV1 decoding up to 4 cores is in development, requiring emscripten 1.38.27 to build.
|
||||
|
||||
Multithreading is used only if `options.threading` is true. This requires browser support for the new `SharedArrayBuffer` and `Atomics` APIs, currently available in Firefox and Chrome with experimental flags enabled.
|
||||
|
||||
Threading currently requires WebAssembly; JavaScript builds are possible but perform poorly.
|
||||
|
||||
Speedups will only be noticeable when using the "slices" or "token partitions" option for VP8 encoding, or the "tile columns" option for VP9 encoding.
|
||||
|
||||
If you are making a slim build and will not use the `threading` option, you can leave out the `*-mt.*` files.
|
||||
|
||||
|
||||
## Building JS components
|
||||
|
||||
Building ogv.js is known to work on Mac OS X and Linux (tested Fedora 29 and Ubuntu 18.10 with Meson manually updated).
|
||||
|
||||
1. You will need autoconf, automake, libtool, pkg-config, meson, ninja, and node (nodejs). These can be installed through Homebrew on Mac OS X, or through distribution-specific methods on Linux. For meson, you may need a newer version than your distro packages -- install it manually with `pip3` or from source.
|
||||
2. Install [Emscripten](http://kripken.github.io/emscripten-site/docs/getting_started/Tutorial.html); currently building with 2.0.13.
|
||||
3. `git submodule update --init`
|
||||
4. Run `npm install` to install build utilities
|
||||
5. Run `make js` to configure and build the libraries and the C wrapper
|
||||
|
||||
|
||||
## Building the demo
|
||||
|
||||
If you did all the setup above, just run `make demo` or `make`. Look in build/demo/ and enjoy!
|
||||
|
||||
|
||||
## License
|
||||
|
||||
libogg, libvorbis, libtheora, libopus, nestegg, libvpx, and dav1d are available under their respective licenses, and the JavaScript and C wrapper code in this repo is licensed under MIT.
|
||||
|
||||
Based on build scripts from https://github.com/devongovett/ogg.js
|
||||
|
||||
See [AUTHORS.md](https://github.com/brion/ogv.js/blob/master/AUTHORS.md) and/or the git history for a list of contributors.
|
39
media/player/videojs/ogvjs/ogv-decoder-audio-opus-wasm.js
Normal file
39
media/player/videojs/ogvjs/ogv-decoder-audio-opus-wasm.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
var OGVDecoderAudioOpusW = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderAudioOpusW) {
|
||||
OGVDecoderAudioOpusW = OGVDecoderAudioOpusW || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderAudioOpusW !== 'undefined' ? OGVDecoderAudioOpusW : {});var g,h;a.ready=new Promise(function(b,c){g=b;h=c});var m=a,n={},p;for(p in a)a.hasOwnProperty(p)&&(n[p]=a[p]);var q="object"===typeof window,r="function"===typeof importScripts,t="",u,v,w,x,y;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=r?require("path").dirname(t)+"/":__dirname+"/",u=function(b,c){x||(x=require("fs"));y||(y=require("path"));b=y.normalize(b);return x.readFileSync(b,c?null:"utf8")},w=function(b){b=u(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||z("Assertion failed: undefined");return b},v=function(b,c,e){x||(x=require("fs"));y||(y=require("path"));b=y.normalize(b);x.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",z),a.inspect=function(){return"[Emscripten Module object]"};else if(q||r)r?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.lastIndexOf("/")+1):t="",u=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(w=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),v=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var A=a.printErr||console.warn.bind(console);for(p in n)n.hasOwnProperty(p)&&(a[p]=n[p]);n=null;var B;a.wasmBinary&&(B=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var C,D=!1,E,F;function G(){var b=C.buffer;E=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=F=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var H,I=[],J=[],K=[];function aa(){var b=a.preRun.shift();I.unshift(b)}var L=0,M=null,N=null;a.preloadedImages={};
|
||||
a.preloadedAudios={};function z(b){if(a.onAbort)a.onAbort(b);A(b);D=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");h(b);throw b;}function O(){return P.startsWith("data:application/octet-stream;base64,")}var P;P="ogv-decoder-audio-opus-wasm.wasm";if(!O()){var Q=P;P=a.locateFile?a.locateFile(Q,t):t+Q}function R(){var b=P;try{if(b==P&&B)return new Uint8Array(B);if(w)return w(b);throw"both async and sync fetching of the wasm failed";}catch(c){z(c)}}
|
||||
function ba(){if(!B&&(q||r)){if("function"===typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+P+"'";return b.arrayBuffer()}).catch(function(){return R()});if(v)return new Promise(function(b,c){v(P,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return R()})}
|
||||
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.s;"number"===typeof e?void 0===c.o?H.get(e)():H.get(e)(c.o):e(void 0===c.o?null:c.o)}}}
|
||||
var ca={a:function(b,c,e){F.copyWithin(b,c,c+e)},b:function(b){var c=F.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{C.grow(Math.min(2147483648,d)-E.byteLength+65535>>>16);G();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(b,c,e){var d=C.buffer,f=new Uint32Array(d,b,c),k=[];if(0!==b)for(b=0;b<c;b++){var l=f[b];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=
|
||||
new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}a.audioBuffer=k},d:function(b,c){a.audioFormat={channels:b,rate:c};a.loadedMetadata=!0}};
|
||||
(function(){function b(f){a.asm=f.exports;C=a.asm.e;G();H=a.asm.m;J.unshift(a.asm.f);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(f=N,N=null,f()))}function c(f){b(f.instance)}function e(f){return ba().then(function(k){return WebAssembly.instantiate(k,d)}).then(f,function(k){A("failed to asynchronously prepare wasm: "+k);z(k)})}var d={a:ca};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return A("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return B||"function"!==typeof WebAssembly.instantiateStreaming||O()||P.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){A("wasm streaming compile failed: "+k);A("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(h);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_audio_decoder_init=function(){return(a._ogv_audio_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_audio_decoder_process_header=function(){return(a._ogv_audio_decoder_process_header=a.asm.h).apply(null,arguments)};a._ogv_audio_decoder_process_audio=function(){return(a._ogv_audio_decoder_process_audio=a.asm.i).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.j).apply(null,arguments)};
|
||||
a._free=function(){return(a._free=a.asm.k).apply(null,arguments)};a._ogv_audio_decoder_destroy=function(){return(a._ogv_audio_decoder_destroy=a.asm.l).apply(null,arguments)};var T;N=function da(){T||U();T||(N=da)};
|
||||
function U(){function b(){if(!T&&(T=!0,a.calledRun=!0,!D)){S(J);g(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();K.unshift(c)}S(K)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();S(I);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=U;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();U();var V,W;function X(b){if(V&&W>=b)return V;V&&a._free(V);W=b;return V=a._malloc(W)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!m.audioFormat;a.audioFormat=m.audioFormat||null;a.audioBuffer=null;a.cpuTime=0;
|
||||
Object.defineProperty(a,"processing",{get:function(){return!1}});a.init=function(b){Z(function(){a._ogv_audio_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength,f=X(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_header(f,d)});c(e)};a.processAudio=function(b,c){var e=Z(function(){var d=b.byteLength,f=X(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_audio(f,d)});c(e)};
|
||||
a.close=function(){};
|
||||
|
||||
|
||||
return OGVDecoderAudioOpusW.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderAudioOpusW;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderAudioOpusW; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderAudioOpusW"] = OGVDecoderAudioOpusW;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-audio-opus-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-audio-opus-wasm.wasm
Normal file
Binary file not shown.
40
media/player/videojs/ogvjs/ogv-decoder-audio-vorbis-wasm.js
Normal file
40
media/player/videojs/ogvjs/ogv-decoder-audio-vorbis-wasm.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
|
||||
var OGVDecoderAudioVorbisW = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderAudioVorbisW) {
|
||||
OGVDecoderAudioVorbisW = OGVDecoderAudioVorbisW || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderAudioVorbisW !== 'undefined' ? OGVDecoderAudioVorbisW : {});var g,h;a.ready=new Promise(function(b,c){g=b;h=c});var m=a,n={},p;for(p in a)a.hasOwnProperty(p)&&(n[p]=a[p]);function q(b,c){throw c;}var r="object"===typeof window,t="function"===typeof importScripts,u="",v,w,x,y,z;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)u=t?require("path").dirname(u)+"/":__dirname+"/",v=function(b,c){y||(y=require("fs"));z||(z=require("path"));b=z.normalize(b);return y.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||A("Assertion failed: undefined");return b},w=function(b,c,e){y||(y=require("fs"));z||(z=require("path"));b=z.normalize(b);y.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",A),q=function(b,c){if(noExitRuntime||0<B)throw process.exitCode=b,c;process.exit(b)},a.inspect=function(){return"[Emscripten Module object]"};else if(r||t)t?u=self.location.href:"undefined"!==typeof document&&document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,u.lastIndexOf("/")+1):u="",v=function(b){var c=new XMLHttpRequest;
|
||||
c.open("GET",b,!1);c.send(null);return c.responseText},t&&(x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var C=a.printErr||console.warn.bind(console);
|
||||
for(p in n)n.hasOwnProperty(p)&&(a[p]=n[p]);n=null;a.quit&&(q=a.quit);var D;a.wasmBinary&&(D=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,F=!1,G,H;function I(){var b=E.buffer;G=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=H=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}
|
||||
var J,K=[],L=[],M=[],B=0;function aa(){var b=a.preRun.shift();K.unshift(b)}var N=0,O=null,P=null;a.preloadedImages={};a.preloadedAudios={};function A(b){if(a.onAbort)a.onAbort(b);C(b);F=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");h(b);throw b;}function Q(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-decoder-audio-vorbis-wasm.wasm";if(!Q()){var S=R;R=a.locateFile?a.locateFile(S,u):u+S}
|
||||
function ba(){var b=R;try{if(b==R&&D)return new Uint8Array(D);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){A(c)}}
|
||||
function ca(){if(!D&&(r||t)){if("function"===typeof fetch&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+R+"'";return b.arrayBuffer()}).catch(function(){return ba()});if(w)return new Promise(function(b,c){w(R,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return ba()})}
|
||||
function T(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.s;"number"===typeof e?void 0===c.o?J.get(e)():J.get(e)(c.o):e(void 0===c.o?null:c.o)}}}
|
||||
var ea={a:function(b,c,e){H.copyWithin(b,c,c+e)},b:function(b){var c=H.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{E.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);I();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(b){if(!(noExitRuntime||0<B)){if(a.onExit)a.onExit(b);F=!0}q(b,new da(b))},d:function(b,c,e){var d=E.buffer,f=new Uint32Array(d,b,c),k=[];if(0!==
|
||||
b)for(b=0;b<c;b++){var l=f[b];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}a.audioBuffer=k},e:function(b,c){a.audioFormat={channels:b,rate:c};a.loadedMetadata=!0}};
|
||||
(function(){function b(f){a.asm=f.exports;E=a.asm.f;I();J=a.asm.n;L.unshift(a.asm.g);N--;a.monitorRunDependencies&&a.monitorRunDependencies(N);0==N&&(null!==O&&(clearInterval(O),O=null),P&&(f=P,P=null,f()))}function c(f){b(f.instance)}function e(f){return ca().then(function(k){return WebAssembly.instantiate(k,d)}).then(f,function(k){C("failed to asynchronously prepare wasm: "+k);A(k)})}var d={a:ea};N++;a.monitorRunDependencies&&a.monitorRunDependencies(N);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return C("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return D||"function"!==typeof WebAssembly.instantiateStreaming||Q()||R.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){C("wasm streaming compile failed: "+k);C("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(h);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.g).apply(null,arguments)};a._ogv_audio_decoder_init=function(){return(a._ogv_audio_decoder_init=a.asm.h).apply(null,arguments)};a._ogv_audio_decoder_process_header=function(){return(a._ogv_audio_decoder_process_header=a.asm.i).apply(null,arguments)};a._ogv_audio_decoder_process_audio=function(){return(a._ogv_audio_decoder_process_audio=a.asm.j).apply(null,arguments)};
|
||||
a._ogv_audio_decoder_destroy=function(){return(a._ogv_audio_decoder_destroy=a.asm.k).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.l).apply(null,arguments)};a._free=function(){return(a._free=a.asm.m).apply(null,arguments)};var U;function da(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}P=function fa(){U||V();U||(P=fa)};
|
||||
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!F)){T(L);g(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();M.unshift(c)}T(M)}}if(!(0<N)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();T(K);0<N||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X;function ha(b){if(W&&X>=b)return W;W&&a._free(W);X=b;return W=a._malloc(X)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!m.audioFormat;a.audioFormat=m.audioFormat||null;a.audioBuffer=null;a.cpuTime=0;
|
||||
Object.defineProperty(a,"processing",{get:function(){return!1}});a.init=function(b){Z(function(){a._ogv_audio_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength,f=ha(d);(new Uint8Array(E.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_header(f,d)});c(e)};a.processAudio=function(b,c){var e=Z(function(){var d=b.byteLength,f=ha(d);(new Uint8Array(E.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_audio(f,d)});c(e)};
|
||||
a.close=function(){};
|
||||
|
||||
|
||||
return OGVDecoderAudioVorbisW.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderAudioVorbisW;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderAudioVorbisW; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderAudioVorbisW"] = OGVDecoderAudioVorbisW;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-audio-vorbis-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-audio-vorbis-wasm.wasm
Normal file
Binary file not shown.
21
media/player/videojs/ogvjs/ogv-decoder-video-av1-mt-wasm.js
Normal file
21
media/player/videojs/ogvjs/ogv-decoder-video-av1-mt-wasm.js
Normal file
File diff suppressed because one or more lines are too long
BIN
media/player/videojs/ogvjs/ogv-decoder-video-av1-mt-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-av1-mt-wasm.wasm
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoAV1MTW(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
44
media/player/videojs/ogvjs/ogv-decoder-video-av1-wasm.js
Normal file
44
media/player/videojs/ogvjs/ogv-decoder-video-av1-wasm.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
var OGVDecoderVideoAV1W = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderVideoAV1W) {
|
||||
OGVDecoderVideoAV1W = OGVDecoderVideoAV1W || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderVideoAV1W !== 'undefined' ? OGVDecoderVideoAV1W : {});var aa,ba;a.ready=new Promise(function(b,c){aa=b;ba=c});var ca=a,q={},r;for(r in a)a.hasOwnProperty(r)&&(q[r]=a[r]);var da="object"===typeof window,y="function"===typeof importScripts,D="",ea,H,I,J,K;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)D=y?require("path").dirname(D)+"/":__dirname+"/",ea=function(b,c){J||(J=require("fs"));K||(K=require("path"));b=K.normalize(b);return J.readFileSync(b,c?null:"utf8")},I=function(b){b=ea(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||L("Assertion failed: undefined");return b},H=function(b,c,e){J||(J=require("fs"));K||(K=require("path"));b=K.normalize(b);J.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",L),a.inspect=function(){return"[Emscripten Module object]"};else if(da||y)y?D=self.location.href:"undefined"!==typeof document&&document.currentScript&&(D=document.currentScript.src),_scriptDir&&(D=_scriptDir),0!==D.indexOf("blob:")?D=D.substr(0,D.lastIndexOf("/")+1):D="",ea=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},y&&(I=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),H=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};var fa=a.print||console.log.bind(console),M=a.printErr||console.warn.bind(console);for(r in q)q.hasOwnProperty(r)&&(a[r]=q[r]);q=null;var N;a.wasmBinary&&(N=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&L("no native wasm support detected");var O,ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,ka,P,S;function la(){var b=O.buffer;ka=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=S=new Int32Array(b);a.HEAPU8=P=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var ma,na=[],oa=[],pa=[];
|
||||
function qa(){var b=a.preRun.shift();na.unshift(b)}var T=0,ra=null,U=null;a.preloadedImages={};a.preloadedAudios={};function L(b){if(a.onAbort)a.onAbort(b);M(b);ia=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");ba(b);throw b;}function sa(){return V.startsWith("data:application/octet-stream;base64,")}var V;V="ogv-decoder-video-av1-wasm.wasm";if(!sa()){var ta=V;V=a.locateFile?a.locateFile(ta,D):D+ta}
|
||||
function ua(){var b=V;try{if(b==V&&N)return new Uint8Array(N);if(I)return I(b);throw"both async and sync fetching of the wasm failed";}catch(c){L(c)}}
|
||||
function va(){if(!N&&(da||y)){if("function"===typeof fetch&&!V.startsWith("file://"))return fetch(V,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+V+"'";return b.arrayBuffer()}).catch(function(){return ua()});if(H)return new Promise(function(b,c){H(V,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return ua()})}
|
||||
function wa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.B;"number"===typeof e?void 0===c.s?ma.get(e)():ma.get(e)(c.s):e(void 0===c.s?null:c.s)}}}
|
||||
var Ha=[null,[],[]],Ja={f:function(){L()},c:function(b,c,e){P.copyWithin(b,c,c+e)},d:function(b){var c=P.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{O.grow(Math.min(2147483648,d)-ka.byteLength+65535>>>16);la();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},e:function(){return 0},b:function(){},a:function(b,c,e,d){for(var f=0,g=0;g<e;g++){for(var z=S[c+8*g>>2],u=S[c+(8*g+4)>>
|
||||
2],A=0;A<u;A++){var n=P[z+A],x=Ha[b];if(0===n||10===n){n=1===b?fa:M;var l=x;for(var p=0,t=p+NaN,w=p;l[w]&&!(w>=t);)++w;if(16<w-p&&l.subarray&&ja)l=ja.decode(l.subarray(p,w));else{for(t="";p<w;){var h=l[p++];if(h&128){var E=l[p++]&63;if(192==(h&224))t+=String.fromCharCode((h&31)<<6|E);else{var Q=l[p++]&63;h=224==(h&240)?(h&15)<<12|E<<6|Q:(h&7)<<18|E<<12|Q<<6|l[p++]&63;65536>h?t+=String.fromCharCode(h):(h-=65536,t+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else t+=String.fromCharCode(h)}l=t}n(l);
|
||||
x.length=0}else x.push(n)}f+=u}S[d>>2]=f;return 0},g:function(b,c,e,d,f,g,z,u,A,n,x,l,p,t,w,h){function E(F,v,B,ha,xa,ya,La,Ma,X){if(Ia){var k=new Float64Array(F.buffer);v=new Float64Array(Q,v,B*ha>>3);k.set(v)}else F.set(new Uint8Array(Q,v,B*ha));var C;for(v=C=0;v<ya;v++,C+=B)for(k=0;k<B;k++)F[C+k]=X;for(;v<ya+Ma;v++,C+=B){for(k=0;k<xa;k++)F[C+k]=X;for(k=xa+La;k<B;k++)F[C+k]=X}for(;v<ha;v++,C+=B)for(k=0;k<B;k++)F[C+k]=X;return F}var Q=O.buffer,m=a.videoFormat,za=(p&-2)*A/z,Aa=(t&-2)*n/u,Ba=x*A/z,
|
||||
Ca=l*n/u;x===m.cropWidth&&l===m.cropHeight&&(w=m.displayWidth,h=m.displayHeight);for(var Da=a.recycledFrames,G,Ea=u*c,Fa=n*d,Ga=n*g;0<Da.length;){var R=Da.shift();m=R.format;if(m.width===z&&m.height===u&&m.chromaWidth===A&&m.chromaHeight===n&&m.cropLeft===p&&m.cropTop===t&&m.cropWidth===x&&m.cropHeight===l&&m.displayWidth===w&&m.displayHeight===h&&R.y.bytes.length===Ea&&R.u.bytes.length===Fa&&R.v.bytes.length===Ga){G=R;break}}G||(G={format:{width:z,height:u,chromaWidth:A,chromaHeight:n,cropLeft:p,
|
||||
cropTop:t,cropWidth:x,cropHeight:l,displayWidth:w,displayHeight:h},y:{bytes:new Uint8Array(Ea),stride:c},u:{bytes:new Uint8Array(Fa),stride:d},v:{bytes:new Uint8Array(Ga),stride:g}});E(G.y.bytes,b,c,u,p,t,x,l,0);E(G.u.bytes,e,d,n,za,Aa,Ba,Ca,128);E(G.v.bytes,f,g,n,za,Aa,Ba,Ca,128);a.frameBuffer=G}};
|
||||
(function(){function b(f){a.asm=f.exports;O=a.asm.h;la();ma=a.asm.p;oa.unshift(a.asm.i);T--;a.monitorRunDependencies&&a.monitorRunDependencies(T);0==T&&(null!==ra&&(clearInterval(ra),ra=null),U&&(f=U,U=null,f()))}function c(f){b(f.instance)}function e(f){return va().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){M("failed to asynchronously prepare wasm: "+g);L(g)})}var d={a:Ja};T++;a.monitorRunDependencies&&a.monitorRunDependencies(T);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return M("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return N||"function"!==typeof WebAssembly.instantiateStreaming||sa()||V.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(V,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){M("wasm streaming compile failed: "+g);M("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(ba);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.i).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.k).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.l).apply(null,arguments)};
|
||||
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.n).apply(null,arguments)};a._free=function(){return(a._free=a.asm.o).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.q).apply(null,arguments)};var W;U=function Ka(){W||Na();W||(U=Ka)};
|
||||
function Na(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ia)){wa(oa);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();pa.unshift(c)}wa(pa)}}if(!(0<T)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)qa();wa(na);0<T||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Na;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Na();var Y,Oa,Z;"undefined"===typeof performance||"undefined"===typeof performance.now?Z=Date.now:Z=performance.now.bind(performance);function Pa(b){var c=Z();b=b();a.cpuTime+=Z()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
a.init=function(b){Pa(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Pa(function(){var d=b.byteLength;Y&&Oa>=d||(Y&&a._free(Y),Oa=d,Y=a._malloc(Oa));var f=Y;(new Uint8Array(O.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.A=[];
|
||||
a.processFrame=function(b,c){function e(u){a._free(g);c(u)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.A.push(e);var z=Pa(function(){(new Uint8Array(O.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(z)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.A.push(function(){}),Pa(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
|
||||
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};var Ia="object"===typeof navigator&&navigator.userAgent.match(/Trident/);
|
||||
|
||||
|
||||
return OGVDecoderVideoAV1W.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderVideoAV1W;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderVideoAV1W; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderVideoAV1W"] = OGVDecoderVideoAV1W;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-video-av1-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-av1-wasm.wasm
Normal file
Binary file not shown.
43
media/player/videojs/ogvjs/ogv-decoder-video-theora-wasm.js
Normal file
43
media/player/videojs/ogvjs/ogv-decoder-video-theora-wasm.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
|
||||
var OGVDecoderVideoTheoraW = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderVideoTheoraW) {
|
||||
OGVDecoderVideoTheoraW = OGVDecoderVideoTheoraW || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderVideoTheoraW !== 'undefined' ? OGVDecoderVideoTheoraW : {});var aa,l;a.ready=new Promise(function(b,c){aa=b;l=c});var fa=a,m={},r;for(r in a)a.hasOwnProperty(r)&&(m[r]=a[r]);var ha="object"===typeof window,w="function"===typeof importScripts,A="",B,C,E,F,G;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)A=w?require("path").dirname(A)+"/":__dirname+"/",B=function(b,c){F||(F=require("fs"));G||(G=require("path"));b=G.normalize(b);return F.readFileSync(b,c?null:"utf8")},E=function(b){b=B(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||H("Assertion failed: undefined");return b},C=function(b,c,e){F||(F=require("fs"));G||(G=require("path"));b=G.normalize(b);F.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",H),a.inspect=function(){return"[Emscripten Module object]"};else if(ha||w)w?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.lastIndexOf("/")+1):A="",B=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},w&&(E=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),C=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var I=a.printErr||console.warn.bind(console);for(r in m)m.hasOwnProperty(r)&&(a[r]=m[r]);m=null;var J;a.wasmBinary&&(J=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&H("no native wasm support detected");var M,ia=!1,ja,N;function ka(){var b=M.buffer;ja=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=N=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var O,la=[],ma=[],na=[];function oa(){var b=a.preRun.shift();la.unshift(b)}var S=0,T=null,U=null;a.preloadedImages={};
|
||||
a.preloadedAudios={};function H(b){if(a.onAbort)a.onAbort(b);I(b);ia=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function pa(){return V.startsWith("data:application/octet-stream;base64,")}var V;V="ogv-decoder-video-theora-wasm.wasm";if(!pa()){var qa=V;V=a.locateFile?a.locateFile(qa,A):A+qa}
|
||||
function ra(){var b=V;try{if(b==V&&J)return new Uint8Array(J);if(E)return E(b);throw"both async and sync fetching of the wasm failed";}catch(c){H(c)}}
|
||||
function sa(){if(!J&&(ha||w)){if("function"===typeof fetch&&!V.startsWith("file://"))return fetch(V,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+V+"'";return b.arrayBuffer()}).catch(function(){return ra()});if(C)return new Promise(function(b,c){C(V,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return ra()})}
|
||||
function ta(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.A;"number"===typeof e?void 0===c.o?O.get(e)():O.get(e)(c.o):e(void 0===c.o?null:c.o)}}}
|
||||
var Ga={a:function(b,c,e){N.copyWithin(b,c,c+e)},b:function(b){var c=N.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{M.grow(Math.min(2147483648,d)-ja.byteLength+65535>>>16);ka();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},c:function(b,c,e,d,f,g,t,p,D,q,x,K,P,Q,ba,ca){function da(y,n,u,ea,ua,va,Ha,Ia,R){if(Fa){var h=new Float64Array(y.buffer);n=new Float64Array(wa,n,u*ea>>
|
||||
3);h.set(n)}else y.set(new Uint8Array(wa,n,u*ea));var v;for(n=v=0;n<va;n++,v+=u)for(h=0;h<u;h++)y[v+h]=R;for(;n<va+Ia;n++,v+=u){for(h=0;h<ua;h++)y[v+h]=R;for(h=ua+Ha;h<u;h++)y[v+h]=R}for(;n<ea;n++,v+=u)for(h=0;h<u;h++)y[v+h]=R;return y}var wa=M.buffer,k=a.videoFormat,xa=(P&-2)*D/t,ya=(Q&-2)*q/p,za=x*D/t,Aa=K*q/p;x===k.cropWidth&&K===k.cropHeight&&(ba=k.displayWidth,ca=k.displayHeight);for(var Ba=a.recycledFrames,z,Ca=p*c,Da=q*d,Ea=q*g;0<Ba.length;){var L=Ba.shift();k=L.format;if(k.width===t&&k.height===
|
||||
p&&k.chromaWidth===D&&k.chromaHeight===q&&k.cropLeft===P&&k.cropTop===Q&&k.cropWidth===x&&k.cropHeight===K&&k.displayWidth===ba&&k.displayHeight===ca&&L.y.bytes.length===Ca&&L.u.bytes.length===Da&&L.v.bytes.length===Ea){z=L;break}}z||(z={format:{width:t,height:p,chromaWidth:D,chromaHeight:q,cropLeft:P,cropTop:Q,cropWidth:x,cropHeight:K,displayWidth:ba,displayHeight:ca},y:{bytes:new Uint8Array(Ca),stride:c},u:{bytes:new Uint8Array(Da),stride:d},v:{bytes:new Uint8Array(Ea),stride:g}});da(z.y.bytes,
|
||||
b,c,p,P,Q,x,K,0);da(z.u.bytes,e,d,q,xa,ya,za,Aa,128);da(z.v.bytes,f,g,q,xa,ya,za,Aa,128);a.frameBuffer=z},d:function(b,c,e,d,f,g,t,p,D,q,x){a.videoFormat={width:b,height:c,chromaWidth:e,chromaHeight:d,cropLeft:p,cropTop:D,cropWidth:g,cropHeight:t,displayWidth:q,displayHeight:x,fps:f};a.loadedMetadata=!0}};
|
||||
(function(){function b(f){a.asm=f.exports;M=a.asm.e;ka();O=a.asm.n;ma.unshift(a.asm.f);S--;a.monitorRunDependencies&&a.monitorRunDependencies(S);0==S&&(null!==T&&(clearInterval(T),T=null),U&&(f=U,U=null,f()))}function c(f){b(f.instance)}function e(f){return sa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){I("failed to asynchronously prepare wasm: "+g);H(g)})}var d={a:Ga};S++;a.monitorRunDependencies&&a.monitorRunDependencies(S);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return I("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return J||"function"!==typeof WebAssembly.instantiateStreaming||pa()||V.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(V,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){I("wasm streaming compile failed: "+g);I("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(l);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.h).apply(null,arguments)};a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.i).apply(null,arguments)};
|
||||
a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.k).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.l).apply(null,arguments)};a._free=function(){return(a._free=a.asm.m).apply(null,arguments)};var W;U=function Ja(){W||Ka();W||(U=Ja)};
|
||||
function Ka(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ia)){ta(ma);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();na.unshift(c)}ta(na)}}if(!(0<S)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)oa();ta(la);0<S||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Ka;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Ka();var X,La,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!fa.videoFormat;a.videoFormat=fa.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&La>=d||(X&&a._free(X),La=d,X=a._malloc(La));var f=X;(new Uint8Array(M.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.s=[];
|
||||
a.processFrame=function(b,c){function e(p){a._free(g);c(p)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.s.push(e);var t=Z(function(){(new Uint8Array(M.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(t)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.s.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
|
||||
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};var Fa="object"===typeof navigator&&navigator.userAgent.match(/Trident/);
|
||||
|
||||
|
||||
return OGVDecoderVideoTheoraW.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderVideoTheoraW;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderVideoTheoraW; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderVideoTheoraW"] = OGVDecoderVideoTheoraW;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-video-theora-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-theora-wasm.wasm
Normal file
Binary file not shown.
21
media/player/videojs/ogvjs/ogv-decoder-video-vp8-mt-wasm.js
Normal file
21
media/player/videojs/ogvjs/ogv-decoder-video-vp8-mt-wasm.js
Normal file
File diff suppressed because one or more lines are too long
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp8-mt-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp8-mt-wasm.wasm
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP8MTW(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
45
media/player/videojs/ogvjs/ogv-decoder-video-vp8-wasm.js
Normal file
45
media/player/videojs/ogvjs/ogv-decoder-video-vp8-wasm.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
var OGVDecoderVideoVP8W = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderVideoVP8W) {
|
||||
OGVDecoderVideoVP8W = OGVDecoderVideoVP8W || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderVideoVP8W !== 'undefined' ? OGVDecoderVideoVP8W : {});var aa,n;a.ready=new Promise(function(b,c){aa=b;n=c});var ba=a,p={},r;for(r in a)a.hasOwnProperty(r)&&(p[r]=a[r]);var ca="object"===typeof window,w="function"===typeof importScripts,x="",da,A,B,C,D;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)x=w?require("path").dirname(x)+"/":__dirname+"/",da=function(b,c){C||(C=require("fs"));D||(D=require("path"));b=D.normalize(b);return C.readFileSync(b,c?null:"utf8")},B=function(b){b=da(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||E("Assertion failed: undefined");return b},A=function(b,c,e){C||(C=require("fs"));D||(D=require("path"));b=D.normalize(b);C.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",E),a.inspect=function(){return"[Emscripten Module object]"};else if(ca||w)w?x=self.location.href:"undefined"!==typeof document&&document.currentScript&&(x=document.currentScript.src),_scriptDir&&(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",da=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},w&&(B=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),A=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);for(r in p)p.hasOwnProperty(r)&&(a[r]=p[r]);p=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&E("no native wasm support detected");var H,ka=!1,la,ma;function na(){var b=H.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var I,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var J=0,sa=null,K=null;
|
||||
a.preloadedImages={};a.preloadedAudios={};function E(b){if(a.onAbort)a.onAbort(b);F(b);ka=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ta(){return L.startsWith("data:application/octet-stream;base64,")}var L;L="ogv-decoder-video-vp8-wasm.wasm";if(!ta()){var ua=L;L=a.locateFile?a.locateFile(ua,x):x+ua}
|
||||
function va(){var b=L;try{if(b==L&&G)return new Uint8Array(G);if(B)return B(b);throw"both async and sync fetching of the wasm failed";}catch(c){E(c)}}
|
||||
function wa(){if(!G&&(ca||w)){if("function"===typeof fetch&&!L.startsWith("file://"))return fetch(L,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+L+"'";return b.arrayBuffer()}).catch(function(){return va()});if(A)return new Promise(function(b,c){A(L,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
|
||||
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.C;"number"===typeof e?void 0===c.A?I.get(e)():I.get(e)(c.A):e(void 0===c.A?null:c.A)}}}
|
||||
var Pa={g:function(){throw"longjmp";},e:function(b,c,e){ma.copyWithin(b,c,c+e)},f:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{H.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ja,i:Ka,j:La,h:Ma,c:Na,k:function(b,c,e,d,f,g,l,m,S,t,M,N,T,U,ea,fa){function ha(y,q,u,ia,ya,za,
|
||||
Ra,Sa,V){if(Oa){var h=new Float64Array(y.buffer);q=new Float64Array(Aa,q,u*ia>>3);h.set(q)}else y.set(new Uint8Array(Aa,q,u*ia));var v;for(q=v=0;q<za;q++,v+=u)for(h=0;h<u;h++)y[v+h]=V;for(;q<za+Sa;q++,v+=u){for(h=0;h<ya;h++)y[v+h]=V;for(h=ya+Ra;h<u;h++)y[v+h]=V}for(;q<ia;q++,v+=u)for(h=0;h<u;h++)y[v+h]=V;return y}var Aa=H.buffer,k=a.videoFormat,Ba=(T&-2)*S/l,Ca=(U&-2)*t/m,Da=M*S/l,Ea=N*t/m;M===k.cropWidth&&N===k.cropHeight&&(ea=k.displayWidth,fa=k.displayHeight);for(var Fa=a.recycledFrames,z,Ga=m*
|
||||
c,Ha=t*d,Ia=t*g;0<Fa.length;){var O=Fa.shift();k=O.format;if(k.width===l&&k.height===m&&k.chromaWidth===S&&k.chromaHeight===t&&k.cropLeft===T&&k.cropTop===U&&k.cropWidth===M&&k.cropHeight===N&&k.displayWidth===ea&&k.displayHeight===fa&&O.y.bytes.length===Ga&&O.u.bytes.length===Ha&&O.v.bytes.length===Ia){z=O;break}}z||(z={format:{width:l,height:m,chromaWidth:S,chromaHeight:t,cropLeft:T,cropTop:U,cropWidth:M,cropHeight:N,displayWidth:ea,displayHeight:fa},y:{bytes:new Uint8Array(Ga),stride:c},u:{bytes:new Uint8Array(Ha),
|
||||
stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});ha(z.y.bytes,b,c,m,T,U,M,N,0);ha(z.u.bytes,e,d,t,Ba,Ca,Da,Ea,128);ha(z.v.bytes,f,g,t,Ba,Ca,Da,Ea,128);a.frameBuffer=z},b:function(b){ja=b}};
|
||||
(function(){function b(f){a.asm=f.exports;H=a.asm.l;na();I=a.asm.s;pa.unshift(a.asm.m);J--;a.monitorRunDependencies&&a.monitorRunDependencies(J);0==J&&(null!==sa&&(clearInterval(sa),sa=null),K&&(f=K,K=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);E(g)})}var d={a:Pa};J++;a.monitorRunDependencies&&a.monitorRunDependencies(J);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ta()||L.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(L,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.n).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.o).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.p).apply(null,arguments)};
|
||||
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};
|
||||
var P=a.stackSave=function(){return(P=a.stackSave=a.asm.v).apply(null,arguments)},Q=a.stackRestore=function(){return(Q=a.stackRestore=a.asm.w).apply(null,arguments)},R=a._setThrew=function(){return(R=a._setThrew=a.asm.x).apply(null,arguments)},Qa=a.dynCall_iiiij=function(){return(Qa=a.dynCall_iiiij=a.asm.y).apply(null,arguments)};function Na(b,c,e,d,f){var g=P();try{I.get(b)(c,e,d,f)}catch(l){Q(g);if(l!==l+0&&"longjmp"!==l)throw l;R(1,0)}}
|
||||
function Ja(b,c,e){var d=P();try{return I.get(b)(c,e)}catch(f){Q(d);if(f!==f+0&&"longjmp"!==f)throw f;R(1,0)}}function Ka(b,c,e,d){var f=P();try{return I.get(b)(c,e,d)}catch(g){Q(f);if(g!==g+0&&"longjmp"!==g)throw g;R(1,0)}}function Ma(b,c){var e=P();try{I.get(b)(c)}catch(d){Q(e);if(d!==d+0&&"longjmp"!==d)throw d;R(1,0)}}function La(b,c,e,d,f,g){var l=P();try{return Qa(b,c,e,d,f,g)}catch(m){Q(l);if(m!==m+0&&"longjmp"!==m)throw m;R(1,0)}}var W;K=function Ta(){W||Ua();W||(K=Ta)};
|
||||
function Ua(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){xa(pa);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<J)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<J||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Ua;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Ua();var X,Va,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ba.videoFormat;a.videoFormat=ba.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Va>=d||(X&&a._free(X),Va=d,X=a._malloc(Va));var f=X;(new Uint8Array(H.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.B=[];
|
||||
a.processFrame=function(b,c){function e(m){a._free(g);c(m)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.B.push(e);var l=Z(function(){(new Uint8Array(H.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(l)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.B.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
|
||||
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};var Oa="object"===typeof navigator&&navigator.userAgent.match(/Trident/);
|
||||
|
||||
|
||||
return OGVDecoderVideoVP8W.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderVideoVP8W;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderVideoVP8W; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderVideoVP8W"] = OGVDecoderVideoVP8W;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp8-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp8-wasm.wasm
Normal file
Binary file not shown.
21
media/player/videojs/ogvjs/ogv-decoder-video-vp9-mt-wasm.js
Normal file
21
media/player/videojs/ogvjs/ogv-decoder-video-vp9-mt-wasm.js
Normal file
File diff suppressed because one or more lines are too long
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp9-mt-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp9-mt-wasm.wasm
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP9MTW(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
46
media/player/videojs/ogvjs/ogv-decoder-video-vp9-wasm.js
Normal file
46
media/player/videojs/ogvjs/ogv-decoder-video-vp9-wasm.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
var OGVDecoderVideoVP9W = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDecoderVideoVP9W) {
|
||||
OGVDecoderVideoVP9W = OGVDecoderVideoVP9W || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDecoderVideoVP9W !== 'undefined' ? OGVDecoderVideoVP9W : {});var aa,n;a.ready=new Promise(function(b,c){aa=b;n=c});var ba=a,p={},q;for(q in a)a.hasOwnProperty(q)&&(p[q]=a[q]);var ca="object"===typeof window,w="function"===typeof importScripts,x="",da,y,z,C,F;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)x=w?require("path").dirname(x)+"/":__dirname+"/",da=function(b,c){C||(C=require("fs"));F||(F=require("path"));b=F.normalize(b);return C.readFileSync(b,c?null:"utf8")},z=function(b){b=da(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||G("Assertion failed: undefined");return b},y=function(b,c,e){C||(C=require("fs"));F||(F=require("path"));b=F.normalize(b);C.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",G),a.inspect=function(){return"[Emscripten Module object]"};else if(ca||w)w?x=self.location.href:"undefined"!==typeof document&&document.currentScript&&(x=document.currentScript.src),_scriptDir&&(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",da=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},w&&(z=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),y=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var H=a.printErr||console.warn.bind(console);for(q in p)p.hasOwnProperty(q)&&(a[q]=p[q]);p=null;var ja=0,I;a.wasmBinary&&(I=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&G("no native wasm support detected");var J,ka=!1,la,ma;function na(){var b=J.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var K,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var L=0,sa=null,M=null;
|
||||
a.preloadedImages={};a.preloadedAudios={};function G(b){if(a.onAbort)a.onAbort(b);H(b);ka=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ta(){return N.startsWith("data:application/octet-stream;base64,")}var N;N="ogv-decoder-video-vp9-wasm.wasm";if(!ta()){var ua=N;N=a.locateFile?a.locateFile(ua,x):x+ua}
|
||||
function va(){var b=N;try{if(b==N&&I)return new Uint8Array(I);if(z)return z(b);throw"both async and sync fetching of the wasm failed";}catch(c){G(c)}}
|
||||
function wa(){if(!I&&(ca||w)){if("function"===typeof fetch&&!N.startsWith("file://"))return fetch(N,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+N+"'";return b.arrayBuffer()}).catch(function(){return va()});if(y)return new Promise(function(b,c){y(N,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
|
||||
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.D;"number"===typeof e?void 0===c.B?K.get(e)():K.get(e)(c.B):e(void 0===c.B?null:c.B)}}}
|
||||
var Sa={m:function(){throw"longjmp";},k:function(b,c,e){ma.copyWithin(b,c,c+e)},l:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{J.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ja,f:Ka,i:La,g:Ma,e:Na,c:Oa,j:Pa,h:Qa,n:function(b,c,e,d,f,g,h,k,r,u,v,O,T,U,ea,fa){function ha(D,
|
||||
t,A,ia,ya,za,Ta,Ua,V){if(Ra){var l=new Float64Array(D.buffer);t=new Float64Array(Aa,t,A*ia>>3);l.set(t)}else D.set(new Uint8Array(Aa,t,A*ia));var B;for(t=B=0;t<za;t++,B+=A)for(l=0;l<A;l++)D[B+l]=V;for(;t<za+Ua;t++,B+=A){for(l=0;l<ya;l++)D[B+l]=V;for(l=ya+Ta;l<A;l++)D[B+l]=V}for(;t<ia;t++,B+=A)for(l=0;l<A;l++)D[B+l]=V;return D}var Aa=J.buffer,m=a.videoFormat,Ba=(T&-2)*r/h,Ca=(U&-2)*u/k,Da=v*r/h,Ea=O*u/k;v===m.cropWidth&&O===m.cropHeight&&(ea=m.displayWidth,fa=m.displayHeight);for(var Fa=a.recycledFrames,
|
||||
E,Ga=k*c,Ha=u*d,Ia=u*g;0<Fa.length;){var P=Fa.shift();m=P.format;if(m.width===h&&m.height===k&&m.chromaWidth===r&&m.chromaHeight===u&&m.cropLeft===T&&m.cropTop===U&&m.cropWidth===v&&m.cropHeight===O&&m.displayWidth===ea&&m.displayHeight===fa&&P.y.bytes.length===Ga&&P.u.bytes.length===Ha&&P.v.bytes.length===Ia){E=P;break}}E||(E={format:{width:h,height:k,chromaWidth:r,chromaHeight:u,cropLeft:T,cropTop:U,cropWidth:v,cropHeight:O,displayWidth:ea,displayHeight:fa},y:{bytes:new Uint8Array(Ga),stride:c},
|
||||
u:{bytes:new Uint8Array(Ha),stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});ha(E.y.bytes,b,c,k,T,U,v,O,0);ha(E.u.bytes,e,d,u,Ba,Ca,Da,Ea,128);ha(E.v.bytes,f,g,u,Ba,Ca,Da,Ea,128);a.frameBuffer=E},b:function(b){ja=b}};
|
||||
(function(){function b(f){a.asm=f.exports;J=a.asm.o;na();K=a.asm.v;pa.unshift(a.asm.p);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==sa&&(clearInterval(sa),sa=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){H("failed to asynchronously prepare wasm: "+g);G(g)})}var d={a:Sa};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||||
b)}catch(f){return H("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return I||"function"!==typeof WebAssembly.instantiateStreaming||ta()||N.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){H("wasm streaming compile failed: "+g);H("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.p).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.r).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.s).apply(null,arguments)};
|
||||
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.t).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.u).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.w).apply(null,arguments)};a._free=function(){return(a._free=a.asm.x).apply(null,arguments)};
|
||||
var Q=a.stackSave=function(){return(Q=a.stackSave=a.asm.y).apply(null,arguments)},R=a.stackRestore=function(){return(R=a.stackRestore=a.asm.z).apply(null,arguments)},S=a._setThrew=function(){return(S=a._setThrew=a.asm.A).apply(null,arguments)};function La(b,c,e,d,f){var g=Q();try{return K.get(b)(c,e,d,f)}catch(h){R(g);if(h!==h+0&&"longjmp"!==h)throw h;S(1,0)}}function Oa(b,c,e,d,f){var g=Q();try{K.get(b)(c,e,d,f)}catch(h){R(g);if(h!==h+0&&"longjmp"!==h)throw h;S(1,0)}}
|
||||
function Qa(b,c,e,d,f,g,h,k,r){var u=Q();try{K.get(b)(c,e,d,f,g,h,k,r)}catch(v){R(u);if(v!==v+0&&"longjmp"!==v)throw v;S(1,0)}}function Ma(b,c,e,d,f,g){var h=Q();try{return K.get(b)(c,e,d,f,g)}catch(k){R(h);if(k!==k+0&&"longjmp"!==k)throw k;S(1,0)}}function Ka(b,c,e,d){var f=Q();try{return K.get(b)(c,e,d)}catch(g){R(f);if(g!==g+0&&"longjmp"!==g)throw g;S(1,0)}}function Pa(b,c,e,d,f,g,h){var k=Q();try{K.get(b)(c,e,d,f,g,h)}catch(r){R(k);if(r!==r+0&&"longjmp"!==r)throw r;S(1,0)}}
|
||||
function Ja(b,c,e){var d=Q();try{return K.get(b)(c,e)}catch(f){R(d);if(f!==f+0&&"longjmp"!==f)throw f;S(1,0)}}function Na(b,c){var e=Q();try{K.get(b)(c)}catch(d){R(e);if(d!==d+0&&"longjmp"!==d)throw d;S(1,0)}}var W;M=function Va(){W||Wa();W||(M=Va)};
|
||||
function Wa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){xa(pa);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Wa;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Wa();var X,Xa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ba.videoFormat;a.videoFormat=ba.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Xa>=d||(X&&a._free(X),Xa=d,X=a._malloc(Xa));var f=X;(new Uint8Array(J.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.C=[];
|
||||
a.processFrame=function(b,c){function e(k){a._free(g);c(k)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.C.push(e);var h=Z(function(){(new Uint8Array(J.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(h)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.C.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
|
||||
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};var Ra="object"===typeof navigator&&navigator.userAgent.match(/Trident/);
|
||||
|
||||
|
||||
return OGVDecoderVideoVP9W.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDecoderVideoVP9W;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDecoderVideoVP9W; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDecoderVideoVP9W"] = OGVDecoderVideoVP9W;
|
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp9-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-decoder-video-vp9-wasm.wasm
Normal file
Binary file not shown.
44
media/player/videojs/ogvjs/ogv-demuxer-ogg-wasm.js
Normal file
44
media/player/videojs/ogvjs/ogv-demuxer-ogg-wasm.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
var OGVDemuxerOggW = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDemuxerOggW) {
|
||||
OGVDemuxerOggW = OGVDemuxerOggW || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDemuxerOggW !== 'undefined' ? OGVDemuxerOggW : {});var h,k;a.ready=new Promise(function(b,c){h=b;k=c});var l={},m;for(m in a)a.hasOwnProperty(m)&&(l[m]=a[m]);var n="object"===typeof window,p="function"===typeof importScripts,q="",r,t,u,v,w;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)q=p?require("path").dirname(q)+"/":__dirname+"/",r=function(b,c){v||(v=require("fs"));w||(w=require("path"));b=w.normalize(b);return v.readFileSync(b,c?null:"utf8")},u=function(b){b=r(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||x("Assertion failed: undefined");return b},t=function(b,c,d){v||(v=require("fs"));w||(w=require("path"));b=w.normalize(b);v.readFile(b,function(e,f){e?d(e):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",x),a.inspect=function(){return"[Emscripten Module object]"};else if(n||p)p?q=self.location.href:"undefined"!==typeof document&&document.currentScript&&(q=document.currentScript.src),_scriptDir&&(q=_scriptDir),0!==q.indexOf("blob:")?q=q.substr(0,q.lastIndexOf("/")+1):q="",r=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(u=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),t=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};a.print||console.log.bind(console);var y=a.printErr||console.warn.bind(console);for(m in l)l.hasOwnProperty(m)&&(a[m]=l[m]);l=null;var z;a.wasmBinary&&(z=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&x("no native wasm support detected");var A,B=!1;"undefined"!==typeof TextDecoder&&new TextDecoder("utf8");var C,D,E;function F(){var b=A.buffer;C=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=E=new Int32Array(b);a.HEAPU8=D=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var G,H=[],I=[],J=[];
|
||||
function K(){var b=a.preRun.shift();H.unshift(b)}var L=0,M=null,N=null;a.preloadedImages={};a.preloadedAudios={};function x(b){if(a.onAbort)a.onAbort(b);y(b);B=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");k(b);throw b;}function O(){return P.startsWith("data:application/octet-stream;base64,")}var P;P="ogv-demuxer-ogg-wasm.wasm";if(!O()){var Q=P;P=a.locateFile?a.locateFile(Q,q):q+Q}
|
||||
function R(){var b=P;try{if(b==P&&z)return new Uint8Array(z);if(u)return u(b);throw"both async and sync fetching of the wasm failed";}catch(c){x(c)}}
|
||||
function aa(){if(!z&&(n||p)){if("function"===typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+P+"'";return b.arrayBuffer()}).catch(function(){return R()});if(t)return new Promise(function(b,c){t(P,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return R()})}
|
||||
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.v?G.get(d)():G.get(d)(c.v):d(void 0===c.v?null:c.v)}}}
|
||||
var T={},ba={d:function(b,c,d){D.copyWithin(b,c,c+d)},e:function(b){var c=D.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{A.grow(Math.min(2147483648,e)-C.byteLength+65535>>>16);F();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(b,c,d,e){b=T.C(b);c=T.A(b,c,d);E[e>>2]=c;return 0},a:function(b,c,d,e){var f=A.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):(new Uint8Array(new Uint8Array(f,
|
||||
b,c))).buffer,timestamp:d,discardPadding:e})},c:function(b,c){function d(e){for(var f="",g=new Uint8Array(A.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},b:function(b,c,d,e,f){var g=A.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
|
||||
(function(){function b(f){a.asm=f.exports;A=a.asm.g;F();G=a.asm.s;I.unshift(a.asm.h);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(f=N,N=null,f()))}function c(f){b(f.instance)}function d(f){return aa().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){y("failed to asynchronously prepare wasm: "+g);x(g)})}var e={a:ba};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(e,
|
||||
b)}catch(f){return y("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return z||"function"!==typeof WebAssembly.instantiateStreaming||O()||P.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){y("wasm streaming compile failed: "+g);y("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(k);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.h).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.i).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.j).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.k).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.l).apply(null,arguments)};
|
||||
a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.m).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.n).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.o).apply(null,arguments)};a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.p).apply(null,arguments)};
|
||||
a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.q).apply(null,arguments)};a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};var U;N=function ca(){U||V();U||(N=ca)};
|
||||
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!B)){S(I);h(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();J.unshift(c)}S(J)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)K();S(H);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
|
||||
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
|
||||
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(A.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
|
||||
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
|
||||
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
|
||||
|
||||
|
||||
return OGVDemuxerOggW.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDemuxerOggW;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDemuxerOggW; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDemuxerOggW"] = OGVDemuxerOggW;
|
BIN
media/player/videojs/ogvjs/ogv-demuxer-ogg-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-demuxer-ogg-wasm.wasm
Normal file
Binary file not shown.
46
media/player/videojs/ogvjs/ogv-demuxer-webm-wasm.js
Normal file
46
media/player/videojs/ogvjs/ogv-demuxer-webm-wasm.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
var OGVDemuxerWebMW = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
return (
|
||||
function(OGVDemuxerWebMW) {
|
||||
OGVDemuxerWebMW = OGVDemuxerWebMW || {};
|
||||
|
||||
|
||||
var a;a||(a=typeof OGVDemuxerWebMW !== 'undefined' ? OGVDemuxerWebMW : {});var h,k;a.ready=new Promise(function(b,c){h=b;k=c});var l={},m;for(m in a)a.hasOwnProperty(m)&&(l[m]=a[m]);var n="object"===typeof window,p="function"===typeof importScripts,q="",r,t,v,w,x;
|
||||
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)q=p?require("path").dirname(q)+"/":__dirname+"/",r=function(b,c){w||(w=require("fs"));x||(x=require("path"));b=x.normalize(b);return w.readFileSync(b,c?null:"utf8")},v=function(b){b=r(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||y("Assertion failed: undefined");return b},t=function(b,c,d){w||(w=require("fs"));x||(x=require("path"));b=x.normalize(b);w.readFile(b,function(e,f){e?d(e):c(f.buffer)})},
|
||||
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",y),a.inspect=function(){return"[Emscripten Module object]"};else if(n||p)p?q=self.location.href:"undefined"!==typeof document&&document.currentScript&&(q=document.currentScript.src),_scriptDir&&(q=_scriptDir),0!==q.indexOf("blob:")?q=q.substr(0,q.lastIndexOf("/")+1):q="",r=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(v=function(b){var c=
|
||||
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),t=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};var aa=a.print||console.log.bind(console),z=a.printErr||console.warn.bind(console);for(m in l)l.hasOwnProperty(m)&&(a[m]=l[m]);l=null;var A;a.wasmBinary&&(A=a.wasmBinary);
|
||||
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&y("no native wasm support detected");var E,F=!1,G="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||
function H(b,c,d){var e=c+d;for(d=c;b[d]&&!(d>=e);)++d;if(16<d-c&&b.subarray&&G)return G.decode(b.subarray(c,d));for(e="";c<d;){var f=b[c++];if(f&128){var g=b[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var u=b[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|u:(f&7)<<18|g<<12|u<<6|b[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function J(b){return b?H(K,b,void 0):""}var L,K,M;
|
||||
function N(){var b=E.buffer;L=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=M=new Int32Array(b);a.HEAPU8=K=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var O,ba=[],ca=[],da=[];function ea(){var b=a.preRun.shift();ba.unshift(b)}var P=0,Q=null,R=null;a.preloadedImages={};a.preloadedAudios={};
|
||||
function y(b){if(a.onAbort)a.onAbort(b);z(b);F=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");k(b);throw b;}function fa(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-demuxer-webm-wasm.wasm";if(!fa()){var ha=S;S=a.locateFile?a.locateFile(ha,q):q+ha}function ia(){var b=S;try{if(b==S&&A)return new Uint8Array(A);if(v)return v(b);throw"both async and sync fetching of the wasm failed";}catch(c){y(c)}}
|
||||
function ja(){if(!A&&(n||p)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return ia()});if(t)return new Promise(function(b,c){t(S,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return ia()})}
|
||||
function T(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.A?O.get(d)():O.get(d)(c.A):d(void 0===c.A?null:c.A)}}}
|
||||
var ka=[null,[],[]],la={a:function(b,c,d,e){y("Assertion failed: "+J(b)+", at: "+[c?J(c):"unknown filename",d,e?J(e):"unknown function"])},f:function(){y()},d:function(b,c,d){K.copyWithin(b,c,c+d)},e:function(b){var c=K.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);N();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},b:function(b,
|
||||
c,d,e){for(var f=0,g=0;g<d;g++){for(var u=M[c+8*g>>2],I=M[c+(8*g+4)>>2],B=0;B<I;B++){var C=K[u+B],D=ka[b];0===C||10===C?((1===b?aa:z)(H(D,0)),D.length=0):D.push(C)}f+=I}M[e>>2]=f;return 0},c:function(b,c,d,e){var f=E.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):(new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},j:function(b,c,d,e,f,g,u,I,B,C,D){a.videoFormat={width:b,height:c,chromaWidth:d,chromaHeight:e,cropLeft:I,cropTop:B,cropWidth:g,cropHeight:u,displayWidth:C,
|
||||
displayHeight:D,fps:f}},h:function(b,c){function d(e){for(var f="",g=new Uint8Array(E.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},i:function(b,c){if(a.onseek)a.onseek(b+4294967296*c)},g:function(b,c,d,e,f){var g=E.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
|
||||
(function(){function b(f){a.asm=f.exports;E=a.asm.k;N();O=a.asm.w;ca.unshift(a.asm.l);P--;a.monitorRunDependencies&&a.monitorRunDependencies(P);0==P&&(null!==Q&&(clearInterval(Q),Q=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function d(f){return ja().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){z("failed to asynchronously prepare wasm: "+g);y(g)})}var e={a:la};P++;a.monitorRunDependencies&&a.monitorRunDependencies(P);if(a.instantiateWasm)try{return a.instantiateWasm(e,
|
||||
b)}catch(f){return z("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||fa()||S.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){z("wasm streaming compile failed: "+g);z("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(k);return{}})();
|
||||
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.l).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.m).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.n).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.o).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.p).apply(null,arguments)};
|
||||
a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.q).apply(null,arguments)};a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.r).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.s).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.t).apply(null,arguments)};
|
||||
a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.u).apply(null,arguments)};a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.v).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.x).apply(null,arguments)};a._free=function(){return(a._free=a.asm.y).apply(null,arguments)};var U;R=function ma(){U||V();U||(R=ma)};
|
||||
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!F)){T(ca);h(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();da.unshift(c)}T(da)}}if(!(0<P)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ea();T(ba);0<P||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
|
||||
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
|
||||
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
|
||||
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
|
||||
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(E.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
|
||||
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
|
||||
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
|
||||
|
||||
|
||||
return OGVDemuxerWebMW.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = OGVDemuxerWebMW;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return OGVDemuxerWebMW; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["OGVDemuxerWebMW"] = OGVDemuxerWebMW;
|
BIN
media/player/videojs/ogvjs/ogv-demuxer-webm-wasm.wasm
Normal file
BIN
media/player/videojs/ogvjs/ogv-demuxer-webm-wasm.wasm
Normal file
Binary file not shown.
2
media/player/videojs/ogvjs/ogv-es2017.js
Normal file
2
media/player/videojs/ogvjs/ogv-es2017.js
Normal file
File diff suppressed because one or more lines are too long
1
media/player/videojs/ogvjs/ogv-support.js
Normal file
1
media/player/videojs/ogvjs/ogv-support.js
Normal file
|
@ -0,0 +1 @@
|
|||
(()=>{var e={575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},913:e=>{function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),e},e.exports.default=e.exports,e.exports.__esModule=!0},318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},8:e=>{function t(o){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(o)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},523:(e,t,o)=>{"use strict";var r=o(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(o(575)),u=r(o(913)),s=new(function(){function e(){(0,n.default)(this,e)}return(0,u.default)(e,[{key:"hasTypedArrays",value:function(){return!!window.Uint32Array}},{key:"hasWebAssembly",value:function(){return!!window.WebAssembly}},{key:"hasWebAudio",value:function(){return!(!window.AudioContext&&!window.webkitAudioContext)}},{key:"hasFlash",value:function(){return!1}},{key:"hasAudio",value:function(){return this.hasWebAudio()}},{key:"isBlacklisted",value:function(e){return!1}},{key:"isSlow",value:function(){return!1}},{key:"isTooSlow",value:function(){return!1}},{key:"supported",value:function(e){return"OGVDecoder"===e?this.hasWebAssembly():"OGVPlayer"===e&&this.supported("OGVDecoder")&&this.hasAudio()}}]),e}());t.default=s}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}(()=>{"use strict";var e=o(318),t=e(o(8)),r=e(o(523));"object"===("undefined"==typeof window?"undefined":(0,t.default)(window))&&(window.OGVCompat=r.default,window.OGVVersion="1.8.4-20210702161914-bd3a07f")})()})();
|
1
media/player/videojs/ogvjs/ogv-version.js
Normal file
1
media/player/videojs/ogvjs/ogv-version.js
Normal file
|
@ -0,0 +1 @@
|
|||
(()=>{var e={318:e=>{e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},8:e=>{function _typeof(o){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=_typeof=function _typeof(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=_typeof=function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),_typeof(o)}e.exports=_typeof,e.exports.default=e.exports,e.exports.__esModule=!0}},o={};function __webpack_require__(t){var r=o[t];if(void 0!==r)return r.exports;var p=o[t]={exports:{}};return e[t](p,p.exports,__webpack_require__),p.exports}(()=>{"use strict";var e=__webpack_require__(318)(__webpack_require__(8)),o="1.8.4-20210702161914-bd3a07f";"object"===("undefined"==typeof window?"undefined":(0,e.default)(window))&&(window.OGVVersion=o)})()})();
|
1
media/player/videojs/ogvjs/ogv-worker-audio.js
Normal file
1
media/player/videojs/ogvjs/ogv-worker-audio.js
Normal file
File diff suppressed because one or more lines are too long
1
media/player/videojs/ogvjs/ogv-worker-video.js
Normal file
1
media/player/videojs/ogvjs/ogv-worker-video.js
Normal file
File diff suppressed because one or more lines are too long
2
media/player/videojs/ogvjs/ogv.js
Normal file
2
media/player/videojs/ogvjs/ogv.js
Normal file
File diff suppressed because one or more lines are too long
10
media/player/videojs/ogvjs/readme_moodle.txt
Normal file
10
media/player/videojs/ogvjs/readme_moodle.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
ogv.js 1.8.4
|
||||
--------------
|
||||
https://github.com/brion/ogv.js
|
||||
|
||||
Instructions to import ogv.js library into Moodle:
|
||||
|
||||
1. Download the latest release from https://github.com/brion/ogv.js/releases
|
||||
(do not choose "Source code")
|
||||
2. copy 'ogv-es2017.js' into 'amd/src/local/ogv/ogv.js'.
|
||||
3. copy all the wasm and js files into 'ogvjs/' folder.
|
182
media/player/videojs/ogvloader.php
Normal file
182
media/player/videojs/ogvloader.php
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?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/>.
|
||||
|
||||
/**
|
||||
* This file is serving optimised JS and WASM for ogv.js.
|
||||
*
|
||||
* @package media_videojs
|
||||
* @copyright 2021 Huong Nguyen <huongnv13@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// Disable moodle specific debug messages and any errors in output,
|
||||
// comment out when debugging or better look into error log!
|
||||
define('NO_DEBUG_DISPLAY', true);
|
||||
|
||||
// We need just the values from config.php and minlib.php.
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
require_once('../../../config.php'); // This stops immediately at the beginning of lib/setup.php.
|
||||
require_once($CFG->dirroot . '/lib/jslib.php');
|
||||
require_once($CFG->dirroot . '/lib/wasmlib.php');
|
||||
|
||||
$slashargument = min_get_slash_argument();
|
||||
if (!$slashargument) {
|
||||
// The above call to min_get_slash_argument should always work.
|
||||
die('Invalid request');
|
||||
}
|
||||
|
||||
$slashargument = ltrim($slashargument, '/');
|
||||
if (substr_count($slashargument, '/') < 1) {
|
||||
header('HTTP/1.0 404 not found');
|
||||
die('Slash argument must contain both a revision and a file path');
|
||||
}
|
||||
|
||||
// Get all the library files (js and wasm) of the OGV.
|
||||
$basepath = $CFG->dirroot . '/media/player/videojs/ogvjs/';
|
||||
$jsfiles = [];
|
||||
$files = glob("{$basepath}*.{js,wasm}", GLOB_BRACE);
|
||||
foreach ($files as $file) {
|
||||
$jsfiles[] = basename($file);
|
||||
}
|
||||
|
||||
// Split into revision and module name.
|
||||
list($rev, $file) = explode('/', $slashargument, 2);
|
||||
$rev = min_clean_param($rev, 'INT');
|
||||
$file = min_clean_param($file, 'SAFEPATH');
|
||||
|
||||
if (empty($jsfiles) || !in_array($file, $jsfiles)) {
|
||||
// We can't find the requested file.
|
||||
header('HTTP/1.0 404 not found');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Check if the requesting file is Javascript or Web Assembly.
|
||||
$iswasm = media_videojs_ogvloader_is_wasm_file($file);
|
||||
|
||||
// Use the caching only for meaningful revision numbers which prevents future cache poisoning.
|
||||
if ($rev > 0 and $rev < (time() + 60 * 60)) {
|
||||
// We are lazy loading a single file - so include the filename in the etag.
|
||||
$etag = sha1($rev . '/' . $file);
|
||||
$candidate = $CFG->localcachedir . '/ogvloader/' . $etag;
|
||||
|
||||
if (file_exists($candidate)) {
|
||||
// Cache exist.
|
||||
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
// We do not actually need to verify the etag value because our files
|
||||
// never change in cache because we increment the rev parameter.
|
||||
media_videojs_ogvloader_send_unmodified($iswasm, $candidate, $etag);
|
||||
}
|
||||
media_videojs_ogvloader_send_cached($iswasm, $candidate, $etag);
|
||||
exit(0);
|
||||
} else {
|
||||
// Cache does not exist. Create one.
|
||||
$filecontent = file_get_contents($basepath . $file);
|
||||
if ($filecontent === false) {
|
||||
error_log('Failed to load the library ' . $file);
|
||||
$filecontent = "/* Failed to load library file {$file}. */\n";
|
||||
}
|
||||
|
||||
$filecontent = media_videojs_ogvloader_add_module_module_name_if_necessary($iswasm, $filecontent);
|
||||
media_videojs_ogvloader_write_cache_file_content($iswasm, $candidate, $filecontent);
|
||||
// Verify nothing failed in cache file creation.
|
||||
clearstatcache();
|
||||
if (file_exists($candidate)) {
|
||||
media_videojs_ogvloader_send_cached($iswasm, $candidate, $etag);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we've made it here then we're in "dev mode" where everything is lazy loaded.
|
||||
// So all files will be served one at a time.
|
||||
$filecontent = file_get_contents($basepath . $file);
|
||||
$filecontent = rtrim($filecontent);
|
||||
$filecontent = media_videojs_ogvloader_add_module_module_name_if_necessary($iswasm, $filecontent);
|
||||
media_videojs_ogvloader_send_uncached($iswasm, $filecontent);
|
||||
|
||||
/**
|
||||
* Check the given file is a Web Assembly file or not
|
||||
*
|
||||
* @param string $filename File name to check
|
||||
* @return bool Whether the file is Web Assembly or not
|
||||
*/
|
||||
function media_videojs_ogvloader_is_wasm_file(string $filename): bool {
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
return $ext == 'wasm';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Moodle module name to the Javascript module if necessary
|
||||
*
|
||||
* @param bool $iswasm Whether the file is Web Assembly or not
|
||||
* @param string $content File content
|
||||
* @return string
|
||||
*/
|
||||
function media_videojs_ogvloader_add_module_module_name_if_necessary(bool $iswasm, string $content): string {
|
||||
if (!$iswasm && preg_match('/define\(\s*(\[|function)/', $content)) {
|
||||
// If the JavaScript module has been defined without specifying a name then we'll
|
||||
// add the Moodle module name now.
|
||||
$replace = 'define(\'media_videojs/video-lazy\', ';
|
||||
$search = 'define(';
|
||||
// Replace only the first occurrence.
|
||||
$content = implode($replace, explode($search, $content, 2));
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cache file content
|
||||
*
|
||||
* @param bool $iswasm Whether the file is Web Assembly or not
|
||||
* @param string $candidate Full file path to cache file
|
||||
* @param string $filecontent File content
|
||||
*/
|
||||
function media_videojs_ogvloader_write_cache_file_content(bool $iswasm, string $candidate, string $filecontent): void {
|
||||
$iswasm ? wasm_write_cache_file_content($candidate, $filecontent) : js_write_cache_file_content($candidate, $filecontent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send file content with as much caching as possible
|
||||
*
|
||||
* @param bool $iswasm Whether the file is Web Assembly or not
|
||||
* @param string $candidate Full file path to cache file
|
||||
* @param string $etag Etag
|
||||
*/
|
||||
function media_videojs_ogvloader_send_cached(bool $iswasm, string $candidate, string $etag): void {
|
||||
$iswasm ? wasm_send_cached($candidate, $etag, 'ogvloader.php') : js_send_cached($candidate, $etag, 'ogvloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send file without any caching
|
||||
*
|
||||
* @param bool $iswasm Whether the file is Web Assembly or not
|
||||
* @param string $ilecontent File content
|
||||
*/
|
||||
function media_videojs_ogvloader_send_uncached(bool $iswasm, string $ilecontent): void {
|
||||
$iswasm ? wasm_send_uncached($ilecontent, 'ogvloader.php') : js_send_uncached($ilecontent, 'ogvloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the file not modified headers
|
||||
*
|
||||
* @param bool $iswasm Whether the file is Web Assembly or not
|
||||
* @param int $candidate Full file path to cache file
|
||||
* @param string $etag Etag
|
||||
*/
|
||||
function media_videojs_ogvloader_send_unmodified(bool $iswasm, int $candidate, string $etag): void {
|
||||
$iswasm ? wasm_send_unmodified(filemtime($candidate), $etag) : js_send_unmodified(filemtime($candidate), $etag);
|
||||
}
|
|
@ -36,4 +36,29 @@ Import plugins:
|
|||
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'
|
||||
and place it into 'videojs/video-js.swf'
|
||||
|
||||
4. Download the latest release from https://github.com/HuongNV13/videojs-ogvjs/releases
|
||||
(do not choose "Source code")
|
||||
|
||||
5. Copy videojs-ogvjs.js into 'amd/src/videojs-ogvjs-lazy.js'
|
||||
In the beginning of the js file:
|
||||
|
||||
Replace
|
||||
define(['video.js', 'OGVCompat', 'OGVLoader', 'OGVPlayer']
|
||||
with
|
||||
define(['media_videojs/video-lazy', './local/ogv/ogv']
|
||||
|
||||
Replace
|
||||
function (videojs, OGVCompat, OGVLoader, OGVPlayer)
|
||||
with
|
||||
function (videojs, ogvBase)
|
||||
|
||||
Replace
|
||||
var OGVCompat__default = /*#__PURE__*/_interopDefaultLegacy(OGVCompat);
|
||||
var OGVLoader__default = /*#__PURE__*/_interopDefaultLegacy(OGVLoader);
|
||||
var OGVPlayer__default = /*#__PURE__*/_interopDefaultLegacy(OGVPlayer);
|
||||
with
|
||||
var OGVCompat__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVCompat);
|
||||
var OGVLoader__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVLoader);
|
||||
var OGVPlayer__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVPlayer);
|
|
@ -35,4 +35,24 @@
|
|||
<version>5.4.2</version>
|
||||
<licenseversion>2.0</licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
<location>amd/src/local/ogv/ogv.js</location>
|
||||
<name>ogv.js</name>
|
||||
<license>MIT</license>
|
||||
<version>1.8.4</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
<location>ogvjs</location>
|
||||
<name>ogv.js support files</name>
|
||||
<license>MIT</license>
|
||||
<version>1.8.4</version>
|
||||
</library>
|
||||
<library>
|
||||
<location>amd/src/videojs-ogvjs-lazy.js</location>
|
||||
<name>ogv.js Tech plugin for Video.JS</name>
|
||||
<license>MIT</license>
|
||||
<version>0.1.2</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
</libraries>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue