@gcorevideo/player 2.10.0 → 2.12.1
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/LICENSE +13 -0
- package/coverage/clover.xml +6 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/dist/index.js +3115 -1185
- package/lib/Player.d.ts +3 -2
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +33 -20
- package/lib/index.d.ts +6 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -5
- package/lib/internal.types.d.ts +3 -1
- package/lib/internal.types.d.ts.map +1 -1
- package/lib/playback/index.d.ts +4 -0
- package/lib/playback/index.d.ts.map +1 -0
- package/lib/playback/index.js +13 -0
- package/lib/playback.types.d.ts +9 -0
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/playback.types.js +9 -1
- package/lib/plugins/dash-playback/DashPlayback.d.ts +0 -1
- package/lib/plugins/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/plugins/dash-playback/DashPlayback.js +32 -96
- package/lib/plugins/dash-playback/types.d.ts +6 -0
- package/lib/plugins/dash-playback/types.d.ts.map +1 -0
- package/lib/plugins/dash-playback/types.js +1 -0
- package/lib/plugins/hls-playback/HlsPlayback.d.ts +3 -3
- package/lib/plugins/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/plugins/hls-playback/HlsPlayback.js +136 -63
- package/lib/types.d.ts +3 -3
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/mediaSources.d.ts +14 -6
- package/lib/utils/mediaSources.d.ts.map +1 -1
- package/lib/utils/mediaSources.js +56 -53
- package/lib/utils/testUtils.d.ts +3 -0
- package/lib/utils/testUtils.d.ts.map +1 -0
- package/lib/utils/testUtils.js +12 -0
- package/package.json +6 -4
- package/src/Player.ts +46 -26
- package/src/__tests__/Player.test.ts +357 -0
- package/src/index.ts +6 -5
- package/src/internal.types.ts +3 -1
- package/src/playback/index.ts +17 -0
- package/src/playback.types.ts +11 -1
- package/src/plugins/dash-playback/DashPlayback.ts +38 -114
- package/src/plugins/hls-playback/HlsPlayback.ts +561 -386
- package/src/types.ts +5 -3
- package/src/typings/@clappr/core/error_mixin.d.ts +0 -2
- package/src/typings/@clappr/core/index.d.ts +5 -0
- package/src/typings/@clappr/index.d.ts +1 -0
- package/src/utils/__tests__/mediaSources.test.ts +230 -0
- package/src/utils/mediaSources.ts +67 -63
- package/src/utils/testUtils.ts +15 -0
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +8 -0
- package/licenses.json +0 -782
- package/src/utils/queryParams.ts +0 -5
package/lib/Player.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type PlayerEventHandler<T extends PlayerEvent> = () => void;
|
|
|
7
7
|
/**
|
|
8
8
|
* @beta
|
|
9
9
|
*/
|
|
10
|
-
export type PlaybackModule = 'dash' | 'hls' | '
|
|
10
|
+
export type PlaybackModule = 'dash' | 'hls' | 'html5_video';
|
|
11
11
|
/**
|
|
12
12
|
* The main component to use in the application code.
|
|
13
13
|
* @remarks
|
|
@@ -114,6 +114,7 @@ export declare class Player {
|
|
|
114
114
|
private events;
|
|
115
115
|
private buildCoreOptions;
|
|
116
116
|
private configurePlaybacks;
|
|
117
|
-
private
|
|
117
|
+
private buildMediaSourcesList;
|
|
118
|
+
private bindContainerEventListeners;
|
|
118
119
|
}
|
|
119
120
|
//# sourceMappingURL=Player.d.ts.map
|
package/lib/Player.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,YAAY,EACb,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAQtD;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,IAAI,CAAA;AAelE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,CAAA;AAI3D;;;;;;;GAOG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAgC;IAE9C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,QAAQ,CAA2B;IAE3C,OAAO,CAAC,aAAa,CAA6C;IAElE,OAAO,CAAC,OAAO,CAAQ;gBAQX,MAAM,EAAE,YAAY;IAIhC;;;;OAIG;IACH,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAIlE;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAInE;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;IAIvC;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI;IAyB1C;;OAEG;IACH,OAAO;IAgBP;;;OAGG;IACH,cAAc,IAAI,MAAM;IAOxB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAOrB;;OAEG;IACH,IAAI;IAIJ;;OAEG;IACH,MAAM;IAIN;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,IAAI;IAIJ;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIjD;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM;IAIjB;;OAEG;IACH,IAAI;IAIJ;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY;IAI1C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY;IAI5C,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,UAAU;YAqBJ,MAAM;IAwEpB,OAAO,CAAC,MAAM,CAiDb;IAED,OAAO,CAAC,gBAAgB;IAuCxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,2BAA2B;CAcpC"}
|
package/lib/Player.js
CHANGED
|
@@ -3,9 +3,8 @@ import { reportError, trace } from '@gcorevideo/utils';
|
|
|
3
3
|
import assert from 'assert';
|
|
4
4
|
import EventLite from 'event-lite';
|
|
5
5
|
import { PlayerEvent } from './types.js';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { buildSourcesPriorityList, buildSourcesSet, unwrapSource, } from './utils/mediaSources.js';
|
|
6
|
+
import { buildMediaSourcesList, unwrapSource, wrapSource, } from './utils/mediaSources.js';
|
|
7
|
+
import { registerPlaybacks } from './playback/index.js';
|
|
9
8
|
const T = 'GPlayer';
|
|
10
9
|
const DEFAULT_OPTIONS = {
|
|
11
10
|
autoPlay: false,
|
|
@@ -33,6 +32,9 @@ export class Player {
|
|
|
33
32
|
rootNode = null;
|
|
34
33
|
tuneInTimerId = null;
|
|
35
34
|
tunedIn = false;
|
|
35
|
+
// private sourcesList: PlayerMediaSourceDesc[] = []
|
|
36
|
+
// private currentSourceIndex = 0
|
|
37
|
+
// private sourcesDelay: Record<string, number> = {}
|
|
36
38
|
constructor(config) {
|
|
37
39
|
this.setConfig(config);
|
|
38
40
|
}
|
|
@@ -216,16 +218,8 @@ export class Player {
|
|
|
216
218
|
}
|
|
217
219
|
this.tunedIn = true;
|
|
218
220
|
const player = this.player;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
player.core.handleFullscreenChange();
|
|
223
|
-
}
|
|
224
|
-
catch (e) {
|
|
225
|
-
reportError(e);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
221
|
+
this.bindContainerEventListeners(player);
|
|
222
|
+
player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => this.bindContainerEventListeners(player), null);
|
|
229
223
|
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
230
224
|
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
231
225
|
orientation,
|
|
@@ -282,6 +276,7 @@ export class Player {
|
|
|
282
276
|
clearTimeout(this.tuneInTimerId);
|
|
283
277
|
this.tuneInTimerId = null;
|
|
284
278
|
}
|
|
279
|
+
// TODO ensure that CORE_ACTIVE_CONTAINER_CHANGED does not get caught before onReady
|
|
285
280
|
setTimeout(() => this.tuneIn(), 0);
|
|
286
281
|
},
|
|
287
282
|
onResize: (newSize) => {
|
|
@@ -323,7 +318,11 @@ export class Player {
|
|
|
323
318
|
},
|
|
324
319
|
};
|
|
325
320
|
buildCoreOptions(rootNode) {
|
|
326
|
-
|
|
321
|
+
this.buildMediaSourcesList();
|
|
322
|
+
const source = this.config.sources[0];
|
|
323
|
+
if (!source) {
|
|
324
|
+
trace(`${T} buildCoreOptions no source selected`);
|
|
325
|
+
}
|
|
327
326
|
this.rootNode = rootNode;
|
|
328
327
|
const coreOptions = {
|
|
329
328
|
...this.config, // plugin settings
|
|
@@ -349,17 +348,31 @@ export class Player {
|
|
|
349
348
|
playbackType: this.config.playbackType,
|
|
350
349
|
width: rootNode.clientWidth,
|
|
351
350
|
source: source ? unwrapSource(source) : undefined,
|
|
351
|
+
sources: undefined,
|
|
352
352
|
strings: this.config.strings,
|
|
353
353
|
};
|
|
354
354
|
return coreOptions;
|
|
355
355
|
}
|
|
356
356
|
configurePlaybacks() {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
registerPlaybacks();
|
|
358
|
+
}
|
|
359
|
+
buildMediaSourcesList() {
|
|
360
|
+
return buildMediaSourcesList(// TODO ensure unsupported sources are filtered out
|
|
361
|
+
this.config.sources.map(s => wrapSource(s)), this.config.priorityTransport);
|
|
360
362
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
363
|
+
bindContainerEventListeners(player) {
|
|
364
|
+
trace(`${T} bindContainerEventListeners`, {
|
|
365
|
+
activePlayback: player.core.activePlayback?.name,
|
|
366
|
+
});
|
|
367
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
368
|
+
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
369
|
+
try {
|
|
370
|
+
player.core.handleFullscreenChange();
|
|
371
|
+
}
|
|
372
|
+
catch (e) {
|
|
373
|
+
reportError(e);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
364
377
|
}
|
|
365
378
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { setTracer } from
|
|
11
|
-
export * from
|
|
12
|
-
export
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
10
|
+
export { setTracer } from '@gcorevideo/utils';
|
|
11
|
+
export * from './Player.js';
|
|
12
|
+
export { PlaybackError } from './internal.types.js';
|
|
13
|
+
export * from './playback.types.js';
|
|
14
|
+
export * from './types.js';
|
|
15
|
+
export * from './version.js';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { setTracer } from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
10
|
+
export { setTracer } from '@gcorevideo/utils';
|
|
11
|
+
export * from './Player.js';
|
|
12
|
+
export * from './playback.types.js';
|
|
13
|
+
export * from './types.js';
|
|
14
|
+
export * from './version.js';
|
package/lib/internal.types.d.ts
CHANGED
|
@@ -37,13 +37,15 @@ export interface CorePlaybackConfig {
|
|
|
37
37
|
}
|
|
38
38
|
type ErrorLevel = "FATAL" | "WARN" | "INFO";
|
|
39
39
|
/**
|
|
40
|
-
* @
|
|
40
|
+
* @beta
|
|
41
41
|
*/
|
|
42
42
|
export type PlaybackError = {
|
|
43
43
|
code?: number | string;
|
|
44
44
|
description: string;
|
|
45
45
|
raw?: MediaError;
|
|
46
46
|
level?: ErrorLevel;
|
|
47
|
+
message: string;
|
|
48
|
+
scope?: string;
|
|
47
49
|
};
|
|
48
50
|
/**
|
|
49
51
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.types.d.ts","sourceRoot":"","sources":["../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,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,iBAAiB,GAAG,UAAU,EAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/playback/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,SAGhC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,WAE5D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,WAE3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Loader } from '@clappr/core';
|
|
2
|
+
import DashPlayback from '../plugins/dash-playback/DashPlayback.js';
|
|
3
|
+
import HlsPlayback from '../plugins/hls-playback/HlsPlayback.js';
|
|
4
|
+
export function registerPlaybacks() {
|
|
5
|
+
Loader.registerPlayback(DashPlayback);
|
|
6
|
+
Loader.registerPlayback(HlsPlayback);
|
|
7
|
+
}
|
|
8
|
+
export function canPlayDash(source, mimeType) {
|
|
9
|
+
return DashPlayback.canPlay(source, mimeType);
|
|
10
|
+
}
|
|
11
|
+
export function canPlayHls(source, mimeType) {
|
|
12
|
+
return HlsPlayback.canPlay(source, mimeType);
|
|
13
|
+
}
|
package/lib/playback.types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Playback time in seconds since the beginning of the stream (or a segment for the live streams)
|
|
2
3
|
* For the plugin development
|
|
3
4
|
* @internal
|
|
4
5
|
*/
|
|
@@ -34,4 +35,12 @@ export type QualityLevel = {
|
|
|
34
35
|
height: number;
|
|
35
36
|
bitrate: number;
|
|
36
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export declare enum PlaybackErrorCode {
|
|
42
|
+
Generic = 0,
|
|
43
|
+
MediaSourceUnavailable = 1,
|
|
44
|
+
QualityLevelUnavailable = 2
|
|
45
|
+
}
|
|
37
46
|
//# sourceMappingURL=playback.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playback.types.d.ts","sourceRoot":"","sources":["../src/playback.types.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"playback.types.d.ts","sourceRoot":"","sources":["../src/playback.types.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;CAAE,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG;IACtC,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,sBAAsB,IAAI;IAC1B,uBAAuB,IAAI;CAC5B"}
|
package/lib/playback.types.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @beta
|
|
3
|
+
*/
|
|
4
|
+
export var PlaybackErrorCode;
|
|
5
|
+
(function (PlaybackErrorCode) {
|
|
6
|
+
PlaybackErrorCode[PlaybackErrorCode["Generic"] = 0] = "Generic";
|
|
7
|
+
PlaybackErrorCode[PlaybackErrorCode["MediaSourceUnavailable"] = 1] = "MediaSourceUnavailable";
|
|
8
|
+
PlaybackErrorCode[PlaybackErrorCode["QualityLevelUnavailable"] = 2] = "QualityLevelUnavailable";
|
|
9
|
+
})(PlaybackErrorCode || (PlaybackErrorCode = {}));
|
|
@@ -25,7 +25,6 @@ export default class DashPlayback extends HTML5Video {
|
|
|
25
25
|
_localEndTimeCorrelation: LocalTimeCorrelation | null;
|
|
26
26
|
startChangeQuality: boolean;
|
|
27
27
|
manifestInfo: IManifestInfo | null;
|
|
28
|
-
_segmentTargetDuration: TimeValue | null;
|
|
29
28
|
_timeUpdateTimer: ReturnType<typeof setInterval> | null;
|
|
30
29
|
get name(): string;
|
|
31
30
|
get levels(): QualityLevel[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashPlayback.d.ts","sourceRoot":"","sources":["../../../src/plugins/dash-playback/DashPlayback.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAO,QAAQ,EAAS,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"DashPlayback.d.ts","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kB,UAAQ;IAE1B,YAAY,EAAE,aAAa,GAAG,IAAI,CAAO;IAEzC,gBAAgB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,IAAI,CAAO;IAE9D,IAAI,IAAI,WAEP;IAED,IAAI,MAAM,IAAI,YAAY,EAAE,CAE3B;IAED,IAAI,YAAY,IAAI,MAAM,CAMzB;IAED,IAAI,OAAO,YAEV;IAED,IAAI,YAAY,CAAC,EAAE,EAAE,MAAM,EAkC1B;IAED,IAAI,UAAU,WASb;IAED,IAAI,IAAI,WAEP;IAID,IAAI,sBAAsB,WAczB;IAID,IAAI,oBAAoB,WAgBvB;IAED,IAAI,SAAS,WAKZ;gBAEW,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,GAAG;IAOzD,MAAM;IAyEN,MAAM;IAMN,MAAM;YAMW,SAAS;IAI1B,qBAAqB;IAQrB,oBAAoB;IAMpB,kBAAkB;IAOlB,WAAW,IAAI,SAAS;IAQxB,cAAc,IAAI,SAAS;IAO3B,kBAAkB,IAAI,SAAS;IAI/B,cAAc,CAAC,UAAU,EAAE,MAAM;IAejC,IAAI,CAAC,IAAI,EAAE,SAAS;IAgBpB,eAAe;IAIf,UAAU,CAAC,MAAM,EAAE,OAAO;IAKjB,eAAe;IAgBxB,OAAO,CAAC,gBAAgB,CAGvB;IAED,OAAO,CAAC,eAAe,CAoCtB;IAED,aAAa;IAqBb,iBAAiB;IAWjB,IAAI,UAAU,YASb;IAED,WAAW;IAmBX,IAAI;IAUJ,KAAK;IAWL,IAAI;IASJ,OAAO;IAkBP,mBAAmB;IAYnB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE;IAarC,OAAO,CAAC,aAAa;IASrB,eAAe;IAIf,aAAa;CAGd"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
import { Events, HTML5Video, Log, Playback, Utils } from '@clappr/core';
|
|
5
|
+
import { trace } from '@gcorevideo/utils';
|
|
5
6
|
import assert from 'assert';
|
|
6
7
|
import DASHJS from 'dashjs';
|
|
7
|
-
import {
|
|
8
|
+
import { PlaybackErrorCode } from '../../playback.types.js';
|
|
8
9
|
const AUTO = -1;
|
|
9
10
|
const { now } = Utils;
|
|
10
11
|
const T = 'DashPlayback';
|
|
@@ -45,8 +46,6 @@ export default class DashPlayback extends HTML5Video {
|
|
|
45
46
|
_localEndTimeCorrelation = null;
|
|
46
47
|
startChangeQuality = false;
|
|
47
48
|
manifestInfo = null;
|
|
48
|
-
// #EXT-X-TARGETDURATION
|
|
49
|
-
_segmentTargetDuration = null;
|
|
50
49
|
_timeUpdateTimer = null;
|
|
51
50
|
get name() {
|
|
52
51
|
return 'dash';
|
|
@@ -67,6 +66,8 @@ export default class DashPlayback extends HTML5Video {
|
|
|
67
66
|
set currentLevel(id) {
|
|
68
67
|
this._currentLevel = id;
|
|
69
68
|
this.trigger(Events.PLAYBACK_LEVEL_SWITCH_START);
|
|
69
|
+
assert.ok(this._dash, 'An instance of dashjs MediaPlayer is required to switch levels');
|
|
70
|
+
const dash = this._dash;
|
|
70
71
|
// TODO use $.extend
|
|
71
72
|
const settings = this.options.dash ? structuredClone(this.options.dash) : {};
|
|
72
73
|
settings.streaming = settings.streaming || {};
|
|
@@ -74,8 +75,6 @@ export default class DashPlayback extends HTML5Video {
|
|
|
74
75
|
settings.streaming.abr.autoSwitchBitrate =
|
|
75
76
|
settings.streaming.abr.autoSwitchBitrate || {};
|
|
76
77
|
settings.streaming.abr.autoSwitchBitrate.video = id === -1;
|
|
77
|
-
assert.ok(this._dash, 'An instance of dashjs MediaPlayer is required to switch levels');
|
|
78
|
-
const dash = this._dash;
|
|
79
78
|
dash.updateSettings(settings);
|
|
80
79
|
if (id !== -1) {
|
|
81
80
|
this._dash.setQualityFor('video', id);
|
|
@@ -222,9 +221,6 @@ export default class DashPlayback extends HTML5Video {
|
|
|
222
221
|
return this._duration;
|
|
223
222
|
}
|
|
224
223
|
getCurrentTime() {
|
|
225
|
-
// e.g. can be < 0 if user pauses near the start
|
|
226
|
-
// eventually they will then be kicked to the end by hlsjs if they run out of buffer
|
|
227
|
-
// before the official start time
|
|
228
224
|
return this._dash ? this._dash.time() : 0;
|
|
229
225
|
}
|
|
230
226
|
// the time that "0" now represents relative to when playback started
|
|
@@ -282,85 +278,28 @@ export default class DashPlayback extends HTML5Video {
|
|
|
282
278
|
};
|
|
283
279
|
_onDASHJSSError = (event) => {
|
|
284
280
|
trace(`${T} _onDASHJSSError`, { event });
|
|
285
|
-
// TODO
|
|
286
|
-
// only report/handle errors if they are fatal
|
|
281
|
+
// TODO figure out what's for
|
|
287
282
|
this._stopTimeUpdateTimer();
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
// These errors have useful error messages, so we forward it on
|
|
309
|
-
const formattedError = this.createError(event.error);
|
|
310
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
311
|
-
if (event.error) {
|
|
312
|
-
Log.error(event.event.message);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if (event.error === 'mediasource') {
|
|
316
|
-
// This error happens when dash.js fails to allocate a SourceBuffer
|
|
317
|
-
// OR the underlying video element throws a `MediaError`.
|
|
318
|
-
// If it's a buffer allocation fail, the message states which buffer
|
|
319
|
-
// (audio/video/text) failed allocation.
|
|
320
|
-
// If it's a `MediaError`, dash.js inspects the error object for
|
|
321
|
-
// additional information to append to the error type.
|
|
322
|
-
const formattedError = this.createError(event.error);
|
|
323
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
324
|
-
Log.error(event.event);
|
|
325
|
-
}
|
|
326
|
-
else if (event.error === 'capability' &&
|
|
327
|
-
event.event === 'encryptedmedia') {
|
|
328
|
-
// Browser doesn't support EME
|
|
329
|
-
const formattedError = this.createError(event.error);
|
|
330
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
331
|
-
Log.error('The media cannot be played because it requires encryption ' +
|
|
332
|
-
'that your browser does not support.');
|
|
333
|
-
}
|
|
334
|
-
else if (event.error === 'key_session') {
|
|
335
|
-
// This block handles pretty much all errors thrown by the
|
|
336
|
-
// encryption subsystem
|
|
337
|
-
const formattedError = this.createError(event.error);
|
|
338
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
339
|
-
Log.error(event.event);
|
|
340
|
-
}
|
|
341
|
-
else if (event.error === 'download') {
|
|
342
|
-
const formattedError = this.createError(event.error);
|
|
343
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
344
|
-
Log.error('The media playback was aborted because too many consecutive ' +
|
|
345
|
-
'download errors occurred.');
|
|
346
|
-
// } else if (event.error === 'mssError') {
|
|
347
|
-
// const formattedError = this.createError(event.error);
|
|
348
|
-
// this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
349
|
-
// if (event.error) {
|
|
350
|
-
// Log.error(event.error.message);
|
|
351
|
-
// }
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
// ignore the error
|
|
355
|
-
if (typeof event.error === 'object') {
|
|
356
|
-
const formattedError = this.createError(event.error);
|
|
357
|
-
this.trigger(Events.PLAYBACK_ERROR, formattedError);
|
|
358
|
-
Log.error(event.error.message);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
Log.error(event.error);
|
|
362
|
-
}
|
|
363
|
-
return;
|
|
283
|
+
const e = event.error;
|
|
284
|
+
switch (e.code) {
|
|
285
|
+
case DASHJS.MediaPlayer.errors.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE:
|
|
286
|
+
case DASHJS.MediaPlayer.errors.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE:
|
|
287
|
+
case DASHJS.MediaPlayer.errors.DOWNLOAD_ERROR_ID_MANIFEST_CODE:
|
|
288
|
+
this.trigger(Events.PLAYBACK_ERROR, this.createError({
|
|
289
|
+
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
290
|
+
message: e.message,
|
|
291
|
+
}, {
|
|
292
|
+
useCodePrefix: false,
|
|
293
|
+
}));
|
|
294
|
+
break;
|
|
295
|
+
// TODO more cases
|
|
296
|
+
default:
|
|
297
|
+
this.trigger(Events.PLAYBACK_ERROR, this.createError({
|
|
298
|
+
code: PlaybackErrorCode.Generic,
|
|
299
|
+
message: e.message,
|
|
300
|
+
}, {
|
|
301
|
+
useCodePrefix: false,
|
|
302
|
+
}));
|
|
364
303
|
}
|
|
365
304
|
// only reset the dash player in 10ms async, so that the rest of the
|
|
366
305
|
// calling function finishes
|
|
@@ -475,6 +414,9 @@ export default class DashPlayback extends HTML5Video {
|
|
|
475
414
|
this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this._levels);
|
|
476
415
|
}
|
|
477
416
|
onLevelSwitch(currentLevel) {
|
|
417
|
+
// TODO check the two below
|
|
418
|
+
this.trigger(Events.PLAYBACK_LEVEL_SWITCH, currentLevel);
|
|
419
|
+
this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END);
|
|
478
420
|
const isHD = (currentLevel.height >= 720 || (currentLevel.bitrate / 1000) >= 2000);
|
|
479
421
|
this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE, isHD);
|
|
480
422
|
this.trigger(Events.PLAYBACK_BITRATE, currentLevel);
|
|
@@ -491,18 +433,12 @@ DashPlayback.canPlay = function (resource, mimeType) {
|
|
|
491
433
|
const isDash = (resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'mpd') ||
|
|
492
434
|
mimeType === 'application/dash+xml' ||
|
|
493
435
|
mimeType === 'video/mp4';
|
|
436
|
+
if (!isDash) {
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
494
439
|
const ms = window.MediaSource;
|
|
495
440
|
const mms = 'ManagedMediaSource' in window ? window.ManagedMediaSource : undefined;
|
|
496
441
|
const wms = 'WebKitMediaSource' in window ? window.WebKitMediaSource : undefined;
|
|
497
442
|
const ctor = ms || mms || wms;
|
|
498
|
-
|
|
499
|
-
trace(`${T} canPlay`, {
|
|
500
|
-
hasSupport,
|
|
501
|
-
isDash,
|
|
502
|
-
resource,
|
|
503
|
-
ms: typeof ms === 'function',
|
|
504
|
-
mms: typeof mms === 'function',
|
|
505
|
-
wms: typeof wms === 'function',
|
|
506
|
-
});
|
|
507
|
-
return !!(hasSupport && isDash);
|
|
443
|
+
return typeof ctor === 'function';
|
|
508
444
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/dash-playback/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTML5Video } from '@clappr/core';
|
|
2
|
-
import HLSJS, { HlsEvents, type HlsErrorData, type FragChangedData, type FragLoadedData, type FragParsingMetadataData, type LevelSwitchingData } from 'hls.js';
|
|
2
|
+
import HLSJS, { Events as HlsEvents, type ErrorData as HlsErrorData, type FragChangedData, type FragLoadedData, type FragParsingMetadataData, type LevelSwitchingData } from 'hls.js';
|
|
3
3
|
import { QualityLevel } from '../../playback.types.js';
|
|
4
4
|
import { PlaybackType } from '../../types';
|
|
5
5
|
type ErrorInfo = Record<string, unknown>;
|
|
@@ -66,10 +66,10 @@ export default class HlsPlayback extends HTML5Video {
|
|
|
66
66
|
render(): this;
|
|
67
67
|
_ready(): void;
|
|
68
68
|
_recover(evt: HlsEvents.ERROR, data: HlsErrorData, error: ErrorInfo): void;
|
|
69
|
-
|
|
69
|
+
protected _setupSrc(srcUrl: string): void;
|
|
70
70
|
_startTimeUpdateTimer(): void;
|
|
71
71
|
_stopTimeUpdateTimer(): void;
|
|
72
|
-
getProgramDateTime():
|
|
72
|
+
getProgramDateTime(): number;
|
|
73
73
|
getDuration(): number;
|
|
74
74
|
getCurrentTime(): number;
|
|
75
75
|
getStartTimeOffset(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HlsPlayback.d.ts","sourceRoot":"","sources":["../../../src/plugins/hls-playback/HlsPlayback.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"HlsPlayback.d.ts","sourceRoot":"","sources":["../../../src/plugins/hls-playback/HlsPlayback.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,UAAU,EAKX,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,EACZ,MAAM,IAAI,SAAS,EAEnB,KAAK,SAAS,IAAI,YAAY,EAE9B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAG5B,KAAK,kBAAkB,EACxB,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAqB,YAAY,EAA4B,MAAM,yBAAyB,CAAA;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAwC1C,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAGxC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IACjD,OAAO,CAAC,UAAU,CAAQ;IAE1B,OAAO,CAAC,gBAAgB,CAAQ;IAEhC,OAAO,CAAC,gBAAgB,CAAwB;IAEhD,OAAO,CAAC,aAAa,CAAsB;IAE3C,OAAO,CAAC,mCAAmC,CAAQ;IAEnD,OAAO,CAAC,8BAA8B,CAAI;IAE1C,OAAO,CAAC,cAAc,CAAQ;IAE9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