@gcorevideo/player 2.22.16 → 2.22.18
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/assets/clappr-nerd-stats/clappr-nerd-stats.ejs +76 -78
- package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +10 -7
- package/dist/core.js +10 -14
- package/dist/index.css +1441 -1440
- package/dist/index.js +589 -522
- package/dist/player.d.ts +216 -159
- package/dist/plugins/index.css +1204 -1203
- package/dist/plugins/index.js +581 -506
- package/docs/api/player.clapprstats.exportmetrics.md +1 -1
- package/docs/api/player.clapprstats.md +5 -15
- package/docs/api/player.clapprstatssettings.md +13 -0
- package/docs/api/player.clips.destroy.md +18 -0
- package/docs/api/player.clips.disable.md +18 -0
- package/docs/api/player.clips.enable.md +18 -0
- package/docs/api/player.clips.md +170 -0
- package/docs/api/player.clips.render.md +18 -0
- package/docs/api/player.clips.supportedversion.md +16 -0
- package/docs/api/player.clips.version.md +14 -0
- package/docs/api/player.clipspluginsettings.md +2 -2
- package/docs/api/player.clipspluginsettings.text.md +1 -1
- package/docs/api/player.md +27 -18
- package/docs/api/player.mediacontrol.md +1 -1
- package/docs/api/{player.mediacontrol.getelement.md → player.mediacontrol.mount.md} +20 -7
- package/docs/api/player.mediacontrolleftelement.md +1 -1
- package/docs/api/{player.clapprnerdstats._constructor_.md → player.nerdstats._constructor_.md} +3 -3
- package/docs/api/{player.clapprnerdstats.md → player.nerdstats.md} +5 -5
- package/docs/api/player.qualitylevel.height.md +1 -1
- package/docs/api/player.qualitylevel.level.md +1 -1
- package/docs/api/player.qualitylevel.md +4 -4
- package/docs/api/player.qualitylevel.width.md +1 -1
- package/docs/api/player.timeposition.current.md +1 -1
- package/docs/api/player.timeposition.md +2 -2
- package/docs/api/player.timeposition.total.md +1 -1
- package/docs/api/player.timeprogress.md +6 -4
- package/docs/api/player.timevalue.md +1 -1
- package/lib/index.plugins.d.ts +2 -1
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts +0 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +9 -12
- package/lib/playback/hls-playback/HlsPlayback.d.ts +1 -1
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +0 -1
- package/lib/playback.types.d.ts +24 -12
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +4 -0
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +20 -23
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +86 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +390 -0
- package/lib/plugins/clappr-nerd-stats/formatter.d.ts +5 -0
- package/lib/plugins/clappr-nerd-stats/formatter.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/formatter.js +56 -24
- package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts +2 -2
- package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts +1 -1
- package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/types.d.ts +3 -0
- package/lib/plugins/clappr-nerd-stats/types.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/utils.d.ts +7 -0
- package/lib/plugins/clappr-nerd-stats/utils.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/utils.js +67 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +27 -32
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +94 -202
- package/lib/plugins/clappr-stats/types.d.ts +65 -25
- package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/types.js +37 -2
- package/lib/plugins/clappr-stats/utils.d.ts +1 -1
- package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/utils.js +1 -3
- package/lib/plugins/seek-time/SeekTime.d.ts +1 -1
- package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -1
- package/lib/plugins/seek-time/SeekTime.js +3 -4
- package/lib/testUtils.d.ts +2 -1
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +3 -2
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -1
- package/src/playback/dash-playback/DashPlayback.ts +10 -15
- package/src/playback/hls-playback/HlsPlayback.ts +2 -4
- package/src/playback.types.ts +25 -11
- package/src/plugins/clappr-nerd-stats/NerdStats.ts +503 -0
- package/src/plugins/clappr-nerd-stats/formatter.ts +91 -47
- package/src/plugins/clappr-nerd-stats/speedtest/index.ts +2 -2
- package/src/plugins/clappr-nerd-stats/speedtest/types.ts +1 -1
- package/src/plugins/clappr-nerd-stats/types.ts +43 -3
- package/src/plugins/clappr-nerd-stats/utils.ts +75 -0
- package/src/plugins/clappr-stats/ClapprStats.ts +242 -306
- package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +133 -0
- package/src/plugins/clappr-stats/types.ts +93 -47
- package/src/plugins/clappr-stats/utils.ts +4 -6
- package/src/plugins/error-screen/__tests__/ErrorScreen.test.ts +3 -4
- package/src/plugins/seek-time/SeekTime.ts +4 -5
- package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -0
- package/src/testUtils.ts +3 -2
- package/temp/player.api.json +311 -159
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.clapprstats.setupdatemetrics.md +0 -56
- package/docs/api/player.clipsplugin.gettext.md +0 -58
- package/docs/api/player.clipsplugin.md +0 -59
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +0 -435
|
@@ -1,8 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @beta
|
|
3
|
+
*/
|
|
4
|
+
export var Chronograph;
|
|
5
|
+
(function (Chronograph) {
|
|
6
|
+
Chronograph["Startup"] = "startup";
|
|
7
|
+
Chronograph["Watch"] = "watch";
|
|
8
|
+
Chronograph["Pause"] = "pause";
|
|
9
|
+
Chronograph["Buffering"] = "buffering";
|
|
10
|
+
Chronograph["Session"] = "session";
|
|
11
|
+
// Latency = 'latency',
|
|
12
|
+
})(Chronograph || (Chronograph = {}));
|
|
13
|
+
/**
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export var Counter;
|
|
17
|
+
(function (Counter) {
|
|
18
|
+
Counter["Play"] = "play";
|
|
19
|
+
Counter["Pause"] = "pause";
|
|
20
|
+
Counter["Error"] = "error";
|
|
21
|
+
Counter["Buffering"] = "buffering";
|
|
22
|
+
Counter["DecodedFrames"] = "decodedFrames";
|
|
23
|
+
Counter["DroppedFrames"] = "droppedFrames";
|
|
24
|
+
Counter["Fps"] = "fps";
|
|
25
|
+
Counter["ChangeLevel"] = "changeLevel";
|
|
26
|
+
Counter["Seek"] = "seek";
|
|
27
|
+
Counter["Fullscreen"] = "fullscreen";
|
|
28
|
+
Counter["DvrUsage"] = "dvrUsage";
|
|
29
|
+
})(Counter || (Counter = {}));
|
|
1
30
|
/**
|
|
2
31
|
* @beta
|
|
3
32
|
*/
|
|
4
33
|
export var ClapprStatsEvents;
|
|
5
34
|
(function (ClapprStatsEvents) {
|
|
6
|
-
|
|
7
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Emitted periodically with current measurements.
|
|
37
|
+
*/
|
|
38
|
+
ClapprStatsEvents["REPORT"] = "clappr:stats:report";
|
|
39
|
+
/**
|
|
40
|
+
* Emitted when the playback reaches a certain percentage of the total duration.
|
|
41
|
+
*/
|
|
42
|
+
// PERCENTAGE = 'clappr:stats:percentage',
|
|
8
43
|
})(ClapprStatsEvents || (ClapprStatsEvents = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-stats/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-stats/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,wBAAgB,UAAU,IAAI,OAAO,CAqCpC"}
|
|
@@ -13,13 +13,12 @@ export function newMetrics() {
|
|
|
13
13
|
fullscreen: 0,
|
|
14
14
|
dvrUsage: 0,
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
chrono: {
|
|
17
17
|
startup: 0,
|
|
18
18
|
watch: 0,
|
|
19
19
|
pause: 0,
|
|
20
20
|
buffering: 0,
|
|
21
21
|
session: 0,
|
|
22
|
-
latency: 0,
|
|
23
22
|
},
|
|
24
23
|
extra: {
|
|
25
24
|
playbackName: '',
|
|
@@ -35,6 +34,5 @@ export function newMetrics() {
|
|
|
35
34
|
duration: 0,
|
|
36
35
|
currentTime: 0,
|
|
37
36
|
},
|
|
38
|
-
custom: {},
|
|
39
37
|
};
|
|
40
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeekTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/seek-time/SeekTime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,YAAY,EAAmB,MAAM,cAAc,CAAC;AAM/E,OAAO,0CAA0C,CAAC;AAKlD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,IAAI,YAAY,QAEf;IAED,IAAI,qBAAqB,QAExB;IAED,IAAI,mBAAmB,QAItB;IAED,IAAI,aAAa,YAEhB;IAED,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAK;IAGrB,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,WAAW,CAA4B;IAE/C,OAAO,CAAC,WAAW,CAA4B;IAEtC,UAAU;IAWnB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"SeekTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/seek-time/SeekTime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,YAAY,EAAmB,MAAM,cAAc,CAAC;AAM/E,OAAO,0CAA0C,CAAC;AAKlD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,IAAI,YAAY,QAEf;IAED,IAAI,qBAAqB,QAExB;IAED,IAAI,mBAAmB,QAItB;IAED,IAAI,aAAa,YAEhB;IAED,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAK;IAGrB,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,WAAW,CAA4B;IAE/C,OAAO,CAAC,WAAW,CAA4B;IAEtC,UAAU;IAWnB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,sBAAsB;IAO9B,WAAW;;;IAYX,MAAM;IA8CN,eAAe;IAQN,MAAM;CAahB"}
|
|
@@ -56,7 +56,7 @@ export class SeekTime extends UICorePlugin {
|
|
|
56
56
|
this.listenTo(this.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.onContainerChanged);
|
|
57
57
|
if (this.mediaControlContainer) {
|
|
58
58
|
this.listenTo(this.mediaControlContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
|
|
59
|
-
this.listenTo(this.mediaControlContainer, Events.CONTAINER_TIMEUPDATE, this.
|
|
59
|
+
this.listenTo(this.mediaControlContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
onContainerChanged() {
|
|
@@ -64,9 +64,8 @@ export class SeekTime extends UICorePlugin {
|
|
|
64
64
|
this.stopListening();
|
|
65
65
|
this.bindEvents();
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
this.duration =
|
|
69
|
-
// this.firstFragDateTime = timeProgress.firstFragDateTime;
|
|
67
|
+
onTimeUpdate({ total }) {
|
|
68
|
+
this.duration = total;
|
|
70
69
|
this.update();
|
|
71
70
|
}
|
|
72
71
|
showTime(event) {
|
package/lib/testUtils.d.ts
CHANGED
|
@@ -94,9 +94,10 @@ export declare function createMockPlayback(name?: string): Events<string | symbo
|
|
|
94
94
|
switchAudioTrack: import("vitest").Mock<(...args: any[]) => any>;
|
|
95
95
|
trigger: <T extends string | symbol>(event: T, ...args: any[]) => boolean;
|
|
96
96
|
};
|
|
97
|
-
export declare function createMockContainer(playback?: any): Events<string | symbol, any> & {
|
|
97
|
+
export declare function createMockContainer(options?: Record<string, unknown>, playback?: any): Events<string | symbol, any> & {
|
|
98
98
|
el: any;
|
|
99
99
|
playback: any;
|
|
100
|
+
options: Record<string, unknown>;
|
|
100
101
|
$el: any;
|
|
101
102
|
getDuration: import("vitest").Mock<(...args: any[]) => any>;
|
|
102
103
|
getPlugin: import("vitest").Mock<(...args: any[]) => any>;
|
package/lib/testUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,MAAM,MAAM,eAAe,CAAA;AAElC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,MAAM;IAErC,SAAS,CAAC,OAAO,EAAE,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,GAAG;IAClB,SAAS,CAAC,WAAW,CAAC,EAAE,GAAG;gBAFjB,OAAO,EAAE,GAAG,EACb,IAAI,EAAE,GAAG,EACR,WAAW,CAAC,EAAE,GAAG,YAAA;IAK7B,IAAI,IAAI,WAEP;IAED,OAAO;IAEP,IAAI;IAEJ,KAAK;IAEL,IAAI;IAEJ,OAAO;IAEP,IAAI;IAEJ,cAAc;IAEd,WAAW;IAIX,QAAQ;IAER,OAAO;IAEP,eAAe;IAIf,kBAAkB;IAIlB,cAAc;IAId,qBAAqB;IAIrB,IAAI;IAEJ,MAAM;IAEN,MAAM;IAEN,SAAS;IAET,eAAe;IAIf,WAAW;IAIX,QAAQ;IAIR,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAGtC;AAED,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,MAAM,MAAM,eAAe,CAAA;AAElC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,MAAM;IAErC,SAAS,CAAC,OAAO,EAAE,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,GAAG;IAClB,SAAS,CAAC,WAAW,CAAC,EAAE,GAAG;gBAFjB,OAAO,EAAE,GAAG,EACb,IAAI,EAAE,GAAG,EACR,WAAW,CAAC,EAAE,GAAG,YAAA;IAK7B,IAAI,IAAI,WAEP;IAED,OAAO;IAEP,IAAI;IAEJ,KAAK;IAEL,IAAI;IAEJ,OAAO;IAEP,IAAI;IAEJ,cAAc;IAEd,WAAW;IAIX,QAAQ;IAER,OAAO;IAEP,eAAe;IAIf,kBAAkB;IAIlB,cAAc;IAId,qBAAqB;IAIrB,IAAI;IAEJ,MAAM;IAEN,MAAM;IAEN,SAAS;IAET,eAAe;IAIf,WAAW;IAIX,QAAQ;IAIR,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAGtC;AAED,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;EAqB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC/C;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAAE,QAAQ,GAAE,GAA0B;;;;;;;;;;;;;;;EAmB9G;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAc/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAY7C"}
|
package/lib/testUtils.js
CHANGED
|
@@ -60,7 +60,7 @@ export class _MockPlayback extends Events {
|
|
|
60
60
|
this.emit(event, ...args);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
export function createMockCore(options = {}, container = createMockContainer()) {
|
|
63
|
+
export function createMockCore(options = {}, container = createMockContainer(options)) {
|
|
64
64
|
const el = document.createElement('div');
|
|
65
65
|
const emitter = new Events();
|
|
66
66
|
return Object.assign(emitter, {
|
|
@@ -128,12 +128,13 @@ export function createMockPlayback(name = 'mock') {
|
|
|
128
128
|
trigger: emitter.emit,
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
export function createMockContainer(playback = createMockPlayback()) {
|
|
131
|
+
export function createMockContainer(options = {}, playback = createMockPlayback()) {
|
|
132
132
|
const el = playback.el;
|
|
133
133
|
const emitter = new Events();
|
|
134
134
|
return Object.assign(emitter, {
|
|
135
135
|
el,
|
|
136
136
|
playback,
|
|
137
|
+
options,
|
|
137
138
|
$el: $(el),
|
|
138
139
|
getDuration: vi.fn().mockReturnValue(0),
|
|
139
140
|
getPlugin: vi.fn(),
|
package/package.json
CHANGED
package/src/index.plugins.ts
CHANGED
|
@@ -4,8 +4,9 @@ export * from "./plugins/audio-selector/AudioSelector.js";
|
|
|
4
4
|
export { AudioTracks as AudioSelector } from "./plugins/audio-selector/AudioSelector.js";
|
|
5
5
|
export * from "./plugins/big-mute-button/BigMuteButton.js";
|
|
6
6
|
export * from "./plugins/bottom-gear/BottomGear.js";
|
|
7
|
-
export * from "./plugins/clappr-nerd-stats/ClapprNerdStats.js";
|
|
8
7
|
export * from "./plugins/clappr-stats/ClapprStats.js";
|
|
8
|
+
export * from "./plugins/clappr-nerd-stats/NerdStats.js";
|
|
9
|
+
export { NerdStats as ClapprNerdStats } from "./plugins/clappr-nerd-stats/NerdStats.js";
|
|
9
10
|
export * from "./plugins/click-to-pause/ClickToPause.js";
|
|
10
11
|
export * from "./plugins/clips/Clips.js";
|
|
11
12
|
export * from "./plugins/context-menu/ContextMenu.js";
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
PlaybackErrorCode,
|
|
21
21
|
QualityLevel,
|
|
22
22
|
TimePosition,
|
|
23
|
-
TimeUpdate,
|
|
24
23
|
TimeValue,
|
|
25
24
|
} from '../../playback.types.js'
|
|
26
25
|
import { isDashSource } from '../../utils/mediaSources.js'
|
|
@@ -77,7 +76,6 @@ export default class DashPlayback extends BasePlayback {
|
|
|
77
76
|
// #EXT-X-PLAYLIST-TYPE
|
|
78
77
|
_playlistType: PlaylistType | null = null
|
|
79
78
|
|
|
80
|
-
// #EXT-X-PROGRAM-DATE-TIME
|
|
81
79
|
_programDateTime: TimeValue = 0
|
|
82
80
|
|
|
83
81
|
_dash: DASHJS.MediaPlayerClass | null = null
|
|
@@ -350,9 +348,9 @@ export default class DashPlayback extends BasePlayback {
|
|
|
350
348
|
}
|
|
351
349
|
}
|
|
352
350
|
|
|
353
|
-
getProgramDateTime() {
|
|
354
|
-
|
|
355
|
-
}
|
|
351
|
+
// getProgramDateTime() {
|
|
352
|
+
// return this._programDateTime
|
|
353
|
+
// }
|
|
356
354
|
|
|
357
355
|
// the duration on the video element itself should not be used
|
|
358
356
|
// as this does not necesarily represent the duration of the stream
|
|
@@ -498,10 +496,10 @@ export default class DashPlayback extends BasePlayback {
|
|
|
498
496
|
if (this.startChangeQuality) {
|
|
499
497
|
return
|
|
500
498
|
}
|
|
501
|
-
const update:
|
|
499
|
+
const update: TimePosition = {
|
|
502
500
|
current: this.getCurrentTime(),
|
|
503
501
|
total: this.getDuration(),
|
|
504
|
-
firstFragDateTime: this.getProgramDateTime(),
|
|
502
|
+
// firstFragDateTime: this.getProgramDateTime(), // TODO figure out if needed
|
|
505
503
|
}
|
|
506
504
|
const isSame =
|
|
507
505
|
this._lastTimeUpdate &&
|
|
@@ -543,15 +541,12 @@ export default class DashPlayback extends BasePlayback {
|
|
|
543
541
|
}
|
|
544
542
|
|
|
545
543
|
override _onProgress() {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
544
|
+
const buffer =
|
|
545
|
+
// @ts-expect-error
|
|
546
|
+
this._dash.getDashMetrics().getCurrentBufferLevel('video') ||
|
|
547
|
+
// @ts-expect-error
|
|
548
|
+
this._dash.getDashMetrics().getCurrentBufferLevel('audio')
|
|
551
549
|
|
|
552
|
-
if (!buffer) {
|
|
553
|
-
buffer = this._dash.getDashMetrics().getCurrentBufferLevel('audio')
|
|
554
|
-
}
|
|
555
550
|
const progress = {
|
|
556
551
|
start: this.getCurrentTime(),
|
|
557
552
|
current: this.getCurrentTime() + buffer,
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
PlayerComponentType,
|
|
28
28
|
QualityLevel,
|
|
29
29
|
TimePosition,
|
|
30
|
-
TimeUpdate,
|
|
31
30
|
} from '../../playback.types.js'
|
|
32
31
|
import { PlaybackType } from '../../types.js'
|
|
33
32
|
import { isHlsSource } from '../../utils/mediaSources.js'
|
|
@@ -742,11 +741,10 @@ export default class HlsPlayback extends BasePlayback {
|
|
|
742
741
|
)
|
|
743
742
|
}
|
|
744
743
|
|
|
745
|
-
|
|
746
|
-
const update:
|
|
744
|
+
override _onTimeUpdate() {
|
|
745
|
+
const update: TimePosition = {
|
|
747
746
|
current: this.getCurrentTime(),
|
|
748
747
|
total: this.getDuration(),
|
|
749
|
-
firstFragDateTime: this.getProgramDateTime(),
|
|
750
748
|
}
|
|
751
749
|
const isSame =
|
|
752
750
|
this._lastTimeUpdate &&
|
package/src/playback.types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Playback time in seconds since the beginning of the stream
|
|
2
|
+
* Playback time position in seconds since the beginning of the stream.
|
|
3
|
+
* For the live streams this is limited to the length of a segment. When DVR is enabled, this refers to the
|
|
3
4
|
* @public
|
|
4
5
|
*/
|
|
5
6
|
export type TimeValue = number
|
|
@@ -10,44 +11,57 @@ export type TimeValue = number
|
|
|
10
11
|
*/
|
|
11
12
|
export interface TimePosition {
|
|
12
13
|
/**
|
|
13
|
-
* Current playback time, 0..duration
|
|
14
|
+
* Current playback time, 0..duration
|
|
14
15
|
*/
|
|
15
16
|
current: TimeValue
|
|
16
17
|
/**
|
|
17
|
-
* Total duration of the media
|
|
18
|
+
* Total duration of the media content (or DVR window size or segment duration for live streams)
|
|
18
19
|
*/
|
|
19
20
|
total: TimeValue
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Time progress information indicated by Clappr CONTAINER_PROGRESS and PLAYBACK_PROGRESS events.
|
|
24
25
|
* @beta
|
|
25
26
|
*/
|
|
26
|
-
export type TimeProgress =
|
|
27
|
+
export type TimeProgress = {
|
|
28
|
+
/**
|
|
29
|
+
* Current playback time
|
|
30
|
+
*/
|
|
31
|
+
start: TimeValue
|
|
32
|
+
/**
|
|
33
|
+
* Current buffer length beginning from the start (=current) time
|
|
34
|
+
*/
|
|
35
|
+
current: TimeValue
|
|
36
|
+
/**
|
|
37
|
+
* Total duration of the media content
|
|
38
|
+
*/
|
|
39
|
+
total: TimeValue
|
|
40
|
+
}
|
|
27
41
|
|
|
28
42
|
/**
|
|
29
43
|
* For the plugin development
|
|
30
44
|
* @beta
|
|
45
|
+
* @deprecated Use TimePosition instead
|
|
31
46
|
*/
|
|
32
|
-
export type TimeUpdate = TimePosition
|
|
33
|
-
firstFragDateTime: number
|
|
34
|
-
}
|
|
47
|
+
export type TimeUpdate = TimePosition
|
|
35
48
|
|
|
36
49
|
/**
|
|
37
|
-
* A level of quality within a media source.
|
|
50
|
+
* A level of quality within a media source/representation.
|
|
38
51
|
* @public
|
|
39
52
|
*/
|
|
40
53
|
export interface QualityLevel {
|
|
41
54
|
/**
|
|
42
55
|
* Zero-based index of the quality level.
|
|
56
|
+
* Quality levels go from low to high
|
|
43
57
|
*/
|
|
44
58
|
level: number
|
|
45
59
|
/**
|
|
46
|
-
* Width of the video, pixels.
|
|
60
|
+
* Width of the video frame, pixels.
|
|
47
61
|
*/
|
|
48
62
|
width: number
|
|
49
63
|
/**
|
|
50
|
-
* Height of the video, pixels.
|
|
64
|
+
* Height of the video frame, pixels.
|
|
51
65
|
*/
|
|
52
66
|
height: number
|
|
53
67
|
/**
|