rx-player 3.30.1-dev.2023032301 → 3.30.1-dev.2023032800
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -2
- package/VERSION +1 -1
- package/dist/_esm5.processed/config.d.ts +2 -0
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +4 -2
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +4 -4
- package/dist/_esm5.processed/core/adaptive/network_analyzer.js +8 -5
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +6 -4
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +28 -1
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +22 -9
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +58 -0
- package/dist/_esm5.processed/core/init/utils/{media_duration_updater.js → media_source_duration_updater.js} +71 -85
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/_esm5.processed/default_config.d.ts +25 -0
- package/dist/_esm5.processed/default_config.js +27 -2
- package/dist/_esm5.processed/utils/is_null_or_undefined.d.ts +1 -1
- package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -1
- package/dist/rx-player.js +156 -115
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/core/adaptive/adaptive_representation_selector.ts +6 -2
- package/src/core/adaptive/buffer_based_chooser.ts +4 -4
- package/src/core/adaptive/network_analyzer.ts +9 -4
- package/src/core/api/public_api.ts +2 -2
- package/src/core/init/media_source_content_initializer.ts +7 -4
- package/src/core/init/utils/content_time_boundaries_observer.ts +46 -10
- package/src/core/init/utils/{media_duration_updater.ts → media_source_duration_updater.ts} +87 -111
- package/src/core/stream/orchestrator/stream_orchestrator.ts +4 -4
- package/src/default_config.ts +29 -2
- package/src/utils/is_null_or_undefined.ts +1 -1
- package/dist/_esm5.processed/core/init/utils/media_duration_updater.d.ts +0 -56
|
@@ -444,6 +444,31 @@ var DEFAULT_CONFIG = {
|
|
|
444
444
|
* @type {Number}
|
|
445
445
|
*/
|
|
446
446
|
SAMPLING_INTERVAL_NO_MEDIASOURCE: 500,
|
|
447
|
+
/**
|
|
448
|
+
* Amount of buffer to have ahead of the current position before we may
|
|
449
|
+
* consider buffer-based adaptive estimates, in seconds.
|
|
450
|
+
*
|
|
451
|
+
* For example setting it to `10` means that we need to have ten seconds of
|
|
452
|
+
* buffer ahead of the current position before relying on buffer-based
|
|
453
|
+
* adaptive estimates.
|
|
454
|
+
*
|
|
455
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
456
|
+
* should be set higher than `ABR_EXIT_BUFFER_BASED_ALGO`.
|
|
457
|
+
*/
|
|
458
|
+
ABR_ENTER_BUFFER_BASED_ALGO: 10,
|
|
459
|
+
/**
|
|
460
|
+
* Below this amount of buffer ahead of the current position, in seconds, we
|
|
461
|
+
* will stop using buffer-based estimate in our adaptive logic to select a
|
|
462
|
+
* quality.
|
|
463
|
+
*
|
|
464
|
+
* For example setting it to `5` means that if we have less than 5 seconds of
|
|
465
|
+
* buffer ahead of the current position, we should stop relying on
|
|
466
|
+
* buffer-based estimates to choose a quality.
|
|
467
|
+
*
|
|
468
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
469
|
+
* should be set lower than `ABR_ENTER_BUFFER_BASED_ALGO`.
|
|
470
|
+
*/
|
|
471
|
+
ABR_EXIT_BUFFER_BASED_ALGO: 5,
|
|
447
472
|
/**
|
|
448
473
|
* Minimum number of bytes sampled before we trust the estimate.
|
|
449
474
|
* If we have not sampled much data, our estimate may not be accurate
|
|
@@ -479,8 +504,8 @@ var DEFAULT_CONFIG = {
|
|
|
479
504
|
* @type {Object}
|
|
480
505
|
*/
|
|
481
506
|
ABR_REGULAR_FACTOR: {
|
|
482
|
-
DEFAULT: 0.
|
|
483
|
-
LOW_LATENCY: 0.
|
|
507
|
+
DEFAULT: 0.72,
|
|
508
|
+
LOW_LATENCY: 0.72,
|
|
484
509
|
},
|
|
485
510
|
/**
|
|
486
511
|
* If a media buffer has less than ABR_STARVATION_GAP in seconds ahead of the
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
* not always understood by newcomers to the code, and which can be overused when
|
|
20
20
|
* only one of the possibility can arise.
|
|
21
21
|
* @param {*} x
|
|
22
|
-
* @returns {
|
|
22
|
+
* @returns {boolean}
|
|
23
23
|
*/
|
|
24
24
|
export default function isNullOrUndefined(x: unknown): x is null | undefined | void;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* not always understood by newcomers to the code, and which can be overused when
|
|
20
20
|
* only one of the possibility can arise.
|
|
21
21
|
* @param {*} x
|
|
22
|
-
* @returns {
|
|
22
|
+
* @returns {boolean}
|
|
23
23
|
*/
|
|
24
24
|
export default function isNullOrUndefined(x) {
|
|
25
25
|
return x === null || x === undefined;
|
package/dist/rx-player.js
CHANGED
|
@@ -2326,6 +2326,31 @@ var DEFAULT_CONFIG = {
|
|
|
2326
2326
|
* @type {Number}
|
|
2327
2327
|
*/
|
|
2328
2328
|
SAMPLING_INTERVAL_NO_MEDIASOURCE: 500,
|
|
2329
|
+
/**
|
|
2330
|
+
* Amount of buffer to have ahead of the current position before we may
|
|
2331
|
+
* consider buffer-based adaptive estimates, in seconds.
|
|
2332
|
+
*
|
|
2333
|
+
* For example setting it to `10` means that we need to have ten seconds of
|
|
2334
|
+
* buffer ahead of the current position before relying on buffer-based
|
|
2335
|
+
* adaptive estimates.
|
|
2336
|
+
*
|
|
2337
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
2338
|
+
* should be set higher than `ABR_EXIT_BUFFER_BASED_ALGO`.
|
|
2339
|
+
*/
|
|
2340
|
+
ABR_ENTER_BUFFER_BASED_ALGO: 10,
|
|
2341
|
+
/**
|
|
2342
|
+
* Below this amount of buffer ahead of the current position, in seconds, we
|
|
2343
|
+
* will stop using buffer-based estimate in our adaptive logic to select a
|
|
2344
|
+
* quality.
|
|
2345
|
+
*
|
|
2346
|
+
* For example setting it to `5` means that if we have less than 5 seconds of
|
|
2347
|
+
* buffer ahead of the current position, we should stop relying on
|
|
2348
|
+
* buffer-based estimates to choose a quality.
|
|
2349
|
+
*
|
|
2350
|
+
* To avoid getting in-and-out of the buffer-based logic all the time, it
|
|
2351
|
+
* should be set lower than `ABR_ENTER_BUFFER_BASED_ALGO`.
|
|
2352
|
+
*/
|
|
2353
|
+
ABR_EXIT_BUFFER_BASED_ALGO: 5,
|
|
2329
2354
|
/**
|
|
2330
2355
|
* Minimum number of bytes sampled before we trust the estimate.
|
|
2331
2356
|
* If we have not sampled much data, our estimate may not be accurate
|
|
@@ -2361,8 +2386,8 @@ var DEFAULT_CONFIG = {
|
|
|
2361
2386
|
* @type {Object}
|
|
2362
2387
|
*/
|
|
2363
2388
|
ABR_REGULAR_FACTOR: {
|
|
2364
|
-
DEFAULT: 0.
|
|
2365
|
-
LOW_LATENCY: 0.
|
|
2389
|
+
DEFAULT: 0.72,
|
|
2390
|
+
LOW_LATENCY: 0.72
|
|
2366
2391
|
},
|
|
2367
2392
|
/**
|
|
2368
2393
|
* If a media buffer has less than ABR_STARVATION_GAP in seconds ahead of the
|
|
@@ -34911,7 +34936,7 @@ function isNonEmptyString(x) {
|
|
|
34911
34936
|
* not always understood by newcomers to the code, and which can be overused when
|
|
34912
34937
|
* only one of the possibility can arise.
|
|
34913
34938
|
* @param {*} x
|
|
34914
|
-
* @returns {
|
|
34939
|
+
* @returns {boolean}
|
|
34915
34940
|
*/
|
|
34916
34941
|
function isNullOrUndefined(x) {
|
|
34917
34942
|
return x === null || x === undefined;
|
|
@@ -38648,10 +38673,10 @@ var BufferBasedChooser = /*#__PURE__*/function () {
|
|
|
38648
38673
|
return bitrates[0];
|
|
38649
38674
|
}
|
|
38650
38675
|
var scaledScore;
|
|
38651
|
-
if (currentScore
|
|
38676
|
+
if (currentScore !== undefined) {
|
|
38652
38677
|
scaledScore = speed === 0 ? currentScore : currentScore / speed;
|
|
38653
38678
|
}
|
|
38654
|
-
if (scaledScore
|
|
38679
|
+
if (scaledScore !== undefined && scaledScore > 1) {
|
|
38655
38680
|
var currentBufferLevel = bufferLevels[currentBitrateIndex];
|
|
38656
38681
|
var nextIndex = function () {
|
|
38657
38682
|
for (var i = currentBitrateIndex + 1; i < bufferLevels.length; i++) {
|
|
@@ -38660,14 +38685,14 @@ var BufferBasedChooser = /*#__PURE__*/function () {
|
|
|
38660
38685
|
}
|
|
38661
38686
|
}
|
|
38662
38687
|
}();
|
|
38663
|
-
if (nextIndex
|
|
38688
|
+
if (nextIndex !== undefined) {
|
|
38664
38689
|
var nextBufferLevel = bufferLevels[nextIndex];
|
|
38665
38690
|
if (bufferGap >= nextBufferLevel) {
|
|
38666
38691
|
return bitrates[nextIndex];
|
|
38667
38692
|
}
|
|
38668
38693
|
}
|
|
38669
38694
|
}
|
|
38670
|
-
if (scaledScore
|
|
38695
|
+
if (scaledScore === undefined || scaledScore < 1.15) {
|
|
38671
38696
|
var _currentBufferLevel = bufferLevels[currentBitrateIndex];
|
|
38672
38697
|
if (bufferGap < _currentBufferLevel) {
|
|
38673
38698
|
for (var i = currentBitrateIndex - 1; i >= 0; i--) {
|
|
@@ -38870,6 +38895,12 @@ function estimateStarvationModeBitrate(pendingRequests, playbackInfo, currentRep
|
|
|
38870
38895
|
}
|
|
38871
38896
|
var concernedRequest = concernedRequests[0];
|
|
38872
38897
|
var now = performance.now();
|
|
38898
|
+
var minimumRequestTime = concernedRequest.content.segment.duration * 1.5;
|
|
38899
|
+
minimumRequestTime = Math.min(minimumRequestTime, 3000);
|
|
38900
|
+
minimumRequestTime = Math.max(minimumRequestTime, 12000);
|
|
38901
|
+
if (now - concernedRequest.requestTimestamp < minimumRequestTime) {
|
|
38902
|
+
return undefined;
|
|
38903
|
+
}
|
|
38873
38904
|
var lastProgressEvent = concernedRequest.progress.length > 0 ? concernedRequest.progress[concernedRequest.progress.length - 1] : undefined;
|
|
38874
38905
|
// first, try to do a quick estimate from progress events
|
|
38875
38906
|
var bandwidthEstimate = estimateRequestBandwidth(concernedRequest);
|
|
@@ -38879,7 +38910,7 @@ function estimateStarvationModeBitrate(pendingRequests, playbackInfo, currentRep
|
|
|
38879
38910
|
if ((now - lastProgressEvent.timestamp) / 1000 <= remainingTime) {
|
|
38880
38911
|
// Calculate estimated time spent rebuffering if we continue doing that request.
|
|
38881
38912
|
var expectedRebufferingTime = remainingTime - realBufferGap / speed;
|
|
38882
|
-
if (expectedRebufferingTime >
|
|
38913
|
+
if (expectedRebufferingTime > 2500) {
|
|
38883
38914
|
return bandwidthEstimate;
|
|
38884
38915
|
}
|
|
38885
38916
|
}
|
|
@@ -39054,10 +39085,8 @@ var NetworkAnalyzer = /*#__PURE__*/function () {
|
|
|
39054
39085
|
_proto.isUrgent = function isUrgent(bitrate, currentRepresentation, currentRequests, playbackInfo) {
|
|
39055
39086
|
if (currentRepresentation === null) {
|
|
39056
39087
|
return true;
|
|
39057
|
-
} else if (bitrate
|
|
39088
|
+
} else if (bitrate >= currentRepresentation.bitrate) {
|
|
39058
39089
|
return false;
|
|
39059
|
-
} else if (bitrate > currentRepresentation.bitrate) {
|
|
39060
|
-
return !this._inStarvationMode;
|
|
39061
39090
|
}
|
|
39062
39091
|
return shouldDirectlySwitchToLowBitrate(playbackInfo, currentRequests, this._lowLatencyMode);
|
|
39063
39092
|
};
|
|
@@ -39783,6 +39812,7 @@ function selectOptimalRepresentation(representations, optimalBitrate, minBitrate
|
|
|
39783
39812
|
|
|
39784
39813
|
|
|
39785
39814
|
|
|
39815
|
+
|
|
39786
39816
|
// Create default shared references
|
|
39787
39817
|
var manualBitrateDefaultRef = (0,reference/* default */.ZP)(-1);
|
|
39788
39818
|
manualBitrateDefaultRef.finish();
|
|
@@ -40055,9 +40085,12 @@ function getEstimateReference(_ref, stopAllEstimates) {
|
|
|
40055
40085
|
bitrateChosen = _networkAnalyzer$getB.bitrateChosen;
|
|
40056
40086
|
var stableRepresentation = scoreCalculator.getLastStableRepresentation();
|
|
40057
40087
|
var knownStableBitrate = stableRepresentation === null ? undefined : stableRepresentation.bitrate / (lastPlaybackObservation.speed > 0 ? lastPlaybackObservation.speed : 1);
|
|
40058
|
-
|
|
40088
|
+
var _config$getCurrent = config/* default.getCurrent */.Z.getCurrent(),
|
|
40089
|
+
ABR_ENTER_BUFFER_BASED_ALGO = _config$getCurrent.ABR_ENTER_BUFFER_BASED_ALGO,
|
|
40090
|
+
ABR_EXIT_BUFFER_BASED_ALGO = _config$getCurrent.ABR_EXIT_BUFFER_BASED_ALGO;
|
|
40091
|
+
if (allowBufferBasedEstimates && bufferGap <= ABR_EXIT_BUFFER_BASED_ALGO) {
|
|
40059
40092
|
allowBufferBasedEstimates = false;
|
|
40060
|
-
} else if (!allowBufferBasedEstimates && isFinite(bufferGap) && bufferGap
|
|
40093
|
+
} else if (!allowBufferBasedEstimates && isFinite(bufferGap) && bufferGap >= ABR_ENTER_BUFFER_BASED_ALGO) {
|
|
40061
40094
|
allowBufferBasedEstimates = true;
|
|
40062
40095
|
}
|
|
40063
40096
|
/**
|
|
@@ -47525,7 +47558,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47525
47558
|
var nextPeriod = manifest.getPeriodAfter(basePeriod);
|
|
47526
47559
|
if (nextPeriod !== null) {
|
|
47527
47560
|
// current Stream is full, create the next one if not
|
|
47528
|
-
|
|
47561
|
+
checkOrCreateNextPeriodStream(nextPeriod);
|
|
47529
47562
|
}
|
|
47530
47563
|
} else if (nextStreamInfo !== null) {
|
|
47531
47564
|
// current Stream is active, destroy next Stream if created
|
|
@@ -47553,12 +47586,12 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47553
47586
|
* Create `PeriodStream` for the next Period, specified under `nextPeriod`.
|
|
47554
47587
|
* @param {Object} nextPeriod
|
|
47555
47588
|
*/
|
|
47556
|
-
function
|
|
47589
|
+
function checkOrCreateNextPeriodStream(nextPeriod) {
|
|
47557
47590
|
if (nextStreamInfo !== null) {
|
|
47558
47591
|
if (nextStreamInfo.period.id === nextPeriod.id) {
|
|
47559
47592
|
return;
|
|
47560
47593
|
}
|
|
47561
|
-
log/* default.warn */.Z.warn("Stream: Creating next `PeriodStream` while
|
|
47594
|
+
log/* default.warn */.Z.warn("Stream: Creating next `PeriodStream` while one was already created.", bufferType, nextPeriod.id, nextStreamInfo.period.id);
|
|
47562
47595
|
consecutivePeriodStreamCb.periodStreamCleared({
|
|
47563
47596
|
type: bufferType,
|
|
47564
47597
|
period: nextStreamInfo.period
|
|
@@ -47707,17 +47740,22 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47707
47740
|
clearSignal: cancelSignal
|
|
47708
47741
|
});
|
|
47709
47742
|
manifest.addEventListener("manifestUpdate", function () {
|
|
47710
|
-
_this.trigger("durationUpdate",
|
|
47743
|
+
_this.trigger("durationUpdate", _this._getManifestDuration());
|
|
47711
47744
|
if (cancelSignal.isCancelled()) {
|
|
47712
47745
|
return;
|
|
47713
47746
|
}
|
|
47714
47747
|
_this._checkEndOfStream();
|
|
47715
47748
|
}, cancelSignal);
|
|
47716
|
-
function getManifestDuration() {
|
|
47717
|
-
return manifest.isDynamic ? maximumPositionCalculator.getMaximumAvailablePosition() : maximumPositionCalculator.getEndingPosition();
|
|
47718
|
-
}
|
|
47719
47749
|
return _this;
|
|
47720
47750
|
}
|
|
47751
|
+
/**
|
|
47752
|
+
* Returns an estimate of the current duration of the content.
|
|
47753
|
+
* @returns {Object}
|
|
47754
|
+
*/
|
|
47755
|
+
var _proto = ContentTimeBoundariesObserver.prototype;
|
|
47756
|
+
_proto.getCurrentDuration = function getCurrentDuration() {
|
|
47757
|
+
return this._getManifestDuration();
|
|
47758
|
+
}
|
|
47721
47759
|
/**
|
|
47722
47760
|
* Method to call any time an Adaptation has been selected.
|
|
47723
47761
|
*
|
|
@@ -47730,8 +47768,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47730
47768
|
* @param {Object|null} adaptation - The Adaptation selected. `null` if the
|
|
47731
47769
|
* absence of `Adaptation` has been explicitely selected for this Period and
|
|
47732
47770
|
* buffer type (e.g. no video).
|
|
47733
|
-
|
|
47734
|
-
var _proto = ContentTimeBoundariesObserver.prototype;
|
|
47771
|
+
*/;
|
|
47735
47772
|
_proto.onAdaptationChange = function onAdaptationChange(bufferType, period, adaptation) {
|
|
47736
47773
|
if (this._manifest.isLastPeriodKnown) {
|
|
47737
47774
|
var lastPeriod = this._manifest.periods[this._manifest.periods.length - 1];
|
|
@@ -47742,7 +47779,14 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47742
47779
|
} else {
|
|
47743
47780
|
this._maximumPositionCalculator.updateLastVideoAdaptation(adaptation);
|
|
47744
47781
|
}
|
|
47745
|
-
var
|
|
47782
|
+
var endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
47783
|
+
var newDuration = endingPosition !== undefined ? {
|
|
47784
|
+
isEnd: true,
|
|
47785
|
+
duration: endingPosition
|
|
47786
|
+
} : {
|
|
47787
|
+
isEnd: false,
|
|
47788
|
+
duration: this._maximumPositionCalculator.getMaximumAvailablePosition()
|
|
47789
|
+
};
|
|
47746
47790
|
this.trigger("durationUpdate", newDuration);
|
|
47747
47791
|
}
|
|
47748
47792
|
}
|
|
@@ -47882,6 +47926,16 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47882
47926
|
if (typeof _ret === "object") return _ret.v;
|
|
47883
47927
|
}
|
|
47884
47928
|
};
|
|
47929
|
+
_proto._getManifestDuration = function _getManifestDuration() {
|
|
47930
|
+
var endingPosition = this._maximumPositionCalculator.getEndingPosition();
|
|
47931
|
+
return endingPosition !== undefined ? {
|
|
47932
|
+
isEnd: true,
|
|
47933
|
+
duration: endingPosition
|
|
47934
|
+
} : {
|
|
47935
|
+
isEnd: false,
|
|
47936
|
+
duration: this._maximumPositionCalculator.getMaximumAvailablePosition()
|
|
47937
|
+
};
|
|
47938
|
+
};
|
|
47885
47939
|
_proto._lazilyCreateActiveStreamInfo = function _lazilyCreateActiveStreamInfo(bufferType) {
|
|
47886
47940
|
var streamInfo = this._activeStreams.get(bufferType);
|
|
47887
47941
|
if (streamInfo === undefined) {
|
|
@@ -48483,7 +48537,7 @@ var get_loaded_reference = __webpack_require__(1757);
|
|
|
48483
48537
|
var initial_seek_and_play = __webpack_require__(8833);
|
|
48484
48538
|
// EXTERNAL MODULE: ./src/core/init/utils/initialize_content_decryption.ts + 1 modules
|
|
48485
48539
|
var initialize_content_decryption = __webpack_require__(8799);
|
|
48486
|
-
;// CONCATENATED MODULE: ./src/core/init/utils/
|
|
48540
|
+
;// CONCATENATED MODULE: ./src/core/init/utils/media_source_duration_updater.ts
|
|
48487
48541
|
/**
|
|
48488
48542
|
* Copyright 2015 CANAL+ Group
|
|
48489
48543
|
*
|
|
@@ -48506,96 +48560,87 @@ var initialize_content_decryption = __webpack_require__(8799);
|
|
|
48506
48560
|
/** Number of seconds in a regular year. */
|
|
48507
48561
|
var YEAR_IN_SECONDS = 365 * 24 * 3600;
|
|
48508
48562
|
/**
|
|
48509
|
-
* Keep the MediaSource's duration up-to-date with
|
|
48510
|
-
*
|
|
48563
|
+
* Keep the MediaSource's `duration` attribute up-to-date with the duration of
|
|
48564
|
+
* the content played on it.
|
|
48565
|
+
* @class MediaSourceDurationUpdater
|
|
48511
48566
|
*/
|
|
48512
|
-
var
|
|
48567
|
+
var MediaSourceDurationUpdater = /*#__PURE__*/function () {
|
|
48513
48568
|
/**
|
|
48514
|
-
* Create a new `
|
|
48515
|
-
* duration as soon as possible.
|
|
48516
|
-
* This duration will be updated until the `stop` method is called.
|
|
48517
|
-
* @param {Object} manifest - The Manifest currently played.
|
|
48518
|
-
* For another content, you will have to create another `MediaDurationUpdater`.
|
|
48569
|
+
* Create a new `MediaSourceDurationUpdater`,
|
|
48519
48570
|
* @param {MediaSource} mediaSource - The MediaSource on which the content is
|
|
48520
|
-
*
|
|
48571
|
+
* played.
|
|
48521
48572
|
*/
|
|
48522
|
-
function
|
|
48523
|
-
|
|
48524
|
-
|
|
48525
|
-
|
|
48526
|
-
|
|
48527
|
-
|
|
48528
|
-
|
|
48529
|
-
|
|
48530
|
-
|
|
48573
|
+
function MediaSourceDurationUpdater(mediaSource) {
|
|
48574
|
+
this._mediaSource = mediaSource;
|
|
48575
|
+
this._currentMediaSourceDurationUpdateCanceller = null;
|
|
48576
|
+
}
|
|
48577
|
+
/**
|
|
48578
|
+
* Indicate to the `MediaSourceDurationUpdater` the currently known duration
|
|
48579
|
+
* of the content.
|
|
48580
|
+
*
|
|
48581
|
+
* The `MediaSourceDurationUpdater` will then use that value to determine
|
|
48582
|
+
* which `duration` attribute should be set on the `MediaSource` associated
|
|
48583
|
+
*
|
|
48584
|
+
* @param {number} newDuration
|
|
48585
|
+
* @param {boolean} addTimeMargin - If set to `true`, the current content is
|
|
48586
|
+
* a dynamic content (it might evolve in the future) and the `newDuration`
|
|
48587
|
+
* communicated might be greater still. In effect the
|
|
48588
|
+
* `MediaSourceDurationUpdater` will actually set a much higher value to the
|
|
48589
|
+
* `MediaSource`'s duration to prevent being annoyed by the HTML-related
|
|
48590
|
+
* side-effects of having a too low duration (such as the impossibility to
|
|
48591
|
+
* seek over that value).
|
|
48592
|
+
*/
|
|
48593
|
+
var _proto = MediaSourceDurationUpdater.prototype;
|
|
48594
|
+
_proto.updateDuration = function updateDuration(newDuration, addTimeMargin) {
|
|
48595
|
+
if (this._currentMediaSourceDurationUpdateCanceller !== null) {
|
|
48596
|
+
this._currentMediaSourceDurationUpdateCanceller.cancel();
|
|
48597
|
+
}
|
|
48598
|
+
this._currentMediaSourceDurationUpdateCanceller = new task_canceller/* default */.ZP();
|
|
48599
|
+
var mediaSource = this._mediaSource;
|
|
48600
|
+
var currentSignal = this._currentMediaSourceDurationUpdateCanceller.signal;
|
|
48601
|
+
var isMediaSourceOpened = createMediaSourceOpenReference(mediaSource, currentSignal);
|
|
48602
|
+
/** TaskCanceller triggered each time the MediaSource switches to and from "open". */
|
|
48603
|
+
var msOpenStatusCanceller = new task_canceller/* default */.ZP();
|
|
48604
|
+
msOpenStatusCanceller.linkToSignal(currentSignal);
|
|
48531
48605
|
isMediaSourceOpened.onUpdate(onMediaSourceOpenedStatusChanged, {
|
|
48532
48606
|
emitCurrentValue: true,
|
|
48533
|
-
clearSignal:
|
|
48607
|
+
clearSignal: currentSignal
|
|
48534
48608
|
});
|
|
48535
48609
|
function onMediaSourceOpenedStatusChanged() {
|
|
48536
|
-
|
|
48610
|
+
msOpenStatusCanceller.cancel();
|
|
48537
48611
|
if (!isMediaSourceOpened.getValue()) {
|
|
48538
48612
|
return;
|
|
48539
48613
|
}
|
|
48540
|
-
|
|
48541
|
-
|
|
48542
|
-
|
|
48543
|
-
var durationChangeCanceller = new task_canceller/* default */.ZP();
|
|
48544
|
-
durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
|
|
48545
|
-
var reSetDuration = function reSetDuration() {
|
|
48546
|
-
durationChangeCanceller.cancel();
|
|
48547
|
-
durationChangeCanceller = new task_canceller/* default */.ZP();
|
|
48548
|
-
durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
|
|
48549
|
-
onDurationMayHaveChanged(durationChangeCanceller.signal);
|
|
48550
|
-
};
|
|
48551
|
-
currentKnownDuration.onUpdate(reSetDuration, {
|
|
48552
|
-
emitCurrentValue: false,
|
|
48553
|
-
clearSignal: msUpdateCanceller.signal
|
|
48554
|
-
});
|
|
48555
|
-
manifest.addEventListener("manifestUpdate", reSetDuration, msUpdateCanceller.signal);
|
|
48556
|
-
onDurationMayHaveChanged(durationChangeCanceller.signal);
|
|
48557
|
-
}
|
|
48558
|
-
function onDurationMayHaveChanged(cancelSignal) {
|
|
48559
|
-
var areSourceBuffersUpdating = createSourceBuffersUpdatingReference(mediaSource.sourceBuffers, cancelSignal);
|
|
48614
|
+
msOpenStatusCanceller = new task_canceller/* default */.ZP();
|
|
48615
|
+
msOpenStatusCanceller.linkToSignal(currentSignal);
|
|
48616
|
+
var areSourceBuffersUpdating = createSourceBuffersUpdatingReference(mediaSource.sourceBuffers, msOpenStatusCanceller.signal);
|
|
48560
48617
|
/** TaskCanceller triggered each time SourceBuffers' updating status changes */
|
|
48561
48618
|
var sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
|
|
48562
|
-
sourceBuffersUpdatingCanceller.linkToSignal(
|
|
48619
|
+
sourceBuffersUpdatingCanceller.linkToSignal(msOpenStatusCanceller.signal);
|
|
48563
48620
|
return areSourceBuffersUpdating.onUpdate(function (areUpdating) {
|
|
48564
48621
|
sourceBuffersUpdatingCanceller.cancel();
|
|
48565
48622
|
sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
|
|
48566
|
-
sourceBuffersUpdatingCanceller.linkToSignal(
|
|
48623
|
+
sourceBuffersUpdatingCanceller.linkToSignal(msOpenStatusCanceller.signal);
|
|
48567
48624
|
if (areUpdating) {
|
|
48568
48625
|
return;
|
|
48569
48626
|
}
|
|
48570
|
-
recursivelyForceDurationUpdate(mediaSource,
|
|
48627
|
+
recursivelyForceDurationUpdate(mediaSource, newDuration, addTimeMargin, sourceBuffersUpdatingCanceller.signal);
|
|
48571
48628
|
}, {
|
|
48572
|
-
clearSignal:
|
|
48629
|
+
clearSignal: msOpenStatusCanceller.signal,
|
|
48573
48630
|
emitCurrentValue: true
|
|
48574
48631
|
});
|
|
48575
48632
|
}
|
|
48576
48633
|
}
|
|
48577
48634
|
/**
|
|
48578
|
-
*
|
|
48579
|
-
* MediaSource's duration.
|
|
48580
|
-
* A more precize duration can be set by communicating to it a more precize
|
|
48581
|
-
* media duration through `updateKnownDuration`.
|
|
48582
|
-
* If the duration becomes unknown, `undefined` can be given to it so the
|
|
48583
|
-
* `MediaDurationUpdater` goes back to a safe estimate.
|
|
48584
|
-
* @param {number | undefined} newDuration
|
|
48585
|
-
*/
|
|
48586
|
-
var _proto = MediaDurationUpdater.prototype;
|
|
48587
|
-
_proto.updateKnownDuration = function updateKnownDuration(newDuration) {
|
|
48588
|
-
this._currentKnownDuration.setValueIfChanged(newDuration);
|
|
48589
|
-
}
|
|
48590
|
-
/**
|
|
48591
|
-
* Stop the `MediaDurationUpdater` from updating and free its resources.
|
|
48592
|
-
* Once stopped, it is not possible to start it again, beside creating another
|
|
48593
|
-
* `MediaDurationUpdater`.
|
|
48635
|
+
* Abort the last duration-setting operation and free its resources.
|
|
48594
48636
|
*/;
|
|
48595
|
-
_proto.
|
|
48596
|
-
this.
|
|
48637
|
+
_proto.stopUpdating = function stopUpdating() {
|
|
48638
|
+
if (this._currentMediaSourceDurationUpdateCanceller !== null) {
|
|
48639
|
+
this._currentMediaSourceDurationUpdateCanceller.cancel();
|
|
48640
|
+
this._currentMediaSourceDurationUpdateCanceller = null;
|
|
48641
|
+
}
|
|
48597
48642
|
};
|
|
48598
|
-
return
|
|
48643
|
+
return MediaSourceDurationUpdater;
|
|
48599
48644
|
}();
|
|
48600
48645
|
/**
|
|
48601
48646
|
* Checks that duration can be updated on the MediaSource, and then
|
|
@@ -48606,27 +48651,21 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
|
|
|
48606
48651
|
* - `null` if it hasn'nt been updated
|
|
48607
48652
|
*
|
|
48608
48653
|
* @param {MediaSource} mediaSource
|
|
48609
|
-
* @param {
|
|
48654
|
+
* @param {number} duration
|
|
48655
|
+
* @param {boolean} addTimeMargin
|
|
48610
48656
|
* @returns {string}
|
|
48611
48657
|
*/
|
|
48612
48658
|
|
|
48613
|
-
function setMediaSourceDuration(mediaSource,
|
|
48614
|
-
var
|
|
48615
|
-
|
|
48616
|
-
if (newDuration === undefined) {
|
|
48617
|
-
if (manifest.isDynamic) {
|
|
48618
|
-
newDuration = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : manifest.getMaximumSafePosition();
|
|
48619
|
-
} else {
|
|
48620
|
-
newDuration = manifest.getMaximumSafePosition();
|
|
48621
|
-
}
|
|
48622
|
-
}
|
|
48623
|
-
if (manifest.isDynamic) {
|
|
48659
|
+
function setMediaSourceDuration(mediaSource, duration, addTimeMargin) {
|
|
48660
|
+
var newDuration = duration;
|
|
48661
|
+
if (addTimeMargin) {
|
|
48624
48662
|
// Some targets poorly support setting a very high number for durations.
|
|
48625
|
-
// Yet, in
|
|
48626
|
-
//
|
|
48627
|
-
// we want to
|
|
48628
|
-
//
|
|
48629
|
-
//
|
|
48663
|
+
// Yet, in contents whose end is not yet known (e.g. live contents), we
|
|
48664
|
+
// would prefer setting a value as high as possible to still be able to
|
|
48665
|
+
// seek anywhere we want to (even ahead of the Manifest if we want to).
|
|
48666
|
+
// As such, we put it at a safe default value of 2^32 excepted when the
|
|
48667
|
+
// maximum position is already relatively close to that value, where we
|
|
48668
|
+
// authorize exceptionally going over it.
|
|
48630
48669
|
newDuration = Math.max(Math.pow(2, 32), newDuration + YEAR_IN_SECONDS);
|
|
48631
48670
|
}
|
|
48632
48671
|
var maxBufferedEnd = 0;
|
|
@@ -48733,23 +48772,23 @@ function createMediaSourceOpenReference(mediaSource, cancelSignal) {
|
|
|
48733
48772
|
}
|
|
48734
48773
|
/**
|
|
48735
48774
|
* Immediately tries to set the MediaSource's duration to the most appropriate
|
|
48736
|
-
* one
|
|
48775
|
+
* one.
|
|
48737
48776
|
*
|
|
48738
48777
|
* If it fails, wait 2 seconds and retries.
|
|
48739
48778
|
*
|
|
48740
48779
|
* @param {MediaSource} mediaSource
|
|
48741
|
-
* @param {
|
|
48742
|
-
* @param {
|
|
48780
|
+
* @param {number} duration
|
|
48781
|
+
* @param {boolean} addTimeMargin
|
|
48743
48782
|
* @param {Object} cancelSignal
|
|
48744
48783
|
*/
|
|
48745
|
-
function recursivelyForceDurationUpdate(mediaSource,
|
|
48746
|
-
var res = setMediaSourceDuration(mediaSource,
|
|
48784
|
+
function recursivelyForceDurationUpdate(mediaSource, duration, addTimeMargin, cancelSignal) {
|
|
48785
|
+
var res = setMediaSourceDuration(mediaSource, duration, addTimeMargin);
|
|
48747
48786
|
if (res === "success" /* MediaSourceDurationUpdateStatus.Success */) {
|
|
48748
48787
|
return;
|
|
48749
48788
|
}
|
|
48750
48789
|
var timeoutId = setTimeout(function () {
|
|
48751
48790
|
unregisterClear();
|
|
48752
|
-
recursivelyForceDurationUpdate(mediaSource,
|
|
48791
|
+
recursivelyForceDurationUpdate(mediaSource, duration, addTimeMargin, cancelSignal);
|
|
48753
48792
|
}, 2000);
|
|
48754
48793
|
var unregisterClear = cancelSignal.register(function () {
|
|
48755
48794
|
clearTimeout(timeoutId);
|
|
@@ -49601,9 +49640,9 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49601
49640
|
_proto._createContentTimeBoundariesObserver = function _createContentTimeBoundariesObserver(manifest, mediaSource, streamObserver, segmentBuffersStore, cancelSignal) {
|
|
49602
49641
|
var _this7 = this;
|
|
49603
49642
|
/** Maintains the MediaSource's duration up-to-date with the Manifest */
|
|
49604
|
-
var
|
|
49643
|
+
var mediaSourceDurationUpdater = new MediaSourceDurationUpdater(mediaSource);
|
|
49605
49644
|
cancelSignal.register(function () {
|
|
49606
|
-
|
|
49645
|
+
mediaSourceDurationUpdater.stopUpdating();
|
|
49607
49646
|
});
|
|
49608
49647
|
/** Allows to cancel a pending `end-of-stream` operation. */
|
|
49609
49648
|
var endOfStreamCanceller = null;
|
|
@@ -49620,7 +49659,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49620
49659
|
});
|
|
49621
49660
|
});
|
|
49622
49661
|
contentTimeBoundariesObserver.addEventListener("durationUpdate", function (newDuration) {
|
|
49623
|
-
|
|
49662
|
+
mediaSourceDurationUpdater.updateDuration(newDuration.duration, !newDuration.isEnd);
|
|
49624
49663
|
});
|
|
49625
49664
|
contentTimeBoundariesObserver.addEventListener("endOfStream", function () {
|
|
49626
49665
|
if (endOfStreamCanceller === null) {
|
|
@@ -49637,6 +49676,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49637
49676
|
endOfStreamCanceller = null;
|
|
49638
49677
|
}
|
|
49639
49678
|
});
|
|
49679
|
+
var currentDuration = contentTimeBoundariesObserver.getCurrentDuration();
|
|
49680
|
+
mediaSourceDurationUpdater.updateDuration(currentDuration.duration, !currentDuration.isEnd);
|
|
49640
49681
|
return contentTimeBoundariesObserver;
|
|
49641
49682
|
}
|
|
49642
49683
|
/**
|
|
@@ -52026,7 +52067,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52026
52067
|
// Workaround to support Firefox autoplay on FF 42.
|
|
52027
52068
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
52028
52069
|
videoElement.preload = "auto";
|
|
52029
|
-
_this.version = /* PLAYER_VERSION */"3.30.1-dev.
|
|
52070
|
+
_this.version = /* PLAYER_VERSION */"3.30.1-dev.2023032800";
|
|
52030
52071
|
_this.log = log/* default */.Z;
|
|
52031
52072
|
_this.state = "STOPPED";
|
|
52032
52073
|
_this.videoElement = videoElement;
|
|
@@ -54342,7 +54383,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54342
54383
|
}]);
|
|
54343
54384
|
return Player;
|
|
54344
54385
|
}(event_emitter/* default */.Z);
|
|
54345
|
-
Player.version = /* PLAYER_VERSION */"3.30.1-dev.
|
|
54386
|
+
Player.version = /* PLAYER_VERSION */"3.30.1-dev.2023032800";
|
|
54346
54387
|
/* harmony default export */ var public_api = (Player);
|
|
54347
54388
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
54348
54389
|
/**
|