rx-player 3.29.0-dev.2022090500 → 3.29.0-dev.2022091600
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 +5 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/core/api/option_utils.js +7 -11
- package/dist/_esm5.processed/core/api/public_api.d.ts +4 -4
- package/dist/_esm5.processed/core/api/public_api.js +18 -19
- package/dist/_esm5.processed/core/api/{media_element_track_choice_manager.d.ts → tracks_management/media_element_track_choice_manager.d.ts} +2 -2
- package/dist/_esm5.processed/core/api/{media_element_track_choice_manager.js → tracks_management/media_element_track_choice_manager.js} +7 -4
- package/dist/_esm5.processed/core/api/{track_choice_manager.d.ts → tracks_management/track_choice_manager.d.ts} +2 -2
- package/dist/_esm5.processed/core/api/{track_choice_manager.js → tracks_management/track_choice_manager.js} +7 -7
- package/dist/_esm5.processed/core/api/{emit_seek_events.d.ts → utils.d.ts} +24 -1
- package/dist/_esm5.processed/core/api/{emit_seek_events.js → utils.js} +32 -1
- package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +26 -0
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +101 -9
- package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +15 -18
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +9 -7
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +19 -22
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +87 -16
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +1 -2
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +1 -2
- package/dist/_esm5.processed/core/fetchers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/index.d.ts +2 -3
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.d.ts +9 -9
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +17 -15
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +33 -40
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +156 -153
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.d.ts +145 -0
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +325 -0
- package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.d.ts +2 -2
- package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +3 -3
- package/dist/_esm5.processed/core/init/create_media_source.d.ts +10 -0
- package/dist/_esm5.processed/core/init/create_media_source.js +1 -1
- package/dist/_esm5.processed/core/init/stall_avoider.d.ts +2 -1
- package/dist/_esm5.processed/core/init/stall_avoider.js +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -3
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +6 -2
- package/dist/_esm5.processed/core/stream/orchestrator/{get_blacklisted_ranges.d.ts → get_time_ranges_for_content.d.ts} +1 -1
- package/dist/_esm5.processed/core/stream/orchestrator/{get_blacklisted_ranges.js → get_time_ranges_for_content.js} +1 -1
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +61 -19
- package/dist/_esm5.processed/core/stream/representation/downloading_queue.d.ts +8 -4
- package/dist/_esm5.processed/core/stream/representation/downloading_queue.js +200 -83
- package/dist/_esm5.processed/core/stream/types.d.ts +3 -1
- package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +6 -1
- package/dist/_esm5.processed/errors/encrypted_media_error.js +4 -5
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +26 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +60 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +6 -5
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +40 -9
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +3 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +7 -14
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.d.ts +1 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/{thumbnail_loader.d.ts → video_thumbnail_loader.d.ts} +1 -13
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +331 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +1 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +1 -2
- package/dist/_esm5.processed/features/initialize_features.js +2 -1
- package/dist/_esm5.processed/features/list/directfile.js +1 -1
- package/dist/_esm5.processed/features/types.d.ts +1 -1
- package/dist/_esm5.processed/manifest/index.d.ts +2 -2
- package/dist/_esm5.processed/public_types.d.ts +47 -0
- package/dist/_esm5.processed/utils/reference.d.ts +23 -3
- package/dist/_esm5.processed/utils/reference.js +23 -2
- package/dist/rx-player.js +1253 -1014
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/core/api/README.md +1 -1
- package/src/core/api/__tests__/{get_player_state.test.ts → utils.test.ts} +1 -1
- package/src/core/api/option_utils.ts +1 -5
- package/src/core/api/public_api.ts +15 -13
- package/src/core/api/{__tests__ → tracks_management/__tests__}/media_element_track_choice_manager.test.ts +0 -0
- package/src/core/api/{media_element_track_choice_manager.ts → tracks_management/media_element_track_choice_manager.ts} +10 -7
- package/src/core/api/{track_choice_manager.ts → tracks_management/track_choice_manager.ts} +9 -9
- package/src/core/api/{get_player_state.ts → utils.ts} +62 -11
- package/src/core/decrypt/content_decryptor.ts +112 -13
- package/src/core/decrypt/session_events_listener.ts +34 -30
- package/src/core/decrypt/utils/check_key_statuses.ts +89 -45
- package/src/core/decrypt/utils/persistent_sessions_store.ts +1 -2
- package/src/core/fetchers/index.ts +0 -12
- package/src/core/fetchers/segment/__tests__/task_prioritizer.test.ts +763 -0
- package/src/core/fetchers/segment/index.ts +0 -12
- package/src/core/fetchers/segment/prioritized_segment_fetcher.ts +40 -47
- package/src/core/fetchers/segment/segment_fetcher.ts +249 -268
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +6 -7
- package/src/core/fetchers/segment/task_prioritizer.ts +460 -0
- package/src/core/fetchers/utils/try_urls_with_backoff.ts +3 -3
- package/src/core/init/create_media_source.ts +1 -1
- package/src/core/init/stall_avoider.ts +2 -1
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +1 -1
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -3
- package/src/core/segment_buffers/implementations/types.ts +6 -2
- package/src/core/stream/orchestrator/{get_blacklisted_ranges.ts → get_time_ranges_for_content.ts} +1 -1
- package/src/core/stream/orchestrator/stream_orchestrator.ts +115 -56
- package/src/core/stream/representation/downloading_queue.ts +269 -142
- package/src/core/stream/types.ts +3 -1
- package/src/errors/encrypted_media_error.ts +20 -1
- package/src/experimental/tools/VideoThumbnailLoader/index.ts +1 -1
- package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +74 -0
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +50 -16
- package/src/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.ts +14 -21
- package/src/experimental/tools/VideoThumbnailLoader/types.ts +7 -4
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +407 -0
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.ts +1 -2
- package/src/features/__tests__/initialize_features.test.ts +3 -1
- package/src/features/initialize_features.ts +2 -1
- package/src/features/list/__tests__/directfile.test.ts +1 -1
- package/src/features/list/directfile.ts +1 -1
- package/src/features/types.ts +1 -1
- package/src/manifest/index.ts +2 -0
- package/src/public_types.ts +53 -0
- package/src/utils/reference.ts +58 -4
- package/dist/_esm5.processed/core/api/get_player_state.d.ts +0 -28
- package/dist/_esm5.processed/core/api/get_player_state.js +0 -56
- package/dist/_esm5.processed/core/fetchers/segment/prioritizer.d.ts +0 -232
- package/dist/_esm5.processed/core/fetchers/segment/prioritizer.js +0 -422
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/create_request.d.ts +0 -29
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/create_request.js +0 -68
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_complete_segment_id.d.ts +0 -24
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_complete_segment_id.js +0 -29
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_content_infos.d.ts +0 -25
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_content_infos.js +0 -40
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.d.ts +0 -33
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.js +0 -124
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_segments.d.ts +0 -17
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_segments.js +0 -41
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +0 -22
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.js +0 -21
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +0 -212
- package/src/core/api/emit_seek_events.ts +0 -66
- package/src/core/fetchers/segment/__tests__/prioritizer.test.ts +0 -962
- package/src/core/fetchers/segment/prioritizer.ts +0 -558
- package/src/experimental/tools/VideoThumbnailLoader/create_request.ts +0 -113
- package/src/experimental/tools/VideoThumbnailLoader/get_complete_segment_id.ts +0 -34
- package/src/experimental/tools/VideoThumbnailLoader/get_content_infos.ts +0 -48
- package/src/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.ts +0 -171
- package/src/experimental/tools/VideoThumbnailLoader/load_segments.ts +0 -69
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +0 -48
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +0 -311
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.29.0-dev.
|
|
3
|
+
## v3.29.0-dev.2022091600 (2022-09-16)
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
7
|
- add `networkConfig.segmentRequestTimeout` and `networkConfig.manifestRequestTimeout` options to loadVideo to configure the timeout of respectively segment and manifest requests [#1156]
|
|
8
8
|
- add `timeout` property to the first argument communicated to a `segmentLoader` (from `loadVideo`'s `transportOptions`) [#1156]
|
|
9
9
|
- add `timeout` property to a new third argument communicated to a `manifestLoader` (from `loadVideo`'s `transportOptions`) [#1156]
|
|
10
|
+
- add `keySystems[].onKeyExpiration` to `loadVideo` options to configure the behavior the RxPlayer should have on key expiration [#1157]
|
|
11
|
+
- add `keyStatuses` property to an `EncryptedMediaError` with the `KEY_STATUS_CHANGE_ERROR` code to communicate which key id and key statuses caused issues. [#1157]
|
|
10
12
|
|
|
11
13
|
### Bug fixes
|
|
12
14
|
|
|
13
15
|
- Compat/Directfile: Fix an issue with LG TV when playing multiple directfile contents with the `stopAtEnd` player option set to `true` [#1154]
|
|
14
16
|
- Compat: To work around an issue on LG TVs, also specify a request timeout manually through a `setTimeout` call when XMLHttpRequests are created for Manifest and segment requests [#1152]
|
|
15
17
|
- Compat: Fix issue with Samsung TVs where starting playback on a discontinuity could lead to infinite rebuffering [#1140]
|
|
18
|
+
- Compat: For `"directfile"` contents, also consider `AudioTrack` with a `description` (without an "s") as audio-description audio tracks to work-around what seems to be a Safari typo [#1160]
|
|
16
19
|
- Better handle valid reverse playback use cases by not skipping gaps when the playback rate has been set to `0` or a negative value [#1138]
|
|
17
20
|
- DRM: When using persistent licenses, create new MediaKeySession when `load` resolves with `false`, instead of relying the same, to fix issues with such persistent sessions [#1139]
|
|
18
21
|
|
|
19
22
|
### Other improvements
|
|
20
23
|
|
|
21
24
|
- In the experimental "local" transport, add `incomingRanges` property to signal the time ranges of remaining data, allowing better discontinuity handling and duration estimates for sill-loading dowloaded contents [#1151]
|
|
25
|
+
- Only send through `"warning"` events, just one `EncryptedMediaError` with a `KEY_STATUS_CHANGE_ERROR` code when multiple ones arises at the same time [#1157]
|
|
22
26
|
|
|
23
27
|
## v3.28.0 (2022-07-12)
|
|
24
28
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.29.0-dev.
|
|
1
|
+
3.29.0-dev.2022091600
|
|
@@ -269,14 +269,14 @@ function checkReloadOptions(options) {
|
|
|
269
269
|
* @returns {Object}
|
|
270
270
|
*/
|
|
271
271
|
function parseLoadVideoOptions(options) {
|
|
272
|
-
var _a, _b, _c, _d, _e, _f;
|
|
272
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
273
273
|
var url;
|
|
274
274
|
var transport;
|
|
275
275
|
var keySystems;
|
|
276
276
|
var textTrackMode;
|
|
277
277
|
var textTrackElement;
|
|
278
278
|
var startAt;
|
|
279
|
-
var
|
|
279
|
+
var _h = config.getCurrent(), DEFAULT_AUDIO_TRACK_SWITCHING_MODE = _h.DEFAULT_AUDIO_TRACK_SWITCHING_MODE, DEFAULT_AUTO_PLAY = _h.DEFAULT_AUTO_PLAY, DEFAULT_CODEC_SWITCHING_BEHAVIOR = _h.DEFAULT_CODEC_SWITCHING_BEHAVIOR, DEFAULT_ENABLE_FAST_SWITCHING = _h.DEFAULT_ENABLE_FAST_SWITCHING, DEFAULT_MANUAL_BITRATE_SWITCHING_MODE = _h.DEFAULT_MANUAL_BITRATE_SWITCHING_MODE, DEFAULT_SHOW_NATIVE_SUBTITLE = _h.DEFAULT_SHOW_NATIVE_SUBTITLE, DEFAULT_TEXT_TRACK_MODE = _h.DEFAULT_TEXT_TRACK_MODE;
|
|
280
280
|
if (isNullOrUndefined(options)) {
|
|
281
281
|
throw new Error("No option set on loadVideo");
|
|
282
282
|
}
|
|
@@ -363,8 +363,8 @@ function parseLoadVideoOptions(options) {
|
|
|
363
363
|
"Please use the `TextTrackRenderer` tool instead.");
|
|
364
364
|
var supplementaryTextTracks = Array.isArray(options.supplementaryTextTracks) ?
|
|
365
365
|
options.supplementaryTextTracks : [options.supplementaryTextTracks];
|
|
366
|
-
for (var
|
|
367
|
-
var supplementaryTextTrack = supplementaryTextTracks_1[
|
|
366
|
+
for (var _j = 0, supplementaryTextTracks_1 = supplementaryTextTracks; _j < supplementaryTextTracks_1.length; _j++) {
|
|
367
|
+
var supplementaryTextTrack = supplementaryTextTracks_1[_j];
|
|
368
368
|
if (typeof supplementaryTextTrack.language !== "string" ||
|
|
369
369
|
typeof supplementaryTextTrack.mimeType !== "string" ||
|
|
370
370
|
typeof supplementaryTextTrack.url !== "string") {
|
|
@@ -379,8 +379,8 @@ function parseLoadVideoOptions(options) {
|
|
|
379
379
|
"Please use the `parseBifThumbnails` tool instead.");
|
|
380
380
|
var supplementaryImageTracks = Array.isArray(options.supplementaryImageTracks) ?
|
|
381
381
|
options.supplementaryImageTracks : [options.supplementaryImageTracks];
|
|
382
|
-
for (var
|
|
383
|
-
var supplementaryImageTrack = supplementaryImageTracks_1[
|
|
382
|
+
for (var _k = 0, supplementaryImageTracks_1 = supplementaryImageTracks; _k < supplementaryImageTracks_1.length; _k++) {
|
|
383
|
+
var supplementaryImageTrack = supplementaryImageTracks_1[_k];
|
|
384
384
|
if (typeof supplementaryImageTrack.mimeType !== "string" ||
|
|
385
385
|
typeof supplementaryImageTrack.url !== "string") {
|
|
386
386
|
throw new Error("Invalid supplementary image track given. " +
|
|
@@ -448,11 +448,7 @@ function parseLoadVideoOptions(options) {
|
|
|
448
448
|
startAt = options.startAt;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
var networkConfig =
|
|
452
|
-
{} :
|
|
453
|
-
{ manifestRetry: options.networkConfig.manifestRetry,
|
|
454
|
-
offlineRetry: options.networkConfig.offlineRetry,
|
|
455
|
-
segmentRetry: options.networkConfig.segmentRetry };
|
|
451
|
+
var networkConfig = (_g = options.networkConfig) !== null && _g !== void 0 ? _g : {};
|
|
456
452
|
// TODO without cast
|
|
457
453
|
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
458
454
|
return { autoPlay: autoPlay, defaultAudioTrack: defaultAudioTrack, defaultTextTrack: defaultTextTrack, enableFastSwitching: enableFastSwitching, hideNativeSubtitle: hideNativeSubtitle, keySystems: keySystems, initialManifest: initialManifest, lowLatencyMode: lowLatencyMode, manualBitrateSwitchingMode: manualBitrateSwitchingMode, audioTrackSwitchingMode: audioTrackSwitchingMode, minimumManifestUpdateInterval: minimumManifestUpdateInterval, networkConfig: networkConfig, onCodecSwitch: onCodecSwitch, startAt: startAt, textTrackElement: textTrackElement, textTrackMode: textTrackMode, transport: transport, transportOptions: transportOptions, url: url };
|
|
@@ -38,7 +38,7 @@ declare class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
38
38
|
readonly log: Logger;
|
|
39
39
|
/**
|
|
40
40
|
* Current state of the RxPlayer.
|
|
41
|
-
* Please use `
|
|
41
|
+
* Please use `getLoadedContentState()` instead.
|
|
42
42
|
*/
|
|
43
43
|
state: IPlayerState;
|
|
44
44
|
/**
|
|
@@ -351,9 +351,9 @@ declare class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
351
351
|
*
|
|
352
352
|
* Note that switching to or getting out of a trickmode video track may
|
|
353
353
|
* lead to the player being a brief instant in a `"RELOADING"` state (notified
|
|
354
|
-
* through `playerStateChange` events and the `
|
|
355
|
-
* that state, a black screen may be displayed and multiple RxPlayer
|
|
356
|
-
* not be usable.
|
|
354
|
+
* through `playerStateChange` events and the `getLoadedContentState` method).
|
|
355
|
+
* When in that state, a black screen may be displayed and multiple RxPlayer
|
|
356
|
+
* APIs will not be usable.
|
|
357
357
|
*
|
|
358
358
|
* @param {Number} rate
|
|
359
359
|
* @param {Object} opts
|
|
@@ -63,11 +63,10 @@ import warnOnce from "../../utils/warn_once";
|
|
|
63
63
|
import { clearOnStop, disposeDecryptionResources, getCurrentKeySystem, } from "../decrypt";
|
|
64
64
|
import { ManifestFetcher, SegmentFetcherCreator, } from "../fetchers";
|
|
65
65
|
import initializeMediaSourcePlayback from "../init";
|
|
66
|
-
import emitSeekEvents from "./emit_seek_events";
|
|
67
|
-
import getPlayerState, { PLAYER_STATES, } from "./get_player_state";
|
|
68
66
|
import { checkReloadOptions, parseConstructorOptions, parseLoadVideoOptions, } from "./option_utils";
|
|
69
67
|
import PlaybackObserver from "./playback_observer";
|
|
70
|
-
import TrackChoiceManager from "./track_choice_manager";
|
|
68
|
+
import TrackChoiceManager from "./tracks_management/track_choice_manager";
|
|
69
|
+
import { emitSeekEvents, getLoadedContentState, } from "./utils";
|
|
71
70
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
72
71
|
var getPageActivityRef = events.getPageActivityRef, getPictureOnPictureStateRef = events.getPictureOnPictureStateRef, getVideoVisibilityRef = events.getVideoVisibilityRef, getVideoWidthRef = events.getVideoWidthRef, onFullscreenChange$ = events.onFullscreenChange$, onTextTrackChanges$ = events.onTextTrackChanges$;
|
|
73
72
|
/**
|
|
@@ -88,7 +87,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
88
87
|
// Workaround to support Firefox autoplay on FF 42.
|
|
89
88
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
90
89
|
videoElement.preload = "auto";
|
|
91
|
-
_this.version = /* PLAYER_VERSION */ "3.29.0-dev.
|
|
90
|
+
_this.version = /* PLAYER_VERSION */ "3.29.0-dev.2022091600";
|
|
92
91
|
_this.log = log;
|
|
93
92
|
_this.state = "STOPPED";
|
|
94
93
|
_this.videoElement = videoElement;
|
|
@@ -160,7 +159,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
160
159
|
_this._priv_contentInfos = null;
|
|
161
160
|
_this._priv_contentEventsMemory = {};
|
|
162
161
|
_this._priv_stopAtEnd = stopAtEnd;
|
|
163
|
-
_this._priv_setPlayerState(PLAYER_STATES.STOPPED);
|
|
162
|
+
_this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
164
163
|
_this._priv_preferredAudioTracks = preferredAudioTracks;
|
|
165
164
|
_this._priv_preferredTextTracks = preferredTextTracks;
|
|
166
165
|
_this._priv_preferredVideoTracks = preferredVideoTracks;
|
|
@@ -227,8 +226,8 @@ var Player = /** @class */ (function (_super) {
|
|
|
227
226
|
this._priv_contentInfos.currentContentCanceller.cancel();
|
|
228
227
|
}
|
|
229
228
|
this._priv_cleanUpCurrentContentState();
|
|
230
|
-
if (this.state !== PLAYER_STATES.STOPPED) {
|
|
231
|
-
this._priv_setPlayerState(PLAYER_STATES.STOPPED);
|
|
229
|
+
if (this.state !== "STOPPED" /* PLAYER_STATES.STOPPED */) {
|
|
230
|
+
this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
232
231
|
}
|
|
233
232
|
};
|
|
234
233
|
/**
|
|
@@ -550,18 +549,18 @@ var Player = /** @class */ (function (_super) {
|
|
|
550
549
|
stateChangingEvent$.pipe(startWith(null)),
|
|
551
550
|
]).pipe(takeUntil(stoppedContent$), map(function (_a) {
|
|
552
551
|
var stalledStatus = _a[0];
|
|
553
|
-
return
|
|
552
|
+
return getLoadedContentState(videoElement, stalledStatus);
|
|
554
553
|
}));
|
|
555
554
|
/** Emit all player "state" updates. */
|
|
556
|
-
var playerState$ = observableConcat(observableOf(PLAYER_STATES.LOADING), // Begin with LOADING
|
|
555
|
+
var playerState$ = observableConcat(observableOf("LOADING" /* PLAYER_STATES.LOADING */), // Begin with LOADING
|
|
557
556
|
loaded$.pipe(switchMap(function (_, i) {
|
|
558
557
|
var isFirstLoad = i === 0;
|
|
559
558
|
return observableMerge(
|
|
560
559
|
// Purposely subscribed first so a RELOADING triggered synchronously
|
|
561
560
|
// after a LOADED state is catched.
|
|
562
|
-
reloading$.pipe(map(function () { return PLAYER_STATES.RELOADING
|
|
561
|
+
reloading$.pipe(map(function () { return "RELOADING" /* PLAYER_STATES.RELOADING */; })),
|
|
563
562
|
// Only switch to LOADED state for the first (i.e. non-RELOADING) load
|
|
564
|
-
isFirstLoad ? observableOf(PLAYER_STATES.LOADED) :
|
|
563
|
+
isFirstLoad ? observableOf("LOADED" /* PLAYER_STATES.LOADED */) :
|
|
565
564
|
EMPTY,
|
|
566
565
|
// Purposely put last so any other state change happens after we've
|
|
567
566
|
// already switched to LOADED
|
|
@@ -569,7 +568,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
569
568
|
// For the first load, we prefer staying at the LOADED state over
|
|
570
569
|
// PAUSED when autoPlay is disabled.
|
|
571
570
|
// For consecutive loads however, there's no LOADED state.
|
|
572
|
-
skipWhile(function (state) { return isFirstLoad && state === PLAYER_STATES.PAUSED
|
|
571
|
+
skipWhile(function (state) { return isFirstLoad && state === "PAUSED" /* PLAYER_STATES.PAUSED */; })));
|
|
573
572
|
}))).pipe(distinctUntilChanged());
|
|
574
573
|
var playbackSubscription;
|
|
575
574
|
stoppedContent$.subscribe(function () {
|
|
@@ -606,7 +605,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
606
605
|
log.info("API: Previous playback finished. Stopping and cleaning-up...");
|
|
607
606
|
contentInfos.currentContentCanceller.cancel();
|
|
608
607
|
_this._priv_cleanUpCurrentContentState();
|
|
609
|
-
_this._priv_setPlayerState(PLAYER_STATES.STOPPED);
|
|
608
|
+
_this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
610
609
|
}
|
|
611
610
|
},
|
|
612
611
|
});
|
|
@@ -911,9 +910,9 @@ var Player = /** @class */ (function (_super) {
|
|
|
911
910
|
*
|
|
912
911
|
* Note that switching to or getting out of a trickmode video track may
|
|
913
912
|
* lead to the player being a brief instant in a `"RELOADING"` state (notified
|
|
914
|
-
* through `playerStateChange` events and the `
|
|
915
|
-
* that state, a black screen may be displayed and multiple RxPlayer
|
|
916
|
-
* not be usable.
|
|
913
|
+
* through `playerStateChange` events and the `getLoadedContentState` method).
|
|
914
|
+
* When in that state, a black screen may be displayed and multiple RxPlayer
|
|
915
|
+
* APIs will not be usable.
|
|
917
916
|
*
|
|
918
917
|
* @param {Number} rate
|
|
919
918
|
* @param {Object} opts
|
|
@@ -1881,7 +1880,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
1881
1880
|
this._priv_cleanUpCurrentContentState();
|
|
1882
1881
|
this._priv_currentError = formattedError;
|
|
1883
1882
|
log.error("API: The player stopped because of an error", error instanceof Error ? error : "");
|
|
1884
|
-
this._priv_setPlayerState(PLAYER_STATES.STOPPED);
|
|
1883
|
+
this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
|
|
1885
1884
|
// TODO This condition is here because the eventual callback called when the
|
|
1886
1885
|
// player state is updated can launch a new content, thus the error will not
|
|
1887
1886
|
// be here anymore, in which case triggering the "error" event is unwanted.
|
|
@@ -2219,7 +2218,7 @@ var Player = /** @class */ (function (_super) {
|
|
|
2219
2218
|
log.warn("API: Cannot perform time update: no content loaded.");
|
|
2220
2219
|
return;
|
|
2221
2220
|
}
|
|
2222
|
-
if (this.state === PLAYER_STATES.RELOADING) {
|
|
2221
|
+
if (this.state === "RELOADING" /* PLAYER_STATES.RELOADING */) {
|
|
2223
2222
|
return;
|
|
2224
2223
|
}
|
|
2225
2224
|
var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, manifest = _b.manifest;
|
|
@@ -2295,5 +2294,5 @@ var Player = /** @class */ (function (_super) {
|
|
|
2295
2294
|
};
|
|
2296
2295
|
return Player;
|
|
2297
2296
|
}(EventEmitter));
|
|
2298
|
-
Player.version = /* PLAYER_VERSION */ "3.29.0-dev.
|
|
2297
|
+
Player.version = /* PLAYER_VERSION */ "3.29.0-dev.2022091600";
|
|
2299
2298
|
export default Player;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { IAudioTrack, ITextTrack, IVideoTrack, IAudioTrackPreference, ITextTrackPreference, IVideoTrackPreference, IAvailableVideoTrack, IAvailableAudioTrack, IAvailableTextTrack } from "
|
|
17
|
-
import EventEmitter from "
|
|
16
|
+
import { IAudioTrack, ITextTrack, IVideoTrack, IAudioTrackPreference, ITextTrackPreference, IVideoTrackPreference, IAvailableVideoTrack, IAvailableAudioTrack, IAvailableTextTrack } from "../../../public_types";
|
|
17
|
+
import EventEmitter from "../../../utils/event_emitter";
|
|
18
18
|
/** Events emitted by the MediaElementTrackChoiceManager. */
|
|
19
19
|
interface IMediaElementTrackChoiceManagerEvents {
|
|
20
20
|
availableVideoTracksChange: IAvailableVideoTrack[];
|
|
@@ -28,9 +28,9 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
28
28
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
|
-
import assert from "
|
|
32
|
-
import EventEmitter from "
|
|
33
|
-
import normalizeLanguage from "
|
|
31
|
+
import assert from "../../../utils/assert";
|
|
32
|
+
import EventEmitter from "../../../utils/event_emitter";
|
|
33
|
+
import normalizeLanguage from "../../../utils/languages";
|
|
34
34
|
/**
|
|
35
35
|
* Check if track array is different from an other one
|
|
36
36
|
* @param {Array.<Object>} oldTrackArray
|
|
@@ -69,7 +69,10 @@ function createAudioTracks(audioTracks) {
|
|
|
69
69
|
occurences.toString();
|
|
70
70
|
languagesOccurences[language] = occurences + 1;
|
|
71
71
|
var track = { language: audioTrack.language, id: id, normalized: normalizeLanguage(audioTrack.language),
|
|
72
|
-
audioDescription: audioTrack.kind === "descriptions"
|
|
72
|
+
audioDescription: audioTrack.kind === "descriptions" ||
|
|
73
|
+
// Safari seem to prefer the non-standard singular
|
|
74
|
+
// version, funnily enough
|
|
75
|
+
audioTrack.kind === "description",
|
|
73
76
|
representations: [] };
|
|
74
77
|
newAudioTracks.push({ track: track, nativeTrack: audioTrack });
|
|
75
78
|
}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* switching for an easier API management.
|
|
19
19
|
*/
|
|
20
20
|
import { Subject } from "rxjs";
|
|
21
|
-
import { Adaptation, Period } from "
|
|
22
|
-
import { IAudioTrack, IAudioTrackPreference, IAvailableAudioTrack, IAvailableTextTrack, IAvailableVideoTrack, ITextTrack, ITextTrackPreference, IVideoTrack, IVideoTrackPreference } from "
|
|
21
|
+
import { Adaptation, Period } from "../../../manifest";
|
|
22
|
+
import { IAudioTrack, IAudioTrackPreference, IAvailableAudioTrack, IAvailableTextTrack, IAvailableVideoTrack, ITextTrack, ITextTrackPreference, IVideoTrack, IVideoTrackPreference } from "../../../public_types";
|
|
23
23
|
/**
|
|
24
24
|
* Manage audio and text tracks for all active periods.
|
|
25
25
|
* Choose the audio and text tracks for each period and record this choice.
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import log from "
|
|
17
|
-
import arrayFind from "
|
|
18
|
-
import arrayIncludes from "
|
|
19
|
-
import isNullOrUndefined from "
|
|
20
|
-
import normalizeLanguage from "
|
|
21
|
-
import SortedList from "
|
|
22
|
-
import takeFirstSet from "
|
|
16
|
+
import log from "../../../log";
|
|
17
|
+
import arrayFind from "../../../utils/array_find";
|
|
18
|
+
import arrayIncludes from "../../../utils/array_includes";
|
|
19
|
+
import isNullOrUndefined from "../../../utils/is_null_or_undefined";
|
|
20
|
+
import normalizeLanguage from "../../../utils/languages";
|
|
21
|
+
import SortedList from "../../../utils/sorted_list";
|
|
22
|
+
import takeFirstSet from "../../../utils/take_first_set";
|
|
23
23
|
/**
|
|
24
24
|
* Transform an array of IAudioTrackPreference into an array of
|
|
25
25
|
* INormalizedPreferredAudioTrack to be exploited by the TrackChoiceManager.
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Observable } from "rxjs";
|
|
17
|
+
import { IPlayerState } from "../../public_types";
|
|
18
|
+
import { IStallingSituation } from "../init";
|
|
17
19
|
import { IPlaybackObservation } from "./playback_observer";
|
|
18
20
|
/**
|
|
19
21
|
* Returns Observable which will emit:
|
|
@@ -24,4 +26,25 @@ import { IPlaybackObservation } from "./playback_observer";
|
|
|
24
26
|
* @param {Observable} observation$
|
|
25
27
|
* @returns {Observable}
|
|
26
28
|
*/
|
|
27
|
-
export
|
|
29
|
+
export declare function emitSeekEvents(mediaElement: HTMLMediaElement | null, observation$: Observable<IPlaybackObservation>): Observable<"seeking" | "seeked">;
|
|
30
|
+
/** Player state dictionnary. */
|
|
31
|
+
export declare const enum PLAYER_STATES {
|
|
32
|
+
STOPPED = "STOPPED",
|
|
33
|
+
LOADED = "LOADED",
|
|
34
|
+
LOADING = "LOADING",
|
|
35
|
+
PLAYING = "PLAYING",
|
|
36
|
+
PAUSED = "PAUSED",
|
|
37
|
+
ENDED = "ENDED",
|
|
38
|
+
BUFFERING = "BUFFERING",
|
|
39
|
+
SEEKING = "SEEKING",
|
|
40
|
+
RELOADING = "RELOADING"
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get state string for a _loaded_ content.
|
|
44
|
+
* @param {HTMLMediaElement} mediaElement
|
|
45
|
+
* @param {Object} stalledStatus - Current stalled state:
|
|
46
|
+
* - null when not stalled
|
|
47
|
+
* - a description of the situation if stalled.
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export declare function getLoadedContentState(mediaElement: HTMLMediaElement, stalledStatus: IStallingSituation | null): IPlayerState;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { defer as observableDefer, EMPTY, filter, map, merge as observableMerge, startWith, switchMap, take, } from "rxjs";
|
|
17
|
+
import config from "../../config";
|
|
17
18
|
/**
|
|
18
19
|
* Returns Observable which will emit:
|
|
19
20
|
* - `"seeking"` when we are seeking in the given mediaElement
|
|
@@ -23,7 +24,7 @@ import { defer as observableDefer, EMPTY, filter, map, merge as observableMerge,
|
|
|
23
24
|
* @param {Observable} observation$
|
|
24
25
|
* @returns {Observable}
|
|
25
26
|
*/
|
|
26
|
-
export
|
|
27
|
+
export function emitSeekEvents(mediaElement, observation$) {
|
|
27
28
|
return observableDefer(function () {
|
|
28
29
|
if (mediaElement === null) {
|
|
29
30
|
return EMPTY;
|
|
@@ -38,3 +39,33 @@ export default function emitSeekEvents(mediaElement, observation$) {
|
|
|
38
39
|
return observableMerge(isSeeking$, hasSeeked$);
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Get state string for a _loaded_ content.
|
|
44
|
+
* @param {HTMLMediaElement} mediaElement
|
|
45
|
+
* @param {Object} stalledStatus - Current stalled state:
|
|
46
|
+
* - null when not stalled
|
|
47
|
+
* - a description of the situation if stalled.
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function getLoadedContentState(mediaElement, stalledStatus) {
|
|
51
|
+
var FORCED_ENDED_THRESHOLD = config.getCurrent().FORCED_ENDED_THRESHOLD;
|
|
52
|
+
if (mediaElement.ended) {
|
|
53
|
+
return "ENDED" /* PLAYER_STATES.ENDED */;
|
|
54
|
+
}
|
|
55
|
+
if (stalledStatus !== null) {
|
|
56
|
+
// On some old browsers (e.g. Chrome 54), the browser does not
|
|
57
|
+
// emit an 'ended' event in some conditions. Detect if we
|
|
58
|
+
// reached the end by comparing the current position and the
|
|
59
|
+
// duration instead.
|
|
60
|
+
var gapBetweenDurationAndCurrentTime = Math.abs(mediaElement.duration -
|
|
61
|
+
mediaElement.currentTime);
|
|
62
|
+
if (FORCED_ENDED_THRESHOLD != null &&
|
|
63
|
+
gapBetweenDurationAndCurrentTime < FORCED_ENDED_THRESHOLD) {
|
|
64
|
+
return "ENDED" /* PLAYER_STATES.ENDED */;
|
|
65
|
+
}
|
|
66
|
+
return stalledStatus === "seeking" ? "SEEKING" /* PLAYER_STATES.SEEKING */ :
|
|
67
|
+
"BUFFERING" /* PLAYER_STATES.BUFFERING */;
|
|
68
|
+
}
|
|
69
|
+
return mediaElement.paused ? "PAUSED" /* PLAYER_STATES.PAUSED */ :
|
|
70
|
+
"PLAYING" /* PLAYER_STATES.PLAYING */;
|
|
71
|
+
}
|
|
@@ -143,6 +143,16 @@ export default class ContentDecryptor extends EventEmitter<IContentDecryptorEven
|
|
|
143
143
|
*/
|
|
144
144
|
private _processInitializationData;
|
|
145
145
|
private _tryToUseAlreadyCreatedSession;
|
|
146
|
+
/**
|
|
147
|
+
* Callback that should be called if an error that made the current
|
|
148
|
+
* `ContentDecryptor` instance unusable arised.
|
|
149
|
+
* This callbacks takes care of resetting state and sending the right events.
|
|
150
|
+
*
|
|
151
|
+
* Once called, no further actions should be taken.
|
|
152
|
+
*
|
|
153
|
+
* @param {*} err - The error object which describes the issue. Will be
|
|
154
|
+
* formatted and sent in an "error" event.
|
|
155
|
+
*/
|
|
146
156
|
private _onFatalError;
|
|
147
157
|
/**
|
|
148
158
|
* Return `true` if the `ContentDecryptor` has either been disposed or
|
|
@@ -150,8 +160,24 @@ export default class ContentDecryptor extends EventEmitter<IContentDecryptorEven
|
|
|
150
160
|
* @returns {boolean}
|
|
151
161
|
*/
|
|
152
162
|
private _isStopped;
|
|
163
|
+
/**
|
|
164
|
+
* Start processing the next initialization data of the `_initDataQueue` if it
|
|
165
|
+
* isn't lock.
|
|
166
|
+
*/
|
|
153
167
|
private _processCurrentInitDataQueue;
|
|
168
|
+
/**
|
|
169
|
+
* Lock new initialization data (from the `_initDataQueue`) from being
|
|
170
|
+
* processed until `_unlockInitDataQueue` is called.
|
|
171
|
+
*
|
|
172
|
+
* You may want to call this method when performing operations which may have
|
|
173
|
+
* an impact on the handling of other initialization data.
|
|
174
|
+
*/
|
|
154
175
|
private _lockInitDataQueue;
|
|
176
|
+
/**
|
|
177
|
+
* Unlock `_initDataQueue` and start processing the first element.
|
|
178
|
+
*
|
|
179
|
+
* Should have no effect if the `_initDataQueue` was not locked.
|
|
180
|
+
*/
|
|
155
181
|
private _unlockInitDataQueue;
|
|
156
182
|
}
|
|
157
183
|
/** Events sent by the `ContentDecryptor`, in a `{ event: payload }` format. */
|