rx-player 3.31.0 → 3.31.1-dev.2023062700
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 -0
- package/VERSION +1 -1
- package/dist/_esm5.processed/core/api/public_api.js +5 -2
- package/dist/_esm5.processed/core/init/directfile_content_initializer.d.ts +60 -1
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +51 -7
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -2
- package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +2 -1
- package/dist/rx-player.js +71 -23
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/core/api/public_api.ts +4 -2
- package/src/core/init/directfile_content_initializer.ts +75 -15
- package/src/core/init/utils/initialize_content_decryption.ts +2 -2
- package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v3.31.1-dev.2023062700 (2023-06-27)
|
|
4
|
+
|
|
5
|
+
### Other improvements
|
|
6
|
+
|
|
7
|
+
- Do not load the last text segment if the current position goes after it as it is unnecessary [#1256]
|
|
8
|
+
- Set a better error message for when no `keySystems` option is set when playing an encrypted content
|
|
9
|
+
|
|
10
|
+
|
|
3
11
|
## v3.31.0 (2023-06-14)
|
|
4
12
|
|
|
5
13
|
### Features
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.31.
|
|
1
|
+
3.31.1-dev.2023062700
|
|
@@ -90,7 +90,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
90
90
|
// Workaround to support Firefox autoplay on FF 42.
|
|
91
91
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
92
92
|
videoElement.preload = "auto";
|
|
93
|
-
_this.version = /* PLAYER_VERSION */ "3.31.
|
|
93
|
+
_this.version = /* PLAYER_VERSION */ "3.31.1-dev.2023062700";
|
|
94
94
|
_this.log = log;
|
|
95
95
|
_this.state = "STOPPED";
|
|
96
96
|
_this.videoElement = videoElement;
|
|
@@ -435,6 +435,9 @@ var Player = /** @class */ (function (_super) {
|
|
|
435
435
|
this._priv_currentError = null;
|
|
436
436
|
throw new Error("DirectFile feature not activated in your build.");
|
|
437
437
|
}
|
|
438
|
+
else if (isNullOrUndefined(url)) {
|
|
439
|
+
throw new Error("No URL for a DirectFile content");
|
|
440
|
+
}
|
|
438
441
|
mediaElementTrackChoiceManager =
|
|
439
442
|
this._priv_initializeMediaElementTrackChoiceManager(defaultAudioTrack, defaultTextTrack, currentContentCanceller.signal);
|
|
440
443
|
if (currentContentCanceller.isUsed()) {
|
|
@@ -2428,5 +2431,5 @@ var Player = /** @class */ (function (_super) {
|
|
|
2428
2431
|
};
|
|
2429
2432
|
return Player;
|
|
2430
2433
|
}(EventEmitter));
|
|
2431
|
-
Player.version = /* PLAYER_VERSION */ "3.31.
|
|
2434
|
+
Player.version = /* PLAYER_VERSION */ "3.31.1-dev.2023062700";
|
|
2432
2435
|
export default Player;
|
|
@@ -18,21 +18,80 @@ import { IReadOnlySharedReference } from "../../utils/reference";
|
|
|
18
18
|
import { PlaybackObserver } from "../api";
|
|
19
19
|
import { ContentInitializer } from "./types";
|
|
20
20
|
import { IInitialTimeOptions } from "./utils/get_initial_time";
|
|
21
|
+
/**
|
|
22
|
+
* `ContentIntializer` which will load contents by putting their URL in the
|
|
23
|
+
* `src` attribute of the given HTMLMediaElement.
|
|
24
|
+
*
|
|
25
|
+
* Because such contents are mainly loaded by the browser, those (called
|
|
26
|
+
* "directfile" contents in the RxPlayer) needs a simpler logic in-JS when
|
|
27
|
+
* compared to a content that relies on the MSE API.
|
|
28
|
+
*
|
|
29
|
+
* @class DirectFileContentInitializer
|
|
30
|
+
*/
|
|
21
31
|
export default class DirectFileContentInitializer extends ContentInitializer {
|
|
32
|
+
/**
|
|
33
|
+
* Initial options given to the `DirectFileContentInitializer`.
|
|
34
|
+
*/
|
|
22
35
|
private _settings;
|
|
36
|
+
/**
|
|
37
|
+
* Allows to abort and clean everything the `DirectFileContentInitializer` is
|
|
38
|
+
* doing.
|
|
39
|
+
*/
|
|
23
40
|
private _initCanceller;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new `DirectFileContentInitializer` linked to the given settings.
|
|
43
|
+
* @param {Object} settings
|
|
44
|
+
*/
|
|
24
45
|
constructor(settings: IDirectFileOptions);
|
|
46
|
+
/**
|
|
47
|
+
* "Prepare" content so it can later be played by calling `start`.
|
|
48
|
+
*/
|
|
25
49
|
prepare(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Start playback of the content linked to this `DirectFileContentInitializer`
|
|
52
|
+
* on the given `HTMLMediaElement` and its associated `PlaybackObserver`.
|
|
53
|
+
* @param {HTMLMediaElement} mediaElement - HTMLMediaElement on which the
|
|
54
|
+
* content will be played.
|
|
55
|
+
* @param {Object} playbackObserver - Object regularly emitting playback
|
|
56
|
+
* information.
|
|
57
|
+
*/
|
|
26
58
|
start(mediaElement: HTMLMediaElement, playbackObserver: PlaybackObserver): void;
|
|
59
|
+
/**
|
|
60
|
+
* Update URL this `ContentIntializer` depends on.
|
|
61
|
+
* @param {Array.<string>|undefined} _urls
|
|
62
|
+
* @param {boolean} _refreshNow
|
|
63
|
+
*/
|
|
27
64
|
updateContentUrls(_urls: string[] | undefined, _refreshNow: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* Stop content and free all resources linked to this `ContentIntializer`.
|
|
67
|
+
*/
|
|
28
68
|
dispose(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Logic performed when a fatal error was triggered.
|
|
71
|
+
* @param {*} err - The fatal error in question.
|
|
72
|
+
*/
|
|
29
73
|
private _onFatalError;
|
|
74
|
+
/**
|
|
75
|
+
* Perform the initial seek (to begin playback at an initially-calculated
|
|
76
|
+
* position based on settings) and auto-play if needed when loaded.
|
|
77
|
+
* @param {HTMLMediaElement} mediaElement
|
|
78
|
+
* @param {Object} playbackObserver
|
|
79
|
+
*/
|
|
30
80
|
private _seekAndPlay;
|
|
31
81
|
}
|
|
82
|
+
/** Options used by the `DirectFileContentInitializer` */
|
|
32
83
|
export interface IDirectFileOptions {
|
|
84
|
+
/** If `true` we will play right after the content is considered "loaded". */
|
|
33
85
|
autoPlay: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Encryption-related settings. Can be left as an empty array if the content
|
|
88
|
+
* isn't encrypted.
|
|
89
|
+
*/
|
|
34
90
|
keySystems: IKeySystemOption[];
|
|
91
|
+
/** Communicate the playback rate wanted by the user. */
|
|
35
92
|
speed: IReadOnlySharedReference<number>;
|
|
93
|
+
/** Optional initial position to start at. */
|
|
36
94
|
startAt?: IInitialTimeOptions | undefined;
|
|
37
|
-
|
|
95
|
+
/** URL that should be played. */
|
|
96
|
+
url: string;
|
|
38
97
|
}
|
|
@@ -34,6 +34,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
34
34
|
*/
|
|
35
35
|
import { clearElementSrc } from "../../compat";
|
|
36
36
|
import log from "../../log";
|
|
37
|
+
import assert from "../../utils/assert";
|
|
37
38
|
import createSharedReference from "../../utils/reference";
|
|
38
39
|
import TaskCanceller from "../../utils/task_canceller";
|
|
39
40
|
import { ContentInitializer } from "./types";
|
|
@@ -42,25 +43,51 @@ import performInitialSeekAndPlay from "./utils/initial_seek_and_play";
|
|
|
42
43
|
import initializeContentDecryption from "./utils/initialize_content_decryption";
|
|
43
44
|
import RebufferingController from "./utils/rebuffering_controller";
|
|
44
45
|
import listenToMediaError from "./utils/throw_on_media_error";
|
|
46
|
+
/**
|
|
47
|
+
* `ContentIntializer` which will load contents by putting their URL in the
|
|
48
|
+
* `src` attribute of the given HTMLMediaElement.
|
|
49
|
+
*
|
|
50
|
+
* Because such contents are mainly loaded by the browser, those (called
|
|
51
|
+
* "directfile" contents in the RxPlayer) needs a simpler logic in-JS when
|
|
52
|
+
* compared to a content that relies on the MSE API.
|
|
53
|
+
*
|
|
54
|
+
* @class DirectFileContentInitializer
|
|
55
|
+
*/
|
|
45
56
|
var DirectFileContentInitializer = /** @class */ (function (_super) {
|
|
46
57
|
__extends(DirectFileContentInitializer, _super);
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new `DirectFileContentInitializer` linked to the given settings.
|
|
60
|
+
* @param {Object} settings
|
|
61
|
+
*/
|
|
47
62
|
function DirectFileContentInitializer(settings) {
|
|
48
63
|
var _this = _super.call(this) || this;
|
|
49
64
|
_this._settings = settings;
|
|
50
65
|
_this._initCanceller = new TaskCanceller();
|
|
51
66
|
return _this;
|
|
52
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* "Prepare" content so it can later be played by calling `start`.
|
|
70
|
+
*/
|
|
53
71
|
DirectFileContentInitializer.prototype.prepare = function () {
|
|
54
72
|
return; // Directfile contents do not have any preparation
|
|
55
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Start playback of the content linked to this `DirectFileContentInitializer`
|
|
76
|
+
* on the given `HTMLMediaElement` and its associated `PlaybackObserver`.
|
|
77
|
+
* @param {HTMLMediaElement} mediaElement - HTMLMediaElement on which the
|
|
78
|
+
* content will be played.
|
|
79
|
+
* @param {Object} playbackObserver - Object regularly emitting playback
|
|
80
|
+
* information.
|
|
81
|
+
*/
|
|
56
82
|
DirectFileContentInitializer.prototype.start = function (mediaElement, playbackObserver) {
|
|
57
83
|
var _this = this;
|
|
58
84
|
var cancelSignal = this._initCanceller.signal;
|
|
59
85
|
var _a = this._settings, keySystems = _a.keySystems, speed = _a.speed, url = _a.url;
|
|
60
86
|
clearElementSrc(mediaElement);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Create dummy encryption data emitter, as those are not sent from the
|
|
89
|
+
* RxPlayer for directfile contents.
|
|
90
|
+
*/
|
|
64
91
|
var decryptionRef = createSharedReference(null);
|
|
65
92
|
decryptionRef.finish();
|
|
66
93
|
var drmInitRef = initializeContentDecryption(mediaElement, keySystems, decryptionRef, {
|
|
@@ -89,7 +116,7 @@ var DirectFileContentInitializer = /** @class */ (function (_super) {
|
|
|
89
116
|
rebufferingController.start();
|
|
90
117
|
drmInitRef.onUpdate(function (evt, stopListeningToDrmUpdates) {
|
|
91
118
|
if (evt.initializationState.type === "uninitialized") {
|
|
92
|
-
return;
|
|
119
|
+
return; // nothing done yet
|
|
93
120
|
}
|
|
94
121
|
stopListeningToDrmUpdates();
|
|
95
122
|
// Start everything! (Just put the URL in the element's src).
|
|
@@ -104,26 +131,43 @@ var DirectFileContentInitializer = /** @class */ (function (_super) {
|
|
|
104
131
|
if (newDrmStatus.initializationState.type === "initialized") {
|
|
105
132
|
stopListeningToDrmUpdatesAgain();
|
|
106
133
|
_this._seekAndPlay(mediaElement, playbackObserver);
|
|
107
|
-
return;
|
|
108
134
|
}
|
|
109
135
|
}, { emitCurrentValue: true, clearSignal: cancelSignal });
|
|
110
136
|
}
|
|
111
137
|
else {
|
|
138
|
+
assert(evt.initializationState.type === "initialized");
|
|
112
139
|
_this._seekAndPlay(mediaElement, playbackObserver);
|
|
113
|
-
return;
|
|
114
140
|
}
|
|
115
141
|
}, { emitCurrentValue: true, clearSignal: cancelSignal });
|
|
116
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* Update URL this `ContentIntializer` depends on.
|
|
145
|
+
* @param {Array.<string>|undefined} _urls
|
|
146
|
+
* @param {boolean} _refreshNow
|
|
147
|
+
*/
|
|
117
148
|
DirectFileContentInitializer.prototype.updateContentUrls = function (_urls, _refreshNow) {
|
|
118
149
|
throw new Error("Cannot update content URL of directfile contents");
|
|
119
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* Stop content and free all resources linked to this `ContentIntializer`.
|
|
153
|
+
*/
|
|
120
154
|
DirectFileContentInitializer.prototype.dispose = function () {
|
|
121
155
|
this._initCanceller.cancel();
|
|
122
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* Logic performed when a fatal error was triggered.
|
|
159
|
+
* @param {*} err - The fatal error in question.
|
|
160
|
+
*/
|
|
123
161
|
DirectFileContentInitializer.prototype._onFatalError = function (err) {
|
|
124
162
|
this._initCanceller.cancel();
|
|
125
163
|
this.trigger("error", err);
|
|
126
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Perform the initial seek (to begin playback at an initially-calculated
|
|
167
|
+
* position based on settings) and auto-play if needed when loaded.
|
|
168
|
+
* @param {HTMLMediaElement} mediaElement
|
|
169
|
+
* @param {Object} playbackObserver
|
|
170
|
+
*/
|
|
127
171
|
DirectFileContentInitializer.prototype._seekAndPlay = function (mediaElement, playbackObserver) {
|
|
128
172
|
var _this = this;
|
|
129
173
|
var cancelSignal = this._initCanceller.signal;
|
|
@@ -156,7 +200,7 @@ export default DirectFileContentInitializer;
|
|
|
156
200
|
/**
|
|
157
201
|
* calculate initial time as a position in seconds.
|
|
158
202
|
* @param {HTMLMediaElement} mediaElement
|
|
159
|
-
* @param {Object|undefined} startAt
|
|
203
|
+
* @param {Object|undefined} [startAt]
|
|
160
204
|
* @returns {number}
|
|
161
205
|
*/
|
|
162
206
|
function getDirectFileInitialTime(mediaElement, startAt) {
|
|
@@ -34,8 +34,8 @@ export default function initializeContentDecryption(mediaElement, keySystems, pr
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
stopListening();
|
|
37
|
-
log.error("Init: Encrypted event but
|
|
38
|
-
var err = new EncryptedMediaError("MEDIA_IS_ENCRYPTED_ERROR", "
|
|
37
|
+
log.error("Init: Encrypted event but no `keySystems` given");
|
|
38
|
+
var err = new EncryptedMediaError("MEDIA_IS_ENCRYPTED_ERROR", "no `keySystems` given.");
|
|
39
39
|
callbacks.onError(err);
|
|
40
40
|
}, { clearSignal: cancelSignal });
|
|
41
41
|
var ref = createSharedReference({
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import config from "../../../../config";
|
|
17
17
|
import isNullOrUndefined from "../../../../utils/is_null_or_undefined";
|
|
18
|
-
import { SegmentBufferOperation, } from "../../../segment_buffers";
|
|
18
|
+
import SegmentBuffersStore, { SegmentBufferOperation, } from "../../../segment_buffers";
|
|
19
19
|
import checkForDiscontinuity from "./check_for_discontinuity";
|
|
20
20
|
import getNeededSegments from "./get_needed_segments";
|
|
21
21
|
import getSegmentPriority from "./get_segment_priority";
|
|
@@ -116,6 +116,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
116
116
|
// avoid ending the last Period - and by extension the content - with a
|
|
117
117
|
// segment which isn't the last one.
|
|
118
118
|
if (!isNullOrUndefined(lastIndexPosition) &&
|
|
119
|
+
SegmentBuffersStore.isNative(content.adaptation.type) &&
|
|
119
120
|
initialWantedTime >= lastIndexPosition &&
|
|
120
121
|
representationIndex.isInitialized() &&
|
|
121
122
|
representationIndex.isFinished() &&
|
package/dist/rx-player.js
CHANGED
|
@@ -9175,11 +9175,12 @@ var currentMediaState = new WeakMap();
|
|
|
9175
9175
|
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4578);
|
|
9176
9176
|
/* harmony import */ var _compat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5767);
|
|
9177
9177
|
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3887);
|
|
9178
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(811);
|
|
9178
9179
|
/* harmony import */ var _utils_reference__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5095);
|
|
9179
9180
|
/* harmony import */ var _utils_task_canceller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(288);
|
|
9180
|
-
/* harmony import */ var
|
|
9181
|
-
/* harmony import */ var
|
|
9182
|
-
/* harmony import */ var
|
|
9181
|
+
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(379);
|
|
9182
|
+
/* harmony import */ var _utils_get_loaded_reference__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1757);
|
|
9183
|
+
/* harmony import */ var _utils_initial_seek_and_play__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(8833);
|
|
9183
9184
|
/* harmony import */ var _utils_initialize_content_decryption__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8799);
|
|
9184
9185
|
/* harmony import */ var _utils_rebuffering_controller__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6199);
|
|
9185
9186
|
/* harmony import */ var _utils_throw_on_media_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4576);
|
|
@@ -9213,8 +9214,23 @@ var currentMediaState = new WeakMap();
|
|
|
9213
9214
|
|
|
9214
9215
|
|
|
9215
9216
|
|
|
9217
|
+
|
|
9218
|
+
/**
|
|
9219
|
+
* `ContentIntializer` which will load contents by putting their URL in the
|
|
9220
|
+
* `src` attribute of the given HTMLMediaElement.
|
|
9221
|
+
*
|
|
9222
|
+
* Because such contents are mainly loaded by the browser, those (called
|
|
9223
|
+
* "directfile" contents in the RxPlayer) needs a simpler logic in-JS when
|
|
9224
|
+
* compared to a content that relies on the MSE API.
|
|
9225
|
+
*
|
|
9226
|
+
* @class DirectFileContentInitializer
|
|
9227
|
+
*/
|
|
9216
9228
|
var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
9217
9229
|
(0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(DirectFileContentInitializer, _ContentInitializer);
|
|
9230
|
+
/**
|
|
9231
|
+
* Creates a new `DirectFileContentInitializer` linked to the given settings.
|
|
9232
|
+
* @param {Object} settings
|
|
9233
|
+
*/
|
|
9218
9234
|
function DirectFileContentInitializer(settings) {
|
|
9219
9235
|
var _this;
|
|
9220
9236
|
_this = _ContentInitializer.call(this) || this;
|
|
@@ -9222,10 +9238,21 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9222
9238
|
_this._initCanceller = new _utils_task_canceller__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .ZP();
|
|
9223
9239
|
return _this;
|
|
9224
9240
|
}
|
|
9241
|
+
/**
|
|
9242
|
+
* "Prepare" content so it can later be played by calling `start`.
|
|
9243
|
+
*/
|
|
9225
9244
|
var _proto = DirectFileContentInitializer.prototype;
|
|
9226
9245
|
_proto.prepare = function prepare() {
|
|
9227
9246
|
return; // Directfile contents do not have any preparation
|
|
9228
|
-
}
|
|
9247
|
+
}
|
|
9248
|
+
/**
|
|
9249
|
+
* Start playback of the content linked to this `DirectFileContentInitializer`
|
|
9250
|
+
* on the given `HTMLMediaElement` and its associated `PlaybackObserver`.
|
|
9251
|
+
* @param {HTMLMediaElement} mediaElement - HTMLMediaElement on which the
|
|
9252
|
+
* content will be played.
|
|
9253
|
+
* @param {Object} playbackObserver - Object regularly emitting playback
|
|
9254
|
+
* information.
|
|
9255
|
+
*/;
|
|
9229
9256
|
_proto.start = function start(mediaElement, playbackObserver) {
|
|
9230
9257
|
var _this2 = this;
|
|
9231
9258
|
var cancelSignal = this._initCanceller.signal;
|
|
@@ -9234,9 +9261,10 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9234
9261
|
speed = _this$_settings.speed,
|
|
9235
9262
|
url = _this$_settings.url;
|
|
9236
9263
|
(0,_compat__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(mediaElement);
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9264
|
+
/**
|
|
9265
|
+
* Create dummy encryption data emitter, as those are not sent from the
|
|
9266
|
+
* RxPlayer for directfile contents.
|
|
9267
|
+
*/
|
|
9240
9268
|
var decryptionRef = (0,_utils_reference__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(null);
|
|
9241
9269
|
decryptionRef.finish();
|
|
9242
9270
|
var drmInitRef = (0,_utils_initialize_content_decryption__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(mediaElement, keySystems, decryptionRef, {
|
|
@@ -9271,8 +9299,9 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9271
9299
|
rebufferingController.start();
|
|
9272
9300
|
drmInitRef.onUpdate(function (evt, stopListeningToDrmUpdates) {
|
|
9273
9301
|
if (evt.initializationState.type === "uninitialized") {
|
|
9274
|
-
return;
|
|
9302
|
+
return; // nothing done yet
|
|
9275
9303
|
}
|
|
9304
|
+
|
|
9276
9305
|
stopListeningToDrmUpdates();
|
|
9277
9306
|
// Start everything! (Just put the URL in the element's src).
|
|
9278
9307
|
_log__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.info("Setting URL to HTMLMediaElement", url);
|
|
@@ -9286,31 +9315,48 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9286
9315
|
if (newDrmStatus.initializationState.type === "initialized") {
|
|
9287
9316
|
stopListeningToDrmUpdatesAgain();
|
|
9288
9317
|
_this2._seekAndPlay(mediaElement, playbackObserver);
|
|
9289
|
-
return;
|
|
9290
9318
|
}
|
|
9291
9319
|
}, {
|
|
9292
9320
|
emitCurrentValue: true,
|
|
9293
9321
|
clearSignal: cancelSignal
|
|
9294
9322
|
});
|
|
9295
9323
|
} else {
|
|
9324
|
+
(0,_utils_assert__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(evt.initializationState.type === "initialized");
|
|
9296
9325
|
_this2._seekAndPlay(mediaElement, playbackObserver);
|
|
9297
|
-
return;
|
|
9298
9326
|
}
|
|
9299
9327
|
}, {
|
|
9300
9328
|
emitCurrentValue: true,
|
|
9301
9329
|
clearSignal: cancelSignal
|
|
9302
9330
|
});
|
|
9303
|
-
}
|
|
9331
|
+
}
|
|
9332
|
+
/**
|
|
9333
|
+
* Update URL this `ContentIntializer` depends on.
|
|
9334
|
+
* @param {Array.<string>|undefined} _urls
|
|
9335
|
+
* @param {boolean} _refreshNow
|
|
9336
|
+
*/;
|
|
9304
9337
|
_proto.updateContentUrls = function updateContentUrls(_urls, _refreshNow) {
|
|
9305
9338
|
throw new Error("Cannot update content URL of directfile contents");
|
|
9306
|
-
}
|
|
9339
|
+
}
|
|
9340
|
+
/**
|
|
9341
|
+
* Stop content and free all resources linked to this `ContentIntializer`.
|
|
9342
|
+
*/;
|
|
9307
9343
|
_proto.dispose = function dispose() {
|
|
9308
9344
|
this._initCanceller.cancel();
|
|
9309
|
-
}
|
|
9345
|
+
}
|
|
9346
|
+
/**
|
|
9347
|
+
* Logic performed when a fatal error was triggered.
|
|
9348
|
+
* @param {*} err - The fatal error in question.
|
|
9349
|
+
*/;
|
|
9310
9350
|
_proto._onFatalError = function _onFatalError(err) {
|
|
9311
9351
|
this._initCanceller.cancel();
|
|
9312
9352
|
this.trigger("error", err);
|
|
9313
|
-
}
|
|
9353
|
+
}
|
|
9354
|
+
/**
|
|
9355
|
+
* Perform the initial seek (to begin playback at an initially-calculated
|
|
9356
|
+
* position based on settings) and auto-play if needed when loaded.
|
|
9357
|
+
* @param {HTMLMediaElement} mediaElement
|
|
9358
|
+
* @param {Object} playbackObserver
|
|
9359
|
+
*/;
|
|
9314
9360
|
_proto._seekAndPlay = function _seekAndPlay(mediaElement, playbackObserver) {
|
|
9315
9361
|
var _this3 = this;
|
|
9316
9362
|
var cancelSignal = this._initCanceller.signal;
|
|
@@ -9323,10 +9369,10 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9323
9369
|
_log__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.debug("Init: Initial time calculated:", initTime);
|
|
9324
9370
|
return initTime;
|
|
9325
9371
|
};
|
|
9326
|
-
(0,
|
|
9372
|
+
(0,_utils_initial_seek_and_play__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)(mediaElement, playbackObserver, initialTime, autoPlay, function (err) {
|
|
9327
9373
|
return _this3.trigger("warning", err);
|
|
9328
9374
|
}, cancelSignal).autoPlayResult.then(function () {
|
|
9329
|
-
return (0,
|
|
9375
|
+
return (0,_utils_get_loaded_reference__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)(playbackObserver, mediaElement, true, cancelSignal).onUpdate(function (isLoaded, stopListening) {
|
|
9330
9376
|
if (isLoaded) {
|
|
9331
9377
|
stopListening();
|
|
9332
9378
|
_this3.trigger("loaded", {
|
|
@@ -9344,11 +9390,11 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9344
9390
|
});
|
|
9345
9391
|
};
|
|
9346
9392
|
return DirectFileContentInitializer;
|
|
9347
|
-
}(
|
|
9393
|
+
}(_types__WEBPACK_IMPORTED_MODULE_11__/* .ContentInitializer */ .K);
|
|
9348
9394
|
/**
|
|
9349
9395
|
* calculate initial time as a position in seconds.
|
|
9350
9396
|
* @param {HTMLMediaElement} mediaElement
|
|
9351
|
-
* @param {Object|undefined} startAt
|
|
9397
|
+
* @param {Object|undefined} [startAt]
|
|
9352
9398
|
* @returns {number}
|
|
9353
9399
|
*/
|
|
9354
9400
|
|
|
@@ -9773,8 +9819,8 @@ function initializeContentDecryption(mediaElement, keySystems, protectionRef, ca
|
|
|
9773
9819
|
return;
|
|
9774
9820
|
}
|
|
9775
9821
|
stopListening();
|
|
9776
|
-
log/* default */.Z.error("Init: Encrypted event but
|
|
9777
|
-
var err = new encrypted_media_error/* default */.Z("MEDIA_IS_ENCRYPTED_ERROR", "
|
|
9822
|
+
log/* default */.Z.error("Init: Encrypted event but no `keySystems` given");
|
|
9823
|
+
var err = new encrypted_media_error/* default */.Z("MEDIA_IS_ENCRYPTED_ERROR", "no `keySystems` given.");
|
|
9778
9824
|
callbacks.onError(err);
|
|
9779
9825
|
}, {
|
|
9780
9826
|
clearSignal: cancelSignal
|
|
@@ -45041,7 +45087,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
|
|
|
45041
45087
|
// In that case, we want to actually request at least the last segment to
|
|
45042
45088
|
// avoid ending the last Period - and by extension the content - with a
|
|
45043
45089
|
// segment which isn't the last one.
|
|
45044
|
-
if (!(0,is_null_or_undefined/* default */.Z)(lastIndexPosition) && initialWantedTime >= lastIndexPosition && representationIndex.isInitialized() && representationIndex.isFinished() && isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime)) {
|
|
45090
|
+
if (!(0,is_null_or_undefined/* default */.Z)(lastIndexPosition) && segment_buffers.isNative(content.adaptation.type) && initialWantedTime >= lastIndexPosition && representationIndex.isInitialized() && representationIndex.isFinished() && isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime)) {
|
|
45045
45091
|
wantedStartPosition = lastIndexPosition - 1;
|
|
45046
45092
|
} else {
|
|
45047
45093
|
wantedStartPosition = initialWantedTime - 0.1;
|
|
@@ -52155,7 +52201,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52155
52201
|
// Workaround to support Firefox autoplay on FF 42.
|
|
52156
52202
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
52157
52203
|
videoElement.preload = "auto";
|
|
52158
|
-
_this.version = /* PLAYER_VERSION */"3.31.
|
|
52204
|
+
_this.version = /* PLAYER_VERSION */"3.31.1-dev.2023062700";
|
|
52159
52205
|
_this.log = log/* default */.Z;
|
|
52160
52206
|
_this.state = "STOPPED";
|
|
52161
52207
|
_this.videoElement = videoElement;
|
|
@@ -52512,6 +52558,8 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52512
52558
|
this.stop();
|
|
52513
52559
|
this._priv_currentError = null;
|
|
52514
52560
|
throw new Error("DirectFile feature not activated in your build.");
|
|
52561
|
+
} else if ((0,is_null_or_undefined/* default */.Z)(url)) {
|
|
52562
|
+
throw new Error("No URL for a DirectFile content");
|
|
52515
52563
|
}
|
|
52516
52564
|
mediaElementTrackChoiceManager = this._priv_initializeMediaElementTrackChoiceManager(defaultAudioTrack, defaultTextTrack, currentContentCanceller.signal);
|
|
52517
52565
|
if (currentContentCanceller.isUsed()) {
|
|
@@ -54564,7 +54612,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54564
54612
|
}]);
|
|
54565
54613
|
return Player;
|
|
54566
54614
|
}(event_emitter/* default */.Z);
|
|
54567
|
-
Player.version = /* PLAYER_VERSION */"3.31.
|
|
54615
|
+
Player.version = /* PLAYER_VERSION */"3.31.1-dev.2023062700";
|
|
54568
54616
|
/* harmony default export */ var public_api = (Player);
|
|
54569
54617
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
54570
54618
|
/**
|