rx-player 3.30.0-dev.2023011800 → 3.30.0-dev.2023022200
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 +10 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/close_session.js +2 -2
- package/dist/_esm5.processed/compat/event_listeners.js +1 -1
- package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.d.ts +2 -2
- package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +2 -2
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +4 -2
- package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +105 -0
- package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
- package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/index.js +2 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +199 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
- package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/render.js +32 -0
- package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
- package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
- package/dist/_esm5.processed/core/api/option_utils.js +25 -10
- package/dist/_esm5.processed/core/api/playback_observer.js +3 -2
- package/dist/_esm5.processed/core/api/public_api.d.ts +14 -1
- package/dist/_esm5.processed/core/api/public_api.js +50 -14
- package/dist/_esm5.processed/core/api/utils.js +3 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +5 -5
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
- package/dist/_esm5.processed/core/decrypt/{get_current_key_system.d.ts → get_key_system_configuration.d.ts} +11 -2
- package/dist/_esm5.processed/core/decrypt/{get_current_key_system.js → get_key_system_configuration.js} +20 -2
- package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
- package/dist/_esm5.processed/core/decrypt/index.js +2 -2
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +37 -47
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +6 -5
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +30 -34
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +2 -2
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
- package/dist/_esm5.processed/core/init/utils/media_duration_updater.js +23 -19
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
- package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +7 -10
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +10 -11
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +26 -12
- package/dist/_esm5.processed/core/stream/period/period_stream.js +11 -10
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +15 -15
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
- package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
- package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
- package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
- package/dist/_esm5.processed/experimental/features/index.js +1 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +7 -4
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +5 -4
- package/dist/_esm5.processed/features/features_object.js +1 -0
- package/dist/_esm5.processed/features/initialize_features.js +13 -10
- package/dist/_esm5.processed/features/types.d.ts +3 -0
- package/dist/_esm5.processed/manifest/adaptation.js +4 -0
- package/dist/_esm5.processed/manifest/manifest.js +2 -0
- package/dist/_esm5.processed/manifest/representation.js +11 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
- package/dist/_esm5.processed/public_types.d.ts +8 -0
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +13 -12
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
- package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
- package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
- package/dist/_esm5.processed/utils/reference.js +6 -0
- package/dist/_esm5.processed/utils/request/xhr.js +1 -1
- package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
- package/dist/_esm5.processed/utils/task_canceller.js +55 -22
- package/dist/rx-player.js +801 -639
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -5
- package/package.json +18 -21
- package/scripts/build/constants.d.ts +1 -0
- package/scripts/fast_demo_build.js +39 -40
- package/scripts/generate_full_demo.js +1 -1
- package/scripts/report_build_sizes +4 -0
- package/sonar-project.properties +1 -1
- package/src/compat/__tests__/should_reload_media_source_on_decipherability_update.test.ts +1 -1
- package/src/compat/eme/close_session.ts +2 -2
- package/src/compat/event_listeners.ts +1 -1
- package/src/compat/should_reload_media_source_on_decipherability_update.ts +3 -3
- package/src/core/adaptive/adaptive_representation_selector.ts +4 -2
- package/src/core/api/debug/buffer_graph.ts +247 -0
- package/src/core/api/debug/buffer_size_graph.ts +131 -0
- package/src/core/api/debug/constants.ts +2 -0
- package/src/core/api/debug/index.ts +3 -0
- package/src/core/api/debug/modules/general_info.ts +204 -0
- package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
- package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
- package/src/core/api/debug/render.ts +40 -0
- package/src/core/api/debug/utils.ts +103 -0
- package/src/core/api/option_utils.ts +16 -0
- package/src/core/api/playback_observer.ts +4 -2
- package/src/core/api/public_api.ts +55 -13
- package/src/core/api/utils.ts +3 -3
- package/src/core/decrypt/attach_media_keys.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +1 -1
- package/src/core/decrypt/{get_current_key_system.ts → get_key_system_configuration.ts} +23 -2
- package/src/core/decrypt/index.ts +4 -1
- package/src/core/decrypt/session_events_listener.ts +37 -49
- package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
- package/src/core/fetchers/cdn_prioritizer.ts +18 -9
- package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
- package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
- package/src/core/fetchers/utils/schedule_request.ts +6 -5
- package/src/core/init/directfile_content_initializer.ts +1 -1
- package/src/core/init/media_source_content_initializer.ts +40 -44
- package/src/core/init/utils/content_time_boundaries_observer.ts +2 -2
- package/src/core/init/utils/create_media_source.ts +4 -16
- package/src/core/init/utils/end_of_stream.ts +6 -3
- package/src/core/init/utils/get_loaded_reference.ts +2 -1
- package/src/core/init/utils/initial_seek_and_play.ts +9 -5
- package/src/core/init/utils/initialize_content_decryption.ts +2 -1
- package/src/core/init/utils/media_duration_updater.ts +25 -20
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
- package/src/core/init/utils/throw_on_media_error.ts +1 -1
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +7 -11
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +4 -2
- package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
- package/src/core/stream/adaptation/adaptation_stream.ts +10 -11
- package/src/core/stream/orchestrator/stream_orchestrator.ts +26 -12
- package/src/core/stream/period/period_stream.ts +11 -10
- package/src/core/stream/representation/representation_stream.ts +15 -15
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
- package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
- package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
- package/src/experimental/features/debug_element.ts +13 -0
- package/src/experimental/features/index.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +5 -4
- package/src/features/__tests__/initialize_features.test.ts +11 -0
- package/src/features/features_object.ts +1 -0
- package/src/features/initialize_features.ts +15 -10
- package/src/features/types.ts +9 -0
- package/src/manifest/adaptation.ts +7 -0
- package/src/manifest/manifest.ts +4 -0
- package/src/manifest/representation.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
- package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
- package/src/public_types.ts +9 -0
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +30 -24
- package/src/transports/dash/low_latency_segment_loader.ts +2 -2
- package/src/transports/dash/manifest_parser.ts +1 -1
- package/src/transports/dash/segment_loader.ts +4 -4
- package/src/transports/local/segment_loader.ts +14 -30
- package/src/transports/smooth/segment_loader.ts +4 -4
- package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
- package/src/typings/globals.d.ts +2 -0
- package/src/utils/cancellable_sleep.ts +5 -14
- package/src/utils/create_cancellable_promise.ts +69 -0
- package/src/utils/reference.ts +6 -0
- package/src/utils/request/xhr.ts +1 -1
- package/src/utils/task_canceller.ts +63 -34
- package/tsconfig.json +1 -1
- package/tsconfig.modules.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.30.0-dev.
|
|
3
|
+
## v3.30.0-dev.2023022200
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
7
|
- Add `updateContentUrls` API, allowing to update the Manifest's URL during playback [#1182]
|
|
8
8
|
- DASH: implement forced-subtitles, adding the `forced` property to the audio tracks API and selecting by default a forced text track linked to the audio track's language if present [#1187]
|
|
9
|
+
- DRM: add the `getKeySystemConfiguration` method to the RxPlayer [#1202]
|
|
10
|
+
- add experimental `DEBUG_ELEMENT` feature and `createDebugElement` method to render a default debugging HTML element [#1200]
|
|
11
|
+
|
|
12
|
+
### Deprecated
|
|
13
|
+
|
|
14
|
+
- Deprecate the `getVideoLoadedTime` method which can be easily replaced (see Deprecated method documentation)
|
|
15
|
+
- Deprecate the `getVideoPlayedTime` method which can be easily replaced (see Deprecated method documentation)
|
|
16
|
+
- Deprecate the `transportOptions.aggressiveMode` option
|
|
17
|
+
- DRM: Deprecate the `keySystems[].onKeyStatusesChange` callback as no good use case was found for it.
|
|
9
18
|
|
|
10
19
|
### Bug fixes
|
|
11
20
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.30.0-dev.
|
|
1
|
+
3.30.0-dev.2023022200
|
|
@@ -136,7 +136,7 @@ export default function closeSession(session) {
|
|
|
136
136
|
return [3 /*break*/, 4];
|
|
137
137
|
case 2:
|
|
138
138
|
err_2 = _a.sent();
|
|
139
|
-
if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
|
|
139
|
+
if (timeoutCanceller.isUsed()) { // Reminder: cancelled == session closed
|
|
140
140
|
return [2 /*return*/];
|
|
141
141
|
}
|
|
142
142
|
// The caught error can tell if session is closed
|
|
@@ -151,7 +151,7 @@ export default function closeSession(session) {
|
|
|
151
151
|
_a.sent();
|
|
152
152
|
return [3 /*break*/, 4];
|
|
153
153
|
case 4:
|
|
154
|
-
if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
|
|
154
|
+
if (timeoutCanceller.isUsed()) { // Reminder: cancelled == session closed
|
|
155
155
|
return [2 /*return*/];
|
|
156
156
|
}
|
|
157
157
|
throw new Error("Compat: Couldn't know if session is closed");
|
|
@@ -80,7 +80,7 @@ function createCompatibleEventListener(eventNames, prefixes) {
|
|
|
80
80
|
var mem;
|
|
81
81
|
var prefixedEvents = eventPrefixed(eventNames, prefixes);
|
|
82
82
|
return function (element, listener, cancelSignal) {
|
|
83
|
-
if (cancelSignal.isCancelled) {
|
|
83
|
+
if (cancelSignal.isCancelled()) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
// if the element is a HTMLElement we can detect
|
package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* We found that on all Widevine targets tested, a simple seek is sufficient.
|
|
21
21
|
* As widevine clients make a good chunk of users, we can make a difference
|
|
22
22
|
* between them and others as it is for the better.
|
|
23
|
-
* @param {string|
|
|
23
|
+
* @param {string|undefined} currentKeySystem
|
|
24
24
|
* @returns {Boolean}
|
|
25
25
|
*/
|
|
26
|
-
export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem: string |
|
|
26
|
+
export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem: string | undefined): boolean;
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* We found that on all Widevine targets tested, a simple seek is sufficient.
|
|
21
21
|
* As widevine clients make a good chunk of users, we can make a difference
|
|
22
22
|
* between them and others as it is for the better.
|
|
23
|
-
* @param {string|
|
|
23
|
+
* @param {string|undefined} currentKeySystem
|
|
24
24
|
* @returns {Boolean}
|
|
25
25
|
*/
|
|
26
26
|
export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem) {
|
|
27
|
-
return currentKeySystem ===
|
|
27
|
+
return currentKeySystem === undefined ||
|
|
28
28
|
currentKeySystem.indexOf("widevine") < 0;
|
|
29
29
|
}
|
|
@@ -133,7 +133,8 @@ function getEstimateReference(_a, stopAllEstimates) {
|
|
|
133
133
|
* This TaskCanceller is used both for restarting estimates with a new
|
|
134
134
|
* configuration and to cancel them altogether.
|
|
135
135
|
*/
|
|
136
|
-
var currentEstimatesCanceller = new TaskCanceller(
|
|
136
|
+
var currentEstimatesCanceller = new TaskCanceller();
|
|
137
|
+
currentEstimatesCanceller.linkToSignal(stopAllEstimates);
|
|
137
138
|
// Create `ISharedReference` on which estimates will be emitted.
|
|
138
139
|
var estimateRef = createEstimateReference(manualBitrate.getValue(), representationsRef.getValue(), currentEstimatesCanceller.signal);
|
|
139
140
|
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal: stopAllEstimates });
|
|
@@ -333,7 +334,8 @@ function getEstimateReference(_a, stopAllEstimates) {
|
|
|
333
334
|
var manualBitrateVal = manualBitrate.getValue();
|
|
334
335
|
var representations = representationsRef.getValue();
|
|
335
336
|
currentEstimatesCanceller.cancel();
|
|
336
|
-
currentEstimatesCanceller = new TaskCanceller(
|
|
337
|
+
currentEstimatesCanceller = new TaskCanceller();
|
|
338
|
+
currentEstimatesCanceller.linkToSignal(stopAllEstimates);
|
|
337
339
|
var newRef = createEstimateReference(manualBitrateVal, representations, currentEstimatesCanceller.signal);
|
|
338
340
|
newRef.onUpdate(function onNewEstimate(newEstimate) {
|
|
339
341
|
estimateRef.setValue(newEstimate);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IBufferedChunk } from "../../segment_buffers";
|
|
2
|
+
export interface ISegmentBufferGrapUpdateData {
|
|
3
|
+
currentTime: number;
|
|
4
|
+
inventory: IBufferedChunk[];
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
minimumPosition: number | undefined;
|
|
8
|
+
maximumPosition: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
export default class SegmentBufferGraph {
|
|
11
|
+
/** Link buffered Representation to their corresponding color. */
|
|
12
|
+
private readonly _colorMap;
|
|
13
|
+
/** Current amount of colors chosen to represent the various Representation. */
|
|
14
|
+
private _currNbColors;
|
|
15
|
+
/** Canvas that will contain the buffer graph itself. */
|
|
16
|
+
private readonly _canvasElt;
|
|
17
|
+
private readonly _canvasCtxt;
|
|
18
|
+
constructor(canvasElt: HTMLCanvasElement);
|
|
19
|
+
clear(): void;
|
|
20
|
+
update(data: ISegmentBufferGrapUpdateData): void;
|
|
21
|
+
/**
|
|
22
|
+
* Paint a given range in the canvas
|
|
23
|
+
* @param {Object} rangeScaled - Buffered segment information with added
|
|
24
|
+
* "scaling" information to know where it fits in the canvas.
|
|
25
|
+
*/
|
|
26
|
+
private _paintRange;
|
|
27
|
+
private _getColorForRepresentation;
|
|
28
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var BUFFER_WIDTH_IN_SECONDS = 10000;
|
|
2
|
+
var COLORS = [
|
|
3
|
+
"#2ab7ca",
|
|
4
|
+
"#fed766",
|
|
5
|
+
"#4dd248",
|
|
6
|
+
"#a22c28",
|
|
7
|
+
"#556b2f",
|
|
8
|
+
"#add8e6",
|
|
9
|
+
"#90ee90",
|
|
10
|
+
"#444444",
|
|
11
|
+
"#40bfc1",
|
|
12
|
+
"#57557e",
|
|
13
|
+
"#fbe555",
|
|
14
|
+
];
|
|
15
|
+
var SegmentBufferGraph = /** @class */ (function () {
|
|
16
|
+
function SegmentBufferGraph(canvasElt) {
|
|
17
|
+
this._colorMap = new WeakMap();
|
|
18
|
+
this._currNbColors = 0;
|
|
19
|
+
this._canvasElt = canvasElt;
|
|
20
|
+
this._canvasCtxt = this._canvasElt.getContext("2d");
|
|
21
|
+
this.clear();
|
|
22
|
+
}
|
|
23
|
+
SegmentBufferGraph.prototype.clear = function () {
|
|
24
|
+
if (this._canvasCtxt !== null) {
|
|
25
|
+
this._canvasCtxt.clearRect(0, 0, this._canvasElt.width, this._canvasElt.height);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
SegmentBufferGraph.prototype.update = function (data) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
if (this._canvasCtxt === null) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var inventory = data.inventory, currentTime = data.currentTime, width = data.width, height = data.height;
|
|
34
|
+
this._canvasElt.style.width = "".concat(width, "px");
|
|
35
|
+
this._canvasElt.style.height = "".concat(height, "px");
|
|
36
|
+
this._canvasElt.width = width;
|
|
37
|
+
this._canvasElt.height = height;
|
|
38
|
+
this.clear();
|
|
39
|
+
var minimumPoint;
|
|
40
|
+
if (data.minimumPosition !== undefined) {
|
|
41
|
+
if (inventory.length > 0) {
|
|
42
|
+
minimumPoint = Math.min(data.minimumPosition, inventory[0].start);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
minimumPoint = data.minimumPosition;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
minimumPoint = (_b = (_a = inventory[0]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
|
|
50
|
+
}
|
|
51
|
+
var maximumPoint;
|
|
52
|
+
if (data.maximumPosition !== undefined) {
|
|
53
|
+
if (inventory.length > 0) {
|
|
54
|
+
maximumPoint = Math.max(data.maximumPosition, inventory[inventory.length - 1].end);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
maximumPoint = data.maximumPosition;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
maximumPoint = (_d = (_c = inventory[inventory.length - 1]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 1000;
|
|
62
|
+
}
|
|
63
|
+
minimumPoint = Math.min(currentTime, minimumPoint);
|
|
64
|
+
maximumPoint = Math.max(currentTime, maximumPoint);
|
|
65
|
+
var minimumPosition;
|
|
66
|
+
var maximumPosition;
|
|
67
|
+
if (maximumPoint - minimumPoint > BUFFER_WIDTH_IN_SECONDS) {
|
|
68
|
+
if (currentTime === undefined) {
|
|
69
|
+
minimumPosition = minimumPoint;
|
|
70
|
+
maximumPosition = maximumPoint;
|
|
71
|
+
}
|
|
72
|
+
else if (maximumPoint - currentTime < BUFFER_WIDTH_IN_SECONDS / 2) {
|
|
73
|
+
maximumPosition = maximumPoint;
|
|
74
|
+
minimumPosition = maximumPoint - BUFFER_WIDTH_IN_SECONDS;
|
|
75
|
+
}
|
|
76
|
+
else if (currentTime - minimumPoint < BUFFER_WIDTH_IN_SECONDS / 2) {
|
|
77
|
+
minimumPosition = minimumPoint;
|
|
78
|
+
maximumPosition = minimumPoint + BUFFER_WIDTH_IN_SECONDS;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
minimumPosition = currentTime - BUFFER_WIDTH_IN_SECONDS / 2;
|
|
82
|
+
maximumPosition = currentTime + BUFFER_WIDTH_IN_SECONDS / 2;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
minimumPosition = minimumPoint;
|
|
87
|
+
maximumPosition = maximumPoint;
|
|
88
|
+
}
|
|
89
|
+
if (minimumPosition >= maximumPosition) {
|
|
90
|
+
this.clear();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
var currentRangesScaled = scaleSegments(inventory, minimumPosition, maximumPosition);
|
|
94
|
+
for (var i = 0; i < currentRangesScaled.length; i++) {
|
|
95
|
+
this._paintRange(currentRangesScaled[i], width, height);
|
|
96
|
+
}
|
|
97
|
+
if (currentTime !== undefined) {
|
|
98
|
+
paintCurrentPosition(currentTime, minimumPosition, maximumPosition, this._canvasCtxt, width, height);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Paint a given range in the canvas
|
|
103
|
+
* @param {Object} rangeScaled - Buffered segment information with added
|
|
104
|
+
* "scaling" information to know where it fits in the canvas.
|
|
105
|
+
*/
|
|
106
|
+
SegmentBufferGraph.prototype._paintRange = function (rangeScaled, width, height) {
|
|
107
|
+
if (this._canvasCtxt === null) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
var startX = rangeScaled.scaledStart * width;
|
|
111
|
+
var endX = rangeScaled.scaledEnd * width;
|
|
112
|
+
this._canvasCtxt.fillStyle = this._getColorForRepresentation(rangeScaled.info.infos.representation);
|
|
113
|
+
this._canvasCtxt.fillRect(Math.ceil(startX), 0, Math.ceil(endX - startX), height);
|
|
114
|
+
};
|
|
115
|
+
SegmentBufferGraph.prototype._getColorForRepresentation = function (representation) {
|
|
116
|
+
var color = this._colorMap.get(representation);
|
|
117
|
+
if (color !== undefined) {
|
|
118
|
+
return color;
|
|
119
|
+
}
|
|
120
|
+
var newColor = COLORS[this._currNbColors % COLORS.length];
|
|
121
|
+
this._currNbColors++;
|
|
122
|
+
this._colorMap.set(representation, newColor);
|
|
123
|
+
return newColor;
|
|
124
|
+
};
|
|
125
|
+
return SegmentBufferGraph;
|
|
126
|
+
}());
|
|
127
|
+
export default SegmentBufferGraph;
|
|
128
|
+
/**
|
|
129
|
+
* Represent the current position in the canvas.
|
|
130
|
+
* @param {number|undefined} position - The current position
|
|
131
|
+
* @param {number} minimumPosition - minimum possible position represented in
|
|
132
|
+
* the canvas.
|
|
133
|
+
* @param {number} maximumPosition - maximum possible position represented in
|
|
134
|
+
* the canvas.
|
|
135
|
+
* @param {Object} canvasCtx - The canvas' 2D context
|
|
136
|
+
*/
|
|
137
|
+
function paintCurrentPosition(position, minimumPosition, maximumPosition, canvasCtx, width, height) {
|
|
138
|
+
if (typeof position === "number" &&
|
|
139
|
+
position >= minimumPosition &&
|
|
140
|
+
position < maximumPosition) {
|
|
141
|
+
var lengthCanvas = maximumPosition - minimumPosition;
|
|
142
|
+
canvasCtx.fillStyle = "#FF0000";
|
|
143
|
+
canvasCtx.fillRect(Math.ceil((position - minimumPosition) /
|
|
144
|
+
lengthCanvas * width) - 1, 5, 5, height);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Scale given bufferedData in terms of percentage between the minimum and
|
|
149
|
+
* maximum position. Filter out ranges which are not part of it.
|
|
150
|
+
* @param {Array.<Object>} bufferedData
|
|
151
|
+
* @param {number} minimumPosition
|
|
152
|
+
* @param {number} maximumPosition
|
|
153
|
+
* @returns {Array.<Object>}
|
|
154
|
+
*/
|
|
155
|
+
function scaleSegments(bufferedData, minimumPosition, maximumPosition) {
|
|
156
|
+
var scaledSegments = [];
|
|
157
|
+
var wholeDuration = maximumPosition - minimumPosition;
|
|
158
|
+
for (var i = 0; i < bufferedData.length; i++) {
|
|
159
|
+
var info = bufferedData[i];
|
|
160
|
+
var start = info.bufferedStart === undefined ?
|
|
161
|
+
info.start :
|
|
162
|
+
info.bufferedStart;
|
|
163
|
+
var end = info.bufferedEnd === undefined ?
|
|
164
|
+
info.end :
|
|
165
|
+
info.bufferedEnd;
|
|
166
|
+
if (end > minimumPosition && start < maximumPosition) {
|
|
167
|
+
var startPoint = Math.max(start - minimumPosition, 0);
|
|
168
|
+
var endPoint = Math.min(end - minimumPosition, maximumPosition);
|
|
169
|
+
var scaledStart = startPoint / wholeDuration;
|
|
170
|
+
var scaledEnd = endPoint / wholeDuration;
|
|
171
|
+
scaledSegments.push({ scaledStart: scaledStart, scaledEnd: scaledEnd, info: info });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return scaledSegments;
|
|
175
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default class BufferSizeGraph {
|
|
2
|
+
private _history;
|
|
3
|
+
/** Canvas that will contain the buffer size graph itself. */
|
|
4
|
+
private readonly _canvasElt;
|
|
5
|
+
private readonly _canvasCtxt;
|
|
6
|
+
constructor(canvasElt: HTMLCanvasElement);
|
|
7
|
+
pushBufferSize(bufferSize: number): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
reRender(width: number, height: number): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maximum history of the buffer size that will be displayed, in milliseconds.
|
|
3
|
+
* For example, a value of `3000` indicates that we will just show at most the
|
|
4
|
+
* buffer size evolution during the last 3 seconds.
|
|
5
|
+
*/
|
|
6
|
+
var TIME_SAMPLES_MS = 30000;
|
|
7
|
+
/**
|
|
8
|
+
* At minimum, that value will be taken in the chart as a maximum buffer size,
|
|
9
|
+
* in seconds.
|
|
10
|
+
* If samples go higher than this size, the chart will adapt automatically to
|
|
11
|
+
* a higher scale.
|
|
12
|
+
* However if values go below that value, the chart won't scale down more than
|
|
13
|
+
* this.
|
|
14
|
+
*/
|
|
15
|
+
var MINIMUM_MAX_BUFFER_SIZE = 20;
|
|
16
|
+
var BufferSizeGraph = /** @class */ (function () {
|
|
17
|
+
function BufferSizeGraph(canvasElt) {
|
|
18
|
+
this._canvasElt = canvasElt;
|
|
19
|
+
this._canvasCtxt = this._canvasElt.getContext("2d");
|
|
20
|
+
this._history = [];
|
|
21
|
+
}
|
|
22
|
+
BufferSizeGraph.prototype.pushBufferSize = function (bufferSize) {
|
|
23
|
+
var now = performance.now();
|
|
24
|
+
this._history.push({ timestamp: now, bufferSize: bufferSize });
|
|
25
|
+
if (this._history.length > 0) {
|
|
26
|
+
var minimumTime = now - TIME_SAMPLES_MS;
|
|
27
|
+
var i = void 0;
|
|
28
|
+
for (i = this._history.length - 1; i >= 1; i--) {
|
|
29
|
+
if (this._history[i].timestamp <= minimumTime) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this._history = this._history.slice(i);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this._history = [];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
BufferSizeGraph.prototype.clear = function () {
|
|
40
|
+
if (this._canvasCtxt !== null) {
|
|
41
|
+
this._canvasCtxt.clearRect(0, 0, this._canvasElt.width, this._canvasElt.height);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
BufferSizeGraph.prototype.reRender = function (width, height) {
|
|
45
|
+
this._canvasElt.style.width = "".concat(width, "px");
|
|
46
|
+
this._canvasElt.style.height = "".concat(height, "px");
|
|
47
|
+
this._canvasElt.width = width;
|
|
48
|
+
this._canvasElt.height = height;
|
|
49
|
+
this.clear();
|
|
50
|
+
var history = this._history;
|
|
51
|
+
var canvasCtx = this._canvasCtxt;
|
|
52
|
+
if (history.length === 0) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
var currentMaxSize = getNewMaxBufferSize();
|
|
56
|
+
var minDate = history[0].timestamp;
|
|
57
|
+
var gridHeight = height / currentMaxSize;
|
|
58
|
+
var gridWidth = width / TIME_SAMPLES_MS;
|
|
59
|
+
drawData();
|
|
60
|
+
// drawGrid();
|
|
61
|
+
/**
|
|
62
|
+
* Get more appropriate maximum buffer size to put on top of the graph
|
|
63
|
+
* according to current history.
|
|
64
|
+
*/
|
|
65
|
+
function getNewMaxBufferSize() {
|
|
66
|
+
var maxPoint = Math.max.apply(Math, history.map(function (d) { return d.bufferSize; }));
|
|
67
|
+
return Math.max(maxPoint + 5, MINIMUM_MAX_BUFFER_SIZE);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Draw all data contained in `history` in the canvas given.
|
|
71
|
+
*/
|
|
72
|
+
function drawData() {
|
|
73
|
+
if (canvasCtx === null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
canvasCtx.beginPath();
|
|
77
|
+
canvasCtx.fillStyle = "rgb(200, 100, 200)";
|
|
78
|
+
for (var i = 1; i < history.length; i++) {
|
|
79
|
+
var diff = dateToX(history[i].timestamp) -
|
|
80
|
+
dateToX(history[i - 1].timestamp);
|
|
81
|
+
var y = height - bufferValueToHeight(history[i].bufferSize);
|
|
82
|
+
canvasCtx.fillRect(dateToX(history[i - 1].timestamp), y, diff, height);
|
|
83
|
+
}
|
|
84
|
+
canvasCtx.stroke();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Convert a value of a given data point, to a u coordinate in the canvas.
|
|
88
|
+
* @param {number} bufferVal - Value to convert
|
|
89
|
+
* @returns {number} - y coordinate
|
|
90
|
+
*/
|
|
91
|
+
function bufferValueToHeight(bufferVal) {
|
|
92
|
+
return height - (currentMaxSize - bufferVal) * gridHeight;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Convert a date of a given data point, to a x coordinate in the canvas.
|
|
96
|
+
* @param {number} date - Date to convert, in milliseconds
|
|
97
|
+
* @returns {number} - x coordinate
|
|
98
|
+
*/
|
|
99
|
+
function dateToX(date) {
|
|
100
|
+
return (date - minDate) * gridWidth;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return BufferSizeGraph;
|
|
104
|
+
}());
|
|
105
|
+
export default BufferSizeGraph;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { DEFAULT_REFRESH_INTERVAL } from "../constants";
|
|
2
|
+
import { createCompositeElement, createElement, createMetricTitle, isExtendedMode, } from "../utils";
|
|
3
|
+
export default function constructDebugGeneralInfo(instance, parentElt, cancelSignal) {
|
|
4
|
+
var generalInfoElt = createElement("div");
|
|
5
|
+
var adaptationsElt = createElement("div");
|
|
6
|
+
var representationsElt = createElement("div");
|
|
7
|
+
updateGeneralInfo();
|
|
8
|
+
var generalInfoItv = setInterval(function () {
|
|
9
|
+
updateGeneralInfo();
|
|
10
|
+
}, DEFAULT_REFRESH_INTERVAL);
|
|
11
|
+
cancelSignal.register(function () {
|
|
12
|
+
clearInterval(generalInfoItv);
|
|
13
|
+
});
|
|
14
|
+
return createCompositeElement("div", [
|
|
15
|
+
generalInfoElt,
|
|
16
|
+
adaptationsElt,
|
|
17
|
+
representationsElt,
|
|
18
|
+
]);
|
|
19
|
+
function updateGeneralInfo() {
|
|
20
|
+
var videoElement = instance.getVideoElement();
|
|
21
|
+
if (videoElement === null) {
|
|
22
|
+
// disposed player. Clean-up everything
|
|
23
|
+
generalInfoElt.innerHTML = "";
|
|
24
|
+
adaptationsElt.innerHTML = "";
|
|
25
|
+
representationsElt.innerHTML = "";
|
|
26
|
+
clearInterval(generalInfoItv);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
var currentTime = instance.getPosition();
|
|
31
|
+
var bufferGap = instance.getVideoBufferGap();
|
|
32
|
+
var bufferGapStr = bufferGap === Infinity ? "0" : bufferGap.toFixed(2);
|
|
33
|
+
var valuesLine1 = [
|
|
34
|
+
["ct", currentTime.toFixed(2)],
|
|
35
|
+
["bg", bufferGapStr],
|
|
36
|
+
["rs", String(videoElement.readyState)],
|
|
37
|
+
["pr", String(videoElement.playbackRate)],
|
|
38
|
+
["sp", String(instance.getPlaybackRate())],
|
|
39
|
+
["pa", String(videoElement.paused ? 1 : 0)],
|
|
40
|
+
["en", String(videoElement.ended ? 1 : 0)],
|
|
41
|
+
["li", String(instance.isLive() ? 1 : 0)],
|
|
42
|
+
["wba", String(instance.getWantedBufferAhead())],
|
|
43
|
+
["st", "\"".concat(instance.getPlayerState(), "\"")],
|
|
44
|
+
];
|
|
45
|
+
var valuesLine2 = [];
|
|
46
|
+
var ks = instance.getKeySystemConfiguration();
|
|
47
|
+
if (ks !== null) {
|
|
48
|
+
valuesLine2.push(["ks", ks.keySystem]);
|
|
49
|
+
}
|
|
50
|
+
var mbb = instance.getMaxBufferBehind();
|
|
51
|
+
if (mbb !== Infinity) {
|
|
52
|
+
valuesLine2.push(["mbb", String(mbb)]);
|
|
53
|
+
}
|
|
54
|
+
var mba = instance.getMaxBufferAhead();
|
|
55
|
+
if (mba !== Infinity) {
|
|
56
|
+
valuesLine2.push(["mba", String(mba)]);
|
|
57
|
+
}
|
|
58
|
+
var mia = instance.getMinAudioBitrate();
|
|
59
|
+
if (mia !== 0) {
|
|
60
|
+
valuesLine2.push(["mia", String(mia)]);
|
|
61
|
+
}
|
|
62
|
+
var miv = instance.getMinVideoBitrate();
|
|
63
|
+
if (miv !== 0) {
|
|
64
|
+
valuesLine2.push(["miv", String(miv)]);
|
|
65
|
+
}
|
|
66
|
+
var maa = instance.getMaxAudioBitrate();
|
|
67
|
+
if (maa !== Infinity) {
|
|
68
|
+
valuesLine2.push(["maa", String(maa)]);
|
|
69
|
+
}
|
|
70
|
+
var mav = instance.getMaxVideoBitrate();
|
|
71
|
+
if (mav !== Infinity) {
|
|
72
|
+
valuesLine2.push(["mav", String(mav)]);
|
|
73
|
+
}
|
|
74
|
+
var fab = instance.getManualAudioBitrate();
|
|
75
|
+
if (fab >= 0) {
|
|
76
|
+
valuesLine2.push(["fab", String(fab)]);
|
|
77
|
+
}
|
|
78
|
+
var fvb = instance.getManualVideoBitrate();
|
|
79
|
+
if (fvb >= 0) {
|
|
80
|
+
valuesLine2.push(["fvb", String(fvb)]);
|
|
81
|
+
}
|
|
82
|
+
var mbs = instance.getMaxVideoBufferSize();
|
|
83
|
+
if (mbs !== Infinity) {
|
|
84
|
+
valuesLine2.push(["mbs", String(mbs)]);
|
|
85
|
+
}
|
|
86
|
+
var minPos = instance.getMinimumPosition();
|
|
87
|
+
if (minPos !== null) {
|
|
88
|
+
valuesLine1.push(["mip", minPos.toFixed(2)]);
|
|
89
|
+
valuesLine2.push(["dmi", (currentTime - minPos).toFixed(2)]);
|
|
90
|
+
}
|
|
91
|
+
var maxPos = instance.getMaximumPosition();
|
|
92
|
+
if (maxPos !== null) {
|
|
93
|
+
valuesLine1.push(["map", maxPos.toFixed(2)]);
|
|
94
|
+
valuesLine2.push(["dma", (maxPos - currentTime).toFixed(2)]);
|
|
95
|
+
}
|
|
96
|
+
var valuesLine3 = [];
|
|
97
|
+
var error = instance.getError();
|
|
98
|
+
if (error !== null) {
|
|
99
|
+
valuesLine3.push(["er", "\"".concat(String(error), "\"")]);
|
|
100
|
+
}
|
|
101
|
+
generalInfoElt.innerHTML = "";
|
|
102
|
+
for (var _i = 0, _a = [valuesLine1, valuesLine2, valuesLine3]; _i < _a.length; _i++) {
|
|
103
|
+
var valueSet = _a[_i];
|
|
104
|
+
if (valueSet.length > 0) {
|
|
105
|
+
var lineInfoElt = createElement("div");
|
|
106
|
+
for (var _b = 0, valueSet_1 = valueSet; _b < valueSet_1.length; _b++) {
|
|
107
|
+
var value = valueSet_1[_b];
|
|
108
|
+
lineInfoElt.appendChild(createMetricTitle(value[0]));
|
|
109
|
+
lineInfoElt.appendChild(createElement("span", {
|
|
110
|
+
textContent: value[1] + " ",
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
generalInfoElt.appendChild(lineInfoElt);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (isExtendedMode(parentElt)) {
|
|
117
|
+
var url = instance.getUrl();
|
|
118
|
+
if (url !== undefined) {
|
|
119
|
+
var reducedUrl = url.length > 100 ?
|
|
120
|
+
url.substring(0, 99) + "…" :
|
|
121
|
+
url;
|
|
122
|
+
generalInfoElt.appendChild(createCompositeElement("div", [
|
|
123
|
+
createMetricTitle("url"),
|
|
124
|
+
createElement("span", {
|
|
125
|
+
textContent: reducedUrl,
|
|
126
|
+
}),
|
|
127
|
+
]));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (isExtendedMode(parentElt)) {
|
|
132
|
+
var videoId = instance.getAvailableVideoTracks().map(function (_a) {
|
|
133
|
+
var id = _a.id, active = _a.active;
|
|
134
|
+
return active ? "*".concat(id) : id;
|
|
135
|
+
});
|
|
136
|
+
var audioId = instance.getAvailableAudioTracks().map(function (_a) {
|
|
137
|
+
var id = _a.id, active = _a.active;
|
|
138
|
+
return active ? "*".concat(id) : id;
|
|
139
|
+
});
|
|
140
|
+
var textId = instance.getAvailableTextTracks().map(function (_a) {
|
|
141
|
+
var id = _a.id, active = _a.active;
|
|
142
|
+
return active ? "*".concat(id) : id;
|
|
143
|
+
});
|
|
144
|
+
adaptationsElt.innerHTML = "";
|
|
145
|
+
if (videoId.length > 0) {
|
|
146
|
+
var textContent = "".concat(videoId.length, ":").concat(videoId.join(" "), " ");
|
|
147
|
+
if (textContent.length > 100) {
|
|
148
|
+
textContent = textContent.substring(0, 98) + "… ";
|
|
149
|
+
}
|
|
150
|
+
var videoAdaps = createCompositeElement("div", [
|
|
151
|
+
createMetricTitle("vt"),
|
|
152
|
+
createElement("span", { textContent: textContent }),
|
|
153
|
+
]);
|
|
154
|
+
adaptationsElt.appendChild(videoAdaps);
|
|
155
|
+
}
|
|
156
|
+
if (audioId.length > 0) {
|
|
157
|
+
var textContent = "".concat(audioId.length, ":").concat(audioId.join(" "), " ");
|
|
158
|
+
if (textContent.length > 100) {
|
|
159
|
+
textContent = textContent.substring(0, 98) + "… ";
|
|
160
|
+
}
|
|
161
|
+
var audioAdaps = createCompositeElement("div", [
|
|
162
|
+
createMetricTitle("at"),
|
|
163
|
+
createElement("span", { textContent: textContent }),
|
|
164
|
+
]);
|
|
165
|
+
adaptationsElt.appendChild(audioAdaps);
|
|
166
|
+
}
|
|
167
|
+
if (textId.length > 0) {
|
|
168
|
+
var textContent = "".concat(textId.length, ":").concat(textId.join(" "), " ");
|
|
169
|
+
if (textContent.length > 100) {
|
|
170
|
+
textContent = textContent.substring(0, 98) + "… ";
|
|
171
|
+
}
|
|
172
|
+
var textAdaps = createCompositeElement("div", [
|
|
173
|
+
createMetricTitle("tt"),
|
|
174
|
+
createElement("span", { textContent: textContent }),
|
|
175
|
+
]);
|
|
176
|
+
adaptationsElt.appendChild(textAdaps);
|
|
177
|
+
}
|
|
178
|
+
var videoBitrates = instance.getAvailableVideoBitrates();
|
|
179
|
+
var audioBitrates = instance.getAvailableAudioBitrates();
|
|
180
|
+
representationsElt.innerHTML = "";
|
|
181
|
+
if (videoBitrates.length > 0) {
|
|
182
|
+
representationsElt.appendChild(createMetricTitle("vb"));
|
|
183
|
+
representationsElt.appendChild(createElement("span", {
|
|
184
|
+
textContent: videoBitrates.join(" ") + " ",
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
if (audioBitrates.length > 0) {
|
|
188
|
+
representationsElt.appendChild(createMetricTitle("ab"));
|
|
189
|
+
representationsElt.appendChild(createElement("span", {
|
|
190
|
+
textContent: audioBitrates.join(" ") + " ",
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
adaptationsElt.innerHTML = "";
|
|
196
|
+
representationsElt.innerHTML = "";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CancellationSignal } from "../../../../utils/task_canceller";
|
|
2
|
+
import { IBufferType } from "../../../segment_buffers";
|
|
3
|
+
import RxPlayer from "../../public_api";
|
|
4
|
+
export default function createSegmentBufferGraph(instance: RxPlayer, bufferType: IBufferType, title: string, parentElt: HTMLElement, cancelSignal: CancellationSignal): HTMLElement;
|