mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
add p2p support for HLS https://github.com/Novage/p2p-media-loader
This commit is contained in:
parent
64c36d9f4e
commit
0d0338876d
1197 changed files with 121461 additions and 179724 deletions
167
node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js
generated
vendored
167
node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
/*! @name @videojs/http-streaming @version 2.14.3 @license Apache-2.0 */
|
||||
/*! @name @videojs/http-streaming @version 2.16.0 @license Apache-2.0 */
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
@ -19,6 +19,7 @@ var parseSidx = require('mux.js/lib/tools/parse-sidx');
|
|||
var id3Helpers = require('@videojs/vhs-utils/cjs/id3-helpers');
|
||||
var containers = require('@videojs/vhs-utils/cjs/containers');
|
||||
var clock = require('mux.js/lib/utils/clock');
|
||||
var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
|
@ -30,6 +31,7 @@ var _resolveUrl__default = /*#__PURE__*/_interopDefaultLegacy(_resolveUrl);
|
|||
var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
|
||||
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
||||
var parseSidx__default = /*#__PURE__*/_interopDefaultLegacy(parseSidx);
|
||||
var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
|
||||
|
||||
/**
|
||||
* @file resolve-url.js - Handling how URLs are resolved and manipulated
|
||||
|
@ -4084,7 +4086,7 @@ var getWorkerString = function getWorkerString(fn) {
|
|||
return fn.toString().replace(/^function.+?{/, '').slice(0, -1);
|
||||
};
|
||||
|
||||
/* rollup-plugin-worker-factory start for worker!/Users/abarstow/videojs/http-streaming/src/transmuxer-worker.js */
|
||||
/* rollup-plugin-worker-factory start for worker!/Users/ddashkevich/projects/vhs-release/src/transmuxer-worker.js */
|
||||
var workerCode$1 = transform(getWorkerString(function () {
|
||||
/**
|
||||
* mux.js
|
||||
|
@ -12887,7 +12889,7 @@ var workerCode$1 = transform(getWorkerString(function () {
|
|||
};
|
||||
}));
|
||||
var TransmuxWorker = factory(workerCode$1);
|
||||
/* rollup-plugin-worker-factory end for worker!/Users/abarstow/videojs/http-streaming/src/transmuxer-worker.js */
|
||||
/* rollup-plugin-worker-factory end for worker!/Users/ddashkevich/projects/vhs-release/src/transmuxer-worker.js */
|
||||
|
||||
var handleData_ = function handleData_(event, transmuxedData, callback) {
|
||||
var _event$data$segment = event.data.segment,
|
||||
|
@ -17919,6 +17921,7 @@ var SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
this.bandwidth = 1;
|
||||
this.roundTrip = NaN;
|
||||
this.trigger('bandwidthupdate');
|
||||
this.trigger('timeout');
|
||||
}
|
||||
/**
|
||||
* Handle the callback from the segmentRequest function and set the
|
||||
|
@ -19418,6 +19421,16 @@ var uint8ToUtf8 = function uint8ToUtf8(uintArray) {
|
|||
var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) {
|
||||
return char.charCodeAt(0);
|
||||
}));
|
||||
|
||||
var NoVttJsError = /*#__PURE__*/function (_Error) {
|
||||
_inheritsLoose__default["default"](NoVttJsError, _Error);
|
||||
|
||||
function NoVttJsError() {
|
||||
return _Error.call(this, 'Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.') || this;
|
||||
}
|
||||
|
||||
return NoVttJsError;
|
||||
}( /*#__PURE__*/_wrapNativeSuper__default["default"](Error));
|
||||
/**
|
||||
* An object that manages segment loading and appending.
|
||||
*
|
||||
|
@ -19426,6 +19439,7 @@ var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) {
|
|||
* @extends videojs.EventTarget
|
||||
*/
|
||||
|
||||
|
||||
var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {
|
||||
_inheritsLoose__default["default"](VTTSegmentLoader, _SegmentLoader);
|
||||
|
||||
|
@ -19442,7 +19456,8 @@ var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {
|
|||
_this.mediaSource_ = null;
|
||||
_this.subtitlesTrack_ = null;
|
||||
_this.loaderType_ = 'subtitle';
|
||||
_this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks; // The VTT segment will have its own time mappings. Saving VTT segment timing info in
|
||||
_this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
|
||||
_this.loadVttJs = settings.loadVttJs; // The VTT segment will have its own time mappings. Saving VTT segment timing info in
|
||||
// the sync controller leads to improper behavior.
|
||||
|
||||
_this.shouldSaveSegmentTimingInfo_ = false;
|
||||
|
@ -19717,30 +19732,19 @@ var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {
|
|||
segment.map.bytes = simpleSegment.map.bytes;
|
||||
}
|
||||
|
||||
segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, wait till it finished loading
|
||||
segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, load it and wait till it finished loading
|
||||
|
||||
if (typeof window__default["default"].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) {
|
||||
var loadHandler;
|
||||
if (typeof window__default["default"].WebVTT !== 'function' && typeof this.loadVttJs === 'function') {
|
||||
this.state = 'WAITING_ON_VTTJS'; // should be fine to call multiple times
|
||||
// script will be loaded once but multiple listeners will be added to the queue, which is expected.
|
||||
|
||||
var errorHandler = function errorHandler() {
|
||||
_this3.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler);
|
||||
|
||||
_this3.stopForError({
|
||||
this.loadVttJs().then(function () {
|
||||
return _this3.segmentRequestFinished_(error, simpleSegment, result);
|
||||
}, function () {
|
||||
return _this3.stopForError({
|
||||
message: 'Error loading vtt.js'
|
||||
});
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
loadHandler = function loadHandler() {
|
||||
_this3.subtitlesTrack_.tech_.off('vttjserror', errorHandler);
|
||||
|
||||
_this3.segmentRequestFinished_(error, simpleSegment, result);
|
||||
};
|
||||
|
||||
this.state = 'WAITING_ON_VTTJS';
|
||||
this.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler);
|
||||
this.subtitlesTrack_.tech_.one('vttjserror', errorHandler);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19800,6 +19804,8 @@ var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {
|
|||
/**
|
||||
* Uses the WebVTT parser to parse the segment response
|
||||
*
|
||||
* @throws NoVttJsError
|
||||
*
|
||||
* @param {Object} segmentInfo
|
||||
* a segment info object that describes the current segment
|
||||
* @private
|
||||
|
@ -19810,6 +19816,11 @@ var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {
|
|||
var decoder;
|
||||
var decodeBytesToString = false;
|
||||
|
||||
if (typeof window__default["default"].WebVTT !== 'function') {
|
||||
// caller is responsible for exception handling.
|
||||
throw new NoVttJsError();
|
||||
}
|
||||
|
||||
if (typeof window__default["default"].TextDecoder === 'function') {
|
||||
decoder = new window__default["default"].TextDecoder('utf8');
|
||||
} else {
|
||||
|
@ -20646,7 +20657,7 @@ var TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
return TimelineChangeController;
|
||||
}(videojs__default["default"].EventTarget);
|
||||
|
||||
/* rollup-plugin-worker-factory start for worker!/Users/abarstow/videojs/http-streaming/src/decrypter-worker.js */
|
||||
/* rollup-plugin-worker-factory start for worker!/Users/ddashkevich/projects/vhs-release/src/decrypter-worker.js */
|
||||
var workerCode = transform(getWorkerString(function () {
|
||||
|
||||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
|
@ -21363,7 +21374,7 @@ var workerCode = transform(getWorkerString(function () {
|
|||
};
|
||||
}));
|
||||
var Decrypter = factory(workerCode);
|
||||
/* rollup-plugin-worker-factory end for worker!/Users/abarstow/videojs/http-streaming/src/decrypter-worker.js */
|
||||
/* rollup-plugin-worker-factory end for worker!/Users/ddashkevich/projects/vhs-release/src/decrypter-worker.js */
|
||||
|
||||
/**
|
||||
* Convert the properties of an HLS track into an audioTrackKind.
|
||||
|
@ -22492,7 +22503,25 @@ var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
}), options);
|
||||
_this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs__default["default"].mergeOptions(segmentLoaderSettings, {
|
||||
loaderType: 'vtt',
|
||||
featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks
|
||||
featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks,
|
||||
loadVttJs: function loadVttJs() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
function onLoad() {
|
||||
tech.off('vttjserror', onError);
|
||||
resolve();
|
||||
}
|
||||
|
||||
function onError() {
|
||||
tech.off('vttjsloaded', onLoad);
|
||||
reject();
|
||||
}
|
||||
|
||||
tech.one('vttjsloaded', onLoad);
|
||||
tech.one('vttjserror', onError); // safe to call multiple times, script will be loaded only once:
|
||||
|
||||
tech.addWebVttScript_();
|
||||
});
|
||||
}
|
||||
}), options);
|
||||
|
||||
_this.setupSegmentLoaderListeners_();
|
||||
|
@ -22582,16 +22611,20 @@ var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
/**
|
||||
* Run selectPlaylist and switch to the new playlist if we should
|
||||
*
|
||||
* @param {string} [reason=abr] a reason for why the ABR check is made
|
||||
* @private
|
||||
*
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.checkABR_ = function checkABR_() {
|
||||
_proto.checkABR_ = function checkABR_(reason) {
|
||||
if (reason === void 0) {
|
||||
reason = 'abr';
|
||||
}
|
||||
|
||||
var nextPlaylist = this.selectPlaylist();
|
||||
|
||||
if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
|
||||
this.switchMedia_(nextPlaylist, 'abr');
|
||||
this.switchMedia_(nextPlaylist, reason);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -22843,7 +22876,9 @@ var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
_this3.requestOptions_.timeout = 0;
|
||||
} else {
|
||||
_this3.requestOptions_.timeout = requestTimeout;
|
||||
} // TODO: Create a new event on the PlaylistLoader that signals
|
||||
}
|
||||
|
||||
_this3.masterPlaylistLoader_.load(); // TODO: Create a new event on the PlaylistLoader that signals
|
||||
// that the segments have changed in some way and use that to
|
||||
// update the SegmentLoader instead of doing it twice here and
|
||||
// on `loadedplaylist`
|
||||
|
@ -23047,16 +23082,25 @@ var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) {
|
|||
_proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() {
|
||||
var _this4 = this;
|
||||
|
||||
this.mainSegmentLoader_.on('bandwidthupdate', function () {
|
||||
// Whether or not buffer based ABR or another ABR is used, on a bandwidth change it's
|
||||
// useful to check to see if a rendition switch should be made.
|
||||
_this4.checkABR_('bandwidthupdate');
|
||||
|
||||
_this4.tech_.trigger('bandwidthupdate');
|
||||
});
|
||||
this.mainSegmentLoader_.on('timeout', function () {
|
||||
if (_this4.experimentalBufferBasedABR) {
|
||||
// If a rendition change is needed, then it would've be done on `bandwidthupdate`.
|
||||
// Here the only consideration is that for buffer based ABR there's no guarantee
|
||||
// of an immediate switch (since the bandwidth is averaged with a timeout
|
||||
// bandwidth value of 1), so force a load on the segment loader to keep it going.
|
||||
_this4.mainSegmentLoader_.load();
|
||||
}
|
||||
}); // `progress` events are not reliable enough of a bandwidth measure to trigger buffer
|
||||
// based ABR.
|
||||
|
||||
if (!this.experimentalBufferBasedABR) {
|
||||
this.mainSegmentLoader_.on('bandwidthupdate', function () {
|
||||
var nextPlaylist = _this4.selectPlaylist();
|
||||
|
||||
if (_this4.shouldSwitchToMedia_(nextPlaylist)) {
|
||||
_this4.switchMedia_(nextPlaylist, 'bandwidthupdate');
|
||||
}
|
||||
|
||||
_this4.tech_.trigger('bandwidthupdate');
|
||||
});
|
||||
this.mainSegmentLoader_.on('progress', function () {
|
||||
_this4.trigger('progress');
|
||||
});
|
||||
|
@ -24353,6 +24397,7 @@ var Representation = function Representation(vhsHandler, playlist, id) {
|
|||
this.width = resolution && resolution.width;
|
||||
this.height = resolution && resolution.height;
|
||||
this.bandwidth = playlist.attributes.BANDWIDTH;
|
||||
this.frameRate = playlist.attributes['FRAME-RATE'];
|
||||
}
|
||||
|
||||
this.codecs = codecsForPlaylist(mpc.master(), playlist);
|
||||
|
@ -25192,13 +25237,13 @@ var reloadSourceOnError = function reloadSourceOnError(options) {
|
|||
initPlugin(this, options);
|
||||
};
|
||||
|
||||
var version$4 = "2.14.3";
|
||||
var version$4 = "2.16.0";
|
||||
|
||||
var version$3 = "6.0.1";
|
||||
|
||||
var version$2 = "0.21.1";
|
||||
var version$2 = "0.22.1";
|
||||
|
||||
var version$1 = "4.7.1";
|
||||
var version$1 = "4.8.0";
|
||||
|
||||
var version = "3.1.3";
|
||||
|
||||
|
@ -26460,23 +26505,33 @@ var VhsSourceHandler = {
|
|||
return tech.vhs;
|
||||
},
|
||||
canPlayType: function canPlayType(type, options) {
|
||||
var simpleType = mediaTypes_js.simpleTypeFromSourceType(type);
|
||||
|
||||
if (!simpleType) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var overrideNative = VhsSourceHandler.getOverrideNative(options);
|
||||
var supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);
|
||||
var canUseMsePlayback = !supportsTypeNatively || overrideNative;
|
||||
return canUseMsePlayback ? 'maybe' : '';
|
||||
},
|
||||
getOverrideNative: function getOverrideNative(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var _videojs$mergeOptions = videojs__default["default"].mergeOptions(videojs__default["default"].options, options),
|
||||
_videojs$mergeOptions2 = _videojs$mergeOptions.vhs;
|
||||
|
||||
_videojs$mergeOptions2 = _videojs$mergeOptions2 === void 0 ? {} : _videojs$mergeOptions2;
|
||||
var _videojs$mergeOptions3 = _videojs$mergeOptions2.overrideNative,
|
||||
overrideNative = _videojs$mergeOptions3 === void 0 ? !videojs__default["default"].browser.IS_ANY_SAFARI : _videojs$mergeOptions3,
|
||||
_videojs$mergeOptions4 = _videojs$mergeOptions.hls;
|
||||
_videojs$mergeOptions4 = _videojs$mergeOptions4 === void 0 ? {} : _videojs$mergeOptions4;
|
||||
var _videojs$mergeOptions5 = _videojs$mergeOptions4.overrideNative,
|
||||
legacyOverrideNative = _videojs$mergeOptions5 === void 0 ? false : _videojs$mergeOptions5;
|
||||
var supportedType = mediaTypes_js.simpleTypeFromSourceType(type);
|
||||
var canUseMsePlayback = supportedType && (!Vhs.supportsTypeNatively(supportedType) || legacyOverrideNative || overrideNative);
|
||||
return canUseMsePlayback ? 'maybe' : '';
|
||||
var _options = options,
|
||||
_options$vhs = _options.vhs,
|
||||
vhs = _options$vhs === void 0 ? {} : _options$vhs,
|
||||
_options$hls = _options.hls,
|
||||
hls = _options$hls === void 0 ? {} : _options$hls;
|
||||
var defaultOverrideNative = !(videojs__default["default"].browser.IS_ANY_SAFARI || videojs__default["default"].browser.IS_IOS);
|
||||
var _vhs$overrideNative = vhs.overrideNative,
|
||||
overrideNative = _vhs$overrideNative === void 0 ? defaultOverrideNative : _vhs$overrideNative;
|
||||
var _hls$overrideNative = hls.overrideNative,
|
||||
legacyOverrideNative = _hls$overrideNative === void 0 ? false : _hls$overrideNative;
|
||||
return legacyOverrideNative || overrideNative;
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue