@gcorevideo/player 2.10.0 → 2.12.2
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 -1209
- package/lib/Player.d.ts +3 -2
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +32 -24
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -5
- package/lib/internal.types.d.ts +1 -10
- 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 +19 -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 +1 -1
- package/lib/plugins/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/plugins/dash-playback/DashPlayback.js +39 -100
- 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 +6 -7
- package/lib/plugins/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/plugins/hls-playback/HlsPlayback.js +131 -80
- 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 +40 -31
- package/src/__tests__/Player.test.ts +357 -0
- package/src/index.ts +5 -5
- package/src/internal.types.ts +1 -12
- package/src/playback/index.ts +17 -0
- package/src/playback.types.ts +29 -8
- package/src/plugins/dash-playback/DashPlayback.ts +44 -120
- package/src/plugins/hls-playback/HlsPlayback.ts +544 -390
- 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 +78 -64
- 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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,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;IAQ7B,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,
|
|
@@ -73,9 +72,6 @@ export class Player {
|
|
|
73
72
|
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
74
73
|
Log.setLevel(0);
|
|
75
74
|
}
|
|
76
|
-
trace(`${T} init`, {
|
|
77
|
-
// TODO selected options
|
|
78
|
-
});
|
|
79
75
|
this.configurePlaybacks();
|
|
80
76
|
const coreOpts = this.buildCoreOptions(playerElement);
|
|
81
77
|
const { core, container } = Loader.registeredPlugins;
|
|
@@ -216,16 +212,8 @@ export class Player {
|
|
|
216
212
|
}
|
|
217
213
|
this.tunedIn = true;
|
|
218
214
|
const player = this.player;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
player.core.handleFullscreenChange();
|
|
223
|
-
}
|
|
224
|
-
catch (e) {
|
|
225
|
-
reportError(e);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
215
|
+
this.bindContainerEventListeners(player);
|
|
216
|
+
player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => this.bindContainerEventListeners(player), null);
|
|
229
217
|
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
230
218
|
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
231
219
|
orientation,
|
|
@@ -282,6 +270,7 @@ export class Player {
|
|
|
282
270
|
clearTimeout(this.tuneInTimerId);
|
|
283
271
|
this.tuneInTimerId = null;
|
|
284
272
|
}
|
|
273
|
+
// TODO ensure that CORE_ACTIVE_CONTAINER_CHANGED does not get caught before onReady
|
|
285
274
|
setTimeout(() => this.tuneIn(), 0);
|
|
286
275
|
},
|
|
287
276
|
onResize: (newSize) => {
|
|
@@ -323,13 +312,17 @@ export class Player {
|
|
|
323
312
|
},
|
|
324
313
|
};
|
|
325
314
|
buildCoreOptions(rootNode) {
|
|
326
|
-
const
|
|
315
|
+
const sources = this.buildMediaSourcesList();
|
|
316
|
+
const source = sources[0];
|
|
317
|
+
trace(`${T} buildCoreOptions`, {
|
|
318
|
+
source
|
|
319
|
+
});
|
|
327
320
|
this.rootNode = rootNode;
|
|
328
321
|
const coreOptions = {
|
|
329
322
|
...this.config, // plugin settings
|
|
330
323
|
allowUserInteraction: true,
|
|
331
324
|
autoPlay: false,
|
|
332
|
-
dash: this.config.dash,
|
|
325
|
+
dash: this.config.dash, // TODO move this to the playback section
|
|
333
326
|
debug: this.config.debug || 'none',
|
|
334
327
|
events: this.events,
|
|
335
328
|
height: rootNode.clientHeight,
|
|
@@ -349,17 +342,32 @@ export class Player {
|
|
|
349
342
|
playbackType: this.config.playbackType,
|
|
350
343
|
width: rootNode.clientWidth,
|
|
351
344
|
source: source ? unwrapSource(source) : undefined,
|
|
345
|
+
sources, // prevent Clappr from loading all sources simultaneously
|
|
352
346
|
strings: this.config.strings,
|
|
353
347
|
};
|
|
354
348
|
return coreOptions;
|
|
355
349
|
}
|
|
356
350
|
configurePlaybacks() {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
351
|
+
registerPlaybacks();
|
|
352
|
+
}
|
|
353
|
+
buildMediaSourcesList() {
|
|
354
|
+
return buildMediaSourcesList(
|
|
355
|
+
// TODO ensure unsupported sources are filtered out
|
|
356
|
+
this.config.sources.map((s) => wrapSource(s)), this.config.priorityTransport);
|
|
360
357
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
358
|
+
bindContainerEventListeners(player) {
|
|
359
|
+
trace(`${T} bindContainerEventListeners`, {
|
|
360
|
+
activePlayback: player.core.activePlayback?.name,
|
|
361
|
+
});
|
|
362
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
363
|
+
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
364
|
+
try {
|
|
365
|
+
player.core.handleFullscreenChange();
|
|
366
|
+
}
|
|
367
|
+
catch (e) {
|
|
368
|
+
reportError(e);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
364
372
|
}
|
|
365
373
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
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';
|
|
15
15
|
//# 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,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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CorePlugin, ContainerPlugin, Playback as ClapprPlayback } from "@clappr/core";
|
|
2
2
|
import { PlaybackType, PlayerDebugTag, PlayerMediaSource } from "./types";
|
|
3
|
+
import { PlaybackError } from "./playback.types";
|
|
3
4
|
type ExternalTrack = {
|
|
4
5
|
kind?: "subtitles" | "captions";
|
|
5
6
|
src: string;
|
|
@@ -35,16 +36,6 @@ export interface CorePlaybackConfig {
|
|
|
35
36
|
preload?: 'metadata' | 'auto' | 'none';
|
|
36
37
|
shakaConfiguration?: ShakaConfig;
|
|
37
38
|
}
|
|
38
|
-
type ErrorLevel = "FATAL" | "WARN" | "INFO";
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
export type PlaybackError = {
|
|
43
|
-
code?: number | string;
|
|
44
|
-
description: string;
|
|
45
|
-
raw?: MediaError;
|
|
46
|
-
level?: ErrorLevel;
|
|
47
|
-
};
|
|
48
39
|
/**
|
|
49
40
|
* @internal
|
|
50
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.types.d.ts","sourceRoot":"","sources":["../src/internal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,QAAQ,IAAI,cAAc,EAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.types.d.ts","sourceRoot":"","sources":["../src/internal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,QAAQ,IAAI,cAAc,EAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED,KAAK,kBAAkB,GAAG;IAExB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA;AAED;;;GAGG;AACH,KAAK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
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,22 @@ 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
|
+
}
|
|
46
|
+
export type ErrorLevel = 'FATAL' | 'WARN' | 'INFO';
|
|
47
|
+
/**
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export interface PlaybackError {
|
|
51
|
+
code: PlaybackErrorCode;
|
|
52
|
+
description: string;
|
|
53
|
+
level: ErrorLevel;
|
|
54
|
+
message: string;
|
|
55
|
+
}
|
|
37
56
|
//# sourceMappingURL=playback.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playback.types.d.ts","sourceRoot":"","sources":["../src/playback.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playback.types.d.ts","sourceRoot":"","sources":["../src/playback.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,SAAS,CAAA;IAClB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG;IACtC,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;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;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,UAAU,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
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[];
|
|
@@ -55,6 +54,7 @@ export default class DashPlayback extends HTML5Video {
|
|
|
55
54
|
_updateSettings(): void;
|
|
56
55
|
private _onPlaybackError;
|
|
57
56
|
private _onDASHJSSError;
|
|
57
|
+
private triggerError;
|
|
58
58
|
_onTimeUpdate(): void;
|
|
59
59
|
_onDurationChange(): void;
|
|
60
60
|
get dvrEnabled(): boolean;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"DashPlayback.d.ts","sourceRoot":"","sources":["../../../src/plugins/dash-playback/DashPlayback.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAO,QAAQ,EAAsB,MAAM,cAAc,CAAA;AAGpF,OAAO,MAAM,EAAE,EAIb,KAAK,WAAW,IAAI,eAAe,EAEnC,aAAa,EACd,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAoC,YAAY,EAAE,YAAY,EAAc,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAM7H,KAAK,YAAY,GACb,OAAO,QAAQ,CAAC,GAAG,GACnB,OAAO,QAAQ,CAAC,IAAI,GACpB,OAAO,QAAQ,CAAC,GAAG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,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,CA0BtB;IAED,OAAO,CAAC,YAAY;IAUpB,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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
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
|
-
import { Events, HTML5Video, Log, Playback, Utils } from '@clappr/core';
|
|
4
|
+
import { Events, HTML5Video, Log, Playback, PlayerError, 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,93 +278,39 @@ 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
|
|
287
281
|
this._stopTimeUpdateTimer();
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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;
|
|
282
|
+
const e = event.error;
|
|
283
|
+
switch (e.code) {
|
|
284
|
+
case DASHJS.MediaPlayer.errors.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE:
|
|
285
|
+
case DASHJS.MediaPlayer.errors.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE:
|
|
286
|
+
case DASHJS.MediaPlayer.errors.DOWNLOAD_ERROR_ID_MANIFEST_CODE:
|
|
287
|
+
case DASHJS.MediaPlayer.errors.DOWNLOAD_ERROR_ID_CONTENT_CODE:
|
|
288
|
+
this.triggerError({
|
|
289
|
+
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
290
|
+
message: e.message,
|
|
291
|
+
description: e.message,
|
|
292
|
+
level: PlayerError.Levels.FATAL,
|
|
293
|
+
});
|
|
294
|
+
break;
|
|
295
|
+
// TODO more cases
|
|
296
|
+
default:
|
|
297
|
+
this.triggerError({
|
|
298
|
+
code: PlaybackErrorCode.Generic,
|
|
299
|
+
message: e.message,
|
|
300
|
+
description: e.message,
|
|
301
|
+
level: PlayerError.Levels.FATAL,
|
|
302
|
+
});
|
|
364
303
|
}
|
|
304
|
+
};
|
|
305
|
+
triggerError(error) {
|
|
306
|
+
trace(`${T} triggerError`, { error });
|
|
307
|
+
this.trigger(Events.PLAYBACK_ERROR, error);
|
|
365
308
|
// only reset the dash player in 10ms async, so that the rest of the
|
|
366
309
|
// calling function finishes
|
|
367
310
|
setTimeout(() => {
|
|
368
|
-
|
|
369
|
-
this._dash.reset();
|
|
311
|
+
this.stop();
|
|
370
312
|
}, 10);
|
|
371
|
-
}
|
|
313
|
+
}
|
|
372
314
|
_onTimeUpdate() {
|
|
373
315
|
if (this.startChangeQuality) {
|
|
374
316
|
return;
|
|
@@ -475,6 +417,9 @@ export default class DashPlayback extends HTML5Video {
|
|
|
475
417
|
this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this._levels);
|
|
476
418
|
}
|
|
477
419
|
onLevelSwitch(currentLevel) {
|
|
420
|
+
// TODO check the two below
|
|
421
|
+
this.trigger(Events.PLAYBACK_LEVEL_SWITCH, currentLevel);
|
|
422
|
+
this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END);
|
|
478
423
|
const isHD = (currentLevel.height >= 720 || (currentLevel.bitrate / 1000) >= 2000);
|
|
479
424
|
this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE, isHD);
|
|
480
425
|
this.trigger(Events.PLAYBACK_BITRATE, currentLevel);
|
|
@@ -491,18 +436,12 @@ DashPlayback.canPlay = function (resource, mimeType) {
|
|
|
491
436
|
const isDash = (resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'mpd') ||
|
|
492
437
|
mimeType === 'application/dash+xml' ||
|
|
493
438
|
mimeType === 'video/mp4';
|
|
439
|
+
if (!isDash) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
494
442
|
const ms = window.MediaSource;
|
|
495
443
|
const mms = 'ManagedMediaSource' in window ? window.ManagedMediaSource : undefined;
|
|
496
444
|
const wms = 'WebKitMediaSource' in window ? window.WebKitMediaSource : undefined;
|
|
497
445
|
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);
|
|
446
|
+
return typeof ctor === 'function';
|
|
508
447
|
};
|
|
@@ -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,8 +1,7 @@
|
|
|
1
1
|
import { HTML5Video } from '@clappr/core';
|
|
2
|
-
import HLSJS, { HlsEvents, type HlsErrorData, type FragChangedData, type FragLoadedData, type FragParsingMetadataData, type LevelSwitchingData } from 'hls.js';
|
|
3
|
-
import { QualityLevel } from '../../playback.types.js';
|
|
2
|
+
import HLSJS, { Events as HlsEvents, type ErrorData as HlsErrorData, type FragChangedData, type FragLoadedData, type FragParsingMetadataData, type LevelSwitchingData } from 'hls.js';
|
|
3
|
+
import { PlaybackError, QualityLevel } from '../../playback.types.js';
|
|
4
4
|
import { PlaybackType } from '../../types';
|
|
5
|
-
type ErrorInfo = Record<string, unknown>;
|
|
6
5
|
export default class HlsPlayback extends HTML5Video {
|
|
7
6
|
private _ccIsSetup;
|
|
8
7
|
private _ccTracksUpdated;
|
|
@@ -65,11 +64,11 @@ export default class HlsPlayback extends HTML5Video {
|
|
|
65
64
|
_onFragmentParsingMetadata(evt: HlsEvents.FRAG_PARSING_METADATA, data: FragParsingMetadataData): void;
|
|
66
65
|
render(): this;
|
|
67
66
|
_ready(): void;
|
|
68
|
-
_recover(evt: HlsEvents.ERROR, data: HlsErrorData, error:
|
|
69
|
-
|
|
67
|
+
_recover(evt: HlsEvents.ERROR, data: HlsErrorData, error: PlaybackError): void;
|
|
68
|
+
protected _setupSrc(srcUrl: string): void;
|
|
70
69
|
_startTimeUpdateTimer(): void;
|
|
71
70
|
_stopTimeUpdateTimer(): void;
|
|
72
|
-
getProgramDateTime():
|
|
71
|
+
getProgramDateTime(): number;
|
|
73
72
|
getDuration(): number;
|
|
74
73
|
getCurrentTime(): number;
|
|
75
74
|
getStartTimeOffset(): number;
|
|
@@ -98,6 +97,6 @@ export default class HlsPlayback extends HTML5Video {
|
|
|
98
97
|
get dvrEnabled(): boolean;
|
|
99
98
|
getPlaybackType(): PlaybackType;
|
|
100
99
|
isSeekEnabled(): boolean;
|
|
100
|
+
private triggerError;
|
|
101
101
|
}
|
|
102
|
-
export {};
|
|
103
102
|
//# sourceMappingURL=HlsPlayback.d.ts.map
|
|
@@ -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,c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