@gcorevideo/player 2.22.9 → 2.22.11
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/dist/core.js +1 -1
- package/dist/index.css +928 -928
- package/dist/index.js +48 -9
- package/dist/plugins/index.css +590 -590
- package/dist/plugins/index.js +48 -8
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +7 -0
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +47 -8
- package/lib/types.d.ts +4 -3
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/playback-rate/PlaybackRate.ts +56 -9
- package/src/plugins/playback-rate/__tests__/PlaybackRate.test.ts +16 -1
- package/src/types.ts +4 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/plugins/index.js
CHANGED
|
@@ -13320,7 +13320,7 @@ class ClipsPlugin extends UICorePlugin {
|
|
|
13320
13320
|
|
|
13321
13321
|
const templateHtml$1 = "<ul class=\"context-menu-list\">\n <% if(options) { %>\n <% for (var i = 0; i < options.length; i++) { %>\n <li class=\"context-menu-list-item <%= options[i].class %>\"\n data-<%= options[i].name %>><%= options[i].label %></li>\n <% } %>\n <% } %>\n</ul>\n";
|
|
13322
13322
|
|
|
13323
|
-
var version$1 = "2.22.
|
|
13323
|
+
var version$1 = "2.22.11";
|
|
13324
13324
|
|
|
13325
13325
|
var packages = {
|
|
13326
13326
|
"node_modules/@clappr/core": {
|
|
@@ -16018,6 +16018,8 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16018
16018
|
// private prevSelectedRate: string | undefined
|
|
16019
16019
|
selectedRate = DEFAULT_PLAYBACK_RATE;
|
|
16020
16020
|
metadataLoaded = false;
|
|
16021
|
+
playbackSettingsUpdateReceived = false;
|
|
16022
|
+
mountTimerId = null;
|
|
16021
16023
|
/**
|
|
16022
16024
|
* @internal
|
|
16023
16025
|
*/
|
|
@@ -16075,8 +16077,10 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16075
16077
|
}
|
|
16076
16078
|
onActiveContainerChange() {
|
|
16077
16079
|
this.metadataLoaded = false;
|
|
16080
|
+
this.playbackSettingsUpdateReceived = false;
|
|
16078
16081
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_STOP, this.onStop);
|
|
16079
16082
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
16083
|
+
this.listenTo(this.core.activePlayback, Events.PLAYBACK_SETTINGSUPDATE, this.onSettingsUpdate);
|
|
16080
16084
|
this.listenTo(this.core.activePlayback, PlaybackEvents.PLAYBACK_RATE_CHANGED, this.onPlaybackRateChange);
|
|
16081
16085
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_LOADEDMETADATA, this.onMetaDataLoaded);
|
|
16082
16086
|
}
|
|
@@ -16103,9 +16107,35 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16103
16107
|
i18n: this.core.i18n,
|
|
16104
16108
|
})));
|
|
16105
16109
|
}
|
|
16110
|
+
onSettingsUpdate() {
|
|
16111
|
+
trace(`${T$7} onSettingsUpdate`, {
|
|
16112
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
16113
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
16114
|
+
});
|
|
16115
|
+
this.playbackSettingsUpdateReceived = true;
|
|
16116
|
+
if (this.metadataLoaded) {
|
|
16117
|
+
if (this.mountTimerId) {
|
|
16118
|
+
clearTimeout(this.mountTimerId);
|
|
16119
|
+
this.mountTimerId = null;
|
|
16120
|
+
}
|
|
16121
|
+
this.mount();
|
|
16122
|
+
}
|
|
16123
|
+
}
|
|
16106
16124
|
onMetaDataLoaded() {
|
|
16125
|
+
trace(`${T$7} onMetaDataLoaded`, {
|
|
16126
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
16127
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
16128
|
+
});
|
|
16107
16129
|
this.metadataLoaded = true;
|
|
16108
|
-
this.
|
|
16130
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
16131
|
+
this.mount();
|
|
16132
|
+
}
|
|
16133
|
+
else {
|
|
16134
|
+
this.mountTimerId = setTimeout(() => {
|
|
16135
|
+
this.mountTimerId = null;
|
|
16136
|
+
this.mount();
|
|
16137
|
+
}, 25);
|
|
16138
|
+
}
|
|
16109
16139
|
}
|
|
16110
16140
|
allRateElements() {
|
|
16111
16141
|
return this.$el.find('#playback-rate-menu li');
|
|
@@ -16125,13 +16155,13 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16125
16155
|
}
|
|
16126
16156
|
}
|
|
16127
16157
|
shouldMount() {
|
|
16158
|
+
trace(`${T$7} shouldMount`, {
|
|
16159
|
+
playbackType: this.core.activePlayback?.getPlaybackType(),
|
|
16160
|
+
dvrEnabled: this.core.activePlayback?.dvrEnabled,
|
|
16161
|
+
});
|
|
16128
16162
|
if (!this.core.activePlayback || !this.metadataLoaded) {
|
|
16129
16163
|
return false;
|
|
16130
16164
|
}
|
|
16131
|
-
trace(`${T$7} shouldMount`, {
|
|
16132
|
-
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
16133
|
-
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
16134
|
-
});
|
|
16135
16165
|
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
16136
16166
|
!this.core.activePlayback.dvrEnabled) {
|
|
16137
16167
|
return false;
|
|
@@ -16155,6 +16185,16 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16155
16185
|
this.mount();
|
|
16156
16186
|
return this;
|
|
16157
16187
|
}
|
|
16188
|
+
/**
|
|
16189
|
+
* @internal
|
|
16190
|
+
*/
|
|
16191
|
+
destroy() {
|
|
16192
|
+
if (this.mountTimerId) {
|
|
16193
|
+
clearTimeout(this.mountTimerId);
|
|
16194
|
+
this.mountTimerId = null;
|
|
16195
|
+
}
|
|
16196
|
+
return super.destroy();
|
|
16197
|
+
}
|
|
16158
16198
|
// private onStartAd() {
|
|
16159
16199
|
// this.prevSelectedRate = this.selectedRate
|
|
16160
16200
|
// this.resetPlaybackRate()
|
|
@@ -16216,8 +16256,8 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16216
16256
|
}
|
|
16217
16257
|
getTitle() {
|
|
16218
16258
|
const rate = this.selectedRate;
|
|
16219
|
-
return (this.playbackRates.find((r) => r.value === rate)
|
|
16220
|
-
`x${rate}`);
|
|
16259
|
+
return (this.playbackRates.find((r) => r.value === rate)
|
|
16260
|
+
?.label || `x${rate}`);
|
|
16221
16261
|
}
|
|
16222
16262
|
highlightCurrentRate() {
|
|
16223
16263
|
trace(`${T$7} highlightCurrentRate`, {
|
|
@@ -47,6 +47,8 @@ export type PlaybackRateSettings = {
|
|
|
47
47
|
export declare class PlaybackRate extends UICorePlugin {
|
|
48
48
|
private selectedRate;
|
|
49
49
|
private metadataLoaded;
|
|
50
|
+
private playbackSettingsUpdateReceived;
|
|
51
|
+
private mountTimerId;
|
|
50
52
|
/**
|
|
51
53
|
* @internal
|
|
52
54
|
*/
|
|
@@ -83,6 +85,7 @@ export declare class PlaybackRate extends UICorePlugin {
|
|
|
83
85
|
private onMediaControlRendered;
|
|
84
86
|
private onGearRendered;
|
|
85
87
|
private mount;
|
|
88
|
+
private onSettingsUpdate;
|
|
86
89
|
private onMetaDataLoaded;
|
|
87
90
|
private allRateElements;
|
|
88
91
|
private rateElement;
|
|
@@ -92,6 +95,10 @@ export declare class PlaybackRate extends UICorePlugin {
|
|
|
92
95
|
* @internal
|
|
93
96
|
*/
|
|
94
97
|
render(): this;
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
destroy(): import("@clappr/core").UIObject;
|
|
95
102
|
private onPlay;
|
|
96
103
|
private syncRate;
|
|
97
104
|
private resetPlaybackRate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaybackRate.d.ts","sourceRoot":"","sources":["../../../src/plugins/playback-rate/PlaybackRate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAsB,IAAI,EAAK,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"PlaybackRate.d.ts","sourceRoot":"","sources":["../../../src/plugins/playback-rate/PlaybackRate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAsB,IAAI,EAAK,MAAM,cAAc,CAAA;AAkBhF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAI5C,OAAO,CAAC,YAAY,CAAwB;IAE5C,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,8BAA8B,CAAQ;IAE9C,OAAO,CAAC,YAAY,CAAuB;IAE3C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAE7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAE7C,IAAI,EAAE,IAAI;IAOtB,OAAO,KAAK,aAAa,GAExB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;;MAKlB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,uBAAuB;IAuB/B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,KAAK;IAsBb,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,WAAW;IAoBnB;;OAEG;IACM,MAAM;IAoBf;;OAEG;IACM,OAAO;IAwBhB,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,MAAM;IAEd,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -57,6 +57,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
57
57
|
// private prevSelectedRate: string | undefined
|
|
58
58
|
selectedRate = DEFAULT_PLAYBACK_RATE;
|
|
59
59
|
metadataLoaded = false;
|
|
60
|
+
playbackSettingsUpdateReceived = false;
|
|
61
|
+
mountTimerId = null;
|
|
60
62
|
/**
|
|
61
63
|
* @internal
|
|
62
64
|
*/
|
|
@@ -116,8 +118,10 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
116
118
|
onActiveContainerChange() {
|
|
117
119
|
trace(`${T} onActiveContainerChange`);
|
|
118
120
|
this.metadataLoaded = false;
|
|
121
|
+
this.playbackSettingsUpdateReceived = false;
|
|
119
122
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_STOP, this.onStop);
|
|
120
123
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
124
|
+
this.listenTo(this.core.activePlayback, Events.PLAYBACK_SETTINGSUPDATE, this.onSettingsUpdate);
|
|
121
125
|
this.listenTo(this.core.activePlayback, PlaybackEvents.PLAYBACK_RATE_CHANGED, this.onPlaybackRateChange);
|
|
122
126
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_LOADEDMETADATA, this.onMetaDataLoaded);
|
|
123
127
|
}
|
|
@@ -146,10 +150,35 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
146
150
|
i18n: this.core.i18n,
|
|
147
151
|
})));
|
|
148
152
|
}
|
|
153
|
+
onSettingsUpdate() {
|
|
154
|
+
trace(`${T} onSettingsUpdate`, {
|
|
155
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
156
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
157
|
+
});
|
|
158
|
+
this.playbackSettingsUpdateReceived = true;
|
|
159
|
+
if (this.metadataLoaded) {
|
|
160
|
+
if (this.mountTimerId) {
|
|
161
|
+
clearTimeout(this.mountTimerId);
|
|
162
|
+
this.mountTimerId = null;
|
|
163
|
+
}
|
|
164
|
+
this.mount();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
149
167
|
onMetaDataLoaded() {
|
|
150
|
-
trace(`${T} onMetaDataLoaded
|
|
168
|
+
trace(`${T} onMetaDataLoaded`, {
|
|
169
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
170
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
171
|
+
});
|
|
151
172
|
this.metadataLoaded = true;
|
|
152
|
-
this.
|
|
173
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
174
|
+
this.mount();
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.mountTimerId = setTimeout(() => {
|
|
178
|
+
this.mountTimerId = null;
|
|
179
|
+
this.mount();
|
|
180
|
+
}, 25);
|
|
181
|
+
}
|
|
153
182
|
}
|
|
154
183
|
allRateElements() {
|
|
155
184
|
return this.$el.find('#playback-rate-menu li');
|
|
@@ -170,13 +199,13 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
170
199
|
}
|
|
171
200
|
}
|
|
172
201
|
shouldMount() {
|
|
202
|
+
trace(`${T} shouldMount`, {
|
|
203
|
+
playbackType: this.core.activePlayback?.getPlaybackType(),
|
|
204
|
+
dvrEnabled: this.core.activePlayback?.dvrEnabled,
|
|
205
|
+
});
|
|
173
206
|
if (!this.core.activePlayback || !this.metadataLoaded) {
|
|
174
207
|
return false;
|
|
175
208
|
}
|
|
176
|
-
trace(`${T} shouldMount`, {
|
|
177
|
-
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
178
|
-
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
179
|
-
});
|
|
180
209
|
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
181
210
|
!this.core.activePlayback.dvrEnabled) {
|
|
182
211
|
return false;
|
|
@@ -200,6 +229,16 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
200
229
|
this.mount();
|
|
201
230
|
return this;
|
|
202
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
235
|
+
destroy() {
|
|
236
|
+
if (this.mountTimerId) {
|
|
237
|
+
clearTimeout(this.mountTimerId);
|
|
238
|
+
this.mountTimerId = null;
|
|
239
|
+
}
|
|
240
|
+
return super.destroy();
|
|
241
|
+
}
|
|
203
242
|
// private onStartAd() {
|
|
204
243
|
// this.prevSelectedRate = this.selectedRate
|
|
205
244
|
// this.resetPlaybackRate()
|
|
@@ -261,8 +300,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
261
300
|
}
|
|
262
301
|
getTitle() {
|
|
263
302
|
const rate = this.selectedRate;
|
|
264
|
-
return (this.playbackRates.find((r) => r.value === rate)
|
|
265
|
-
`x${rate}`);
|
|
303
|
+
return (this.playbackRates.find((r) => r.value === rate)
|
|
304
|
+
?.label || `x${rate}`);
|
|
266
305
|
}
|
|
267
306
|
highlightCurrentRate() {
|
|
268
307
|
trace(`${T} highlightCurrentRate`, {
|
package/lib/types.d.ts
CHANGED
|
@@ -144,9 +144,10 @@ export interface PlayerConfig extends Record<string, unknown> {
|
|
|
144
144
|
*/
|
|
145
145
|
mute?: boolean;
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
147
|
+
* Stream type.
|
|
148
|
+
* @remark
|
|
149
|
+
* Should only be set if known in advance, as it should not change once determined.
|
|
150
|
+
* Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
|
|
150
151
|
*/
|
|
151
152
|
playbackType?: PlaybackType;
|
|
152
153
|
/**
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,qBAAqB,CAAA;AAE9D;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,OAAO,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;AAEzC;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,CAAA;AAEhD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GAAG,0BAA0B,CAAA;AAExF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,IAAI,EAAE,IAAI,GAAG,YAAY,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GA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,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAChD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;GAGG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,KAAK,UAAU;IACf;;;OAGG;IACH,KAAK,UAAU;IACf;;;OAGG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,KAAK,UAAU;IACf;;;OAGG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,IAAI,SAAS;IACb;;;OAGG;IACH,UAAU,eAAe;IACzB;;;OAGG;IACH,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import checkIcon from '../../../assets/icons/new/check.svg'
|
|
|
14
14
|
import { BottomGear, GearEvents } from '../bottom-gear/BottomGear.js'
|
|
15
15
|
import { PlaybackEvents } from '../../playback/types.js'
|
|
16
16
|
import { MediaControl } from '../media-control/MediaControl.js'
|
|
17
|
+
import { TimerId } from '../../utils/types.js'
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* @beta
|
|
@@ -84,6 +85,10 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
84
85
|
|
|
85
86
|
private metadataLoaded = false
|
|
86
87
|
|
|
88
|
+
private playbackSettingsUpdateReceived = false
|
|
89
|
+
|
|
90
|
+
private mountTimerId: TimerId | null = null
|
|
91
|
+
|
|
87
92
|
/**
|
|
88
93
|
* @internal
|
|
89
94
|
*/
|
|
@@ -162,8 +167,14 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
162
167
|
private onActiveContainerChange() {
|
|
163
168
|
trace(`${T} onActiveContainerChange`)
|
|
164
169
|
this.metadataLoaded = false
|
|
170
|
+
this.playbackSettingsUpdateReceived = false
|
|
165
171
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_STOP, this.onStop)
|
|
166
172
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_PLAY, this.onPlay)
|
|
173
|
+
this.listenTo(
|
|
174
|
+
this.core.activePlayback,
|
|
175
|
+
Events.PLAYBACK_SETTINGSUPDATE,
|
|
176
|
+
this.onSettingsUpdate,
|
|
177
|
+
)
|
|
167
178
|
this.listenTo(
|
|
168
179
|
this.core.activePlayback,
|
|
169
180
|
PlaybackEvents.PLAYBACK_RATE_CHANGED,
|
|
@@ -208,10 +219,35 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
208
219
|
)
|
|
209
220
|
}
|
|
210
221
|
|
|
222
|
+
private onSettingsUpdate() {
|
|
223
|
+
trace(`${T} onSettingsUpdate`, {
|
|
224
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
225
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
226
|
+
})
|
|
227
|
+
this.playbackSettingsUpdateReceived = true
|
|
228
|
+
if (this.metadataLoaded) {
|
|
229
|
+
if (this.mountTimerId) {
|
|
230
|
+
clearTimeout(this.mountTimerId)
|
|
231
|
+
this.mountTimerId = null
|
|
232
|
+
}
|
|
233
|
+
this.mount()
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
211
237
|
private onMetaDataLoaded() {
|
|
212
|
-
trace(`${T} onMetaDataLoaded
|
|
238
|
+
trace(`${T} onMetaDataLoaded`, {
|
|
239
|
+
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
240
|
+
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
241
|
+
})
|
|
213
242
|
this.metadataLoaded = true
|
|
214
|
-
this.
|
|
243
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
244
|
+
this.mount()
|
|
245
|
+
} else {
|
|
246
|
+
this.mountTimerId = setTimeout(() => {
|
|
247
|
+
this.mountTimerId = null
|
|
248
|
+
this.mount()
|
|
249
|
+
}, 25)
|
|
250
|
+
}
|
|
215
251
|
}
|
|
216
252
|
|
|
217
253
|
private allRateElements(): ZeptoResult {
|
|
@@ -240,15 +276,15 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
240
276
|
}
|
|
241
277
|
|
|
242
278
|
private shouldMount() {
|
|
279
|
+
trace(`${T} shouldMount`, {
|
|
280
|
+
playbackType: this.core.activePlayback?.getPlaybackType(),
|
|
281
|
+
dvrEnabled: this.core.activePlayback?.dvrEnabled,
|
|
282
|
+
})
|
|
283
|
+
|
|
243
284
|
if (!this.core.activePlayback || !this.metadataLoaded) {
|
|
244
285
|
return false
|
|
245
286
|
}
|
|
246
287
|
|
|
247
|
-
trace(`${T} shouldMount`, {
|
|
248
|
-
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
249
|
-
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
250
|
-
})
|
|
251
|
-
|
|
252
288
|
if (
|
|
253
289
|
this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
254
290
|
!this.core.activePlayback.dvrEnabled
|
|
@@ -282,6 +318,17 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
282
318
|
return this
|
|
283
319
|
}
|
|
284
320
|
|
|
321
|
+
/**
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
override destroy() {
|
|
325
|
+
if (this.mountTimerId) {
|
|
326
|
+
clearTimeout(this.mountTimerId)
|
|
327
|
+
this.mountTimerId = null
|
|
328
|
+
}
|
|
329
|
+
return super.destroy()
|
|
330
|
+
}
|
|
331
|
+
|
|
285
332
|
// private onStartAd() {
|
|
286
333
|
// this.prevSelectedRate = this.selectedRate
|
|
287
334
|
// this.resetPlaybackRate()
|
|
@@ -357,8 +404,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
357
404
|
private getTitle() {
|
|
358
405
|
const rate = this.selectedRate
|
|
359
406
|
return (
|
|
360
|
-
this.playbackRates.find((r: PlaybackRateOption) => r.value === rate)
|
|
361
|
-
|
|
407
|
+
this.playbackRates.find((r: PlaybackRateOption) => r.value === rate)
|
|
408
|
+
?.label || `x${rate}`
|
|
362
409
|
)
|
|
363
410
|
}
|
|
364
411
|
|
|
@@ -66,7 +66,20 @@ describe('PlaybackRate', () => {
|
|
|
66
66
|
core.activePlayback.emit(Events.PLAYBACK_LOADEDMETADATA)
|
|
67
67
|
core.activeContainer.emit(Events.CONTAINER_LOADEDMETADATA)
|
|
68
68
|
})
|
|
69
|
-
it('should attach to the media control', () => {
|
|
69
|
+
it('should not attach to the media control immediately', () => {
|
|
70
|
+
expect(bottomGear.addItem).not.toHaveBeenCalledWith('rate', expect.anything())
|
|
71
|
+
})
|
|
72
|
+
it('should attach to the media control after a short delay', async () => {
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 25))
|
|
74
|
+
expect(bottomGear.addItem).toHaveBeenCalledWith('rate', playbackRate.$el)
|
|
75
|
+
expect(
|
|
76
|
+
bottomGear.$el.find('li[data-rate]').text(),
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
).toMatchPlaybackRateLabel('1x')
|
|
79
|
+
})
|
|
80
|
+
it('should attach to the media when playback settings update is received', async () => {
|
|
81
|
+
core.activePlayback.emit(Events.PLAYBACK_SETTINGSUPDATE)
|
|
82
|
+
core.activeContainer.emit(Events.CONTAINER_SETTINGSUPDATE)
|
|
70
83
|
expect(bottomGear.addItem).toHaveBeenCalledWith('rate', playbackRate.$el)
|
|
71
84
|
expect(
|
|
72
85
|
bottomGear.$el.find('li[data-rate]').text(),
|
|
@@ -144,6 +157,8 @@ describe('PlaybackRate', () => {
|
|
|
144
157
|
core.activeContainer.isDvrEnabled.mockReturnValue(true)
|
|
145
158
|
core.activePlayback.emit(Events.PLAYBACK_LOADEDMETADATA)
|
|
146
159
|
core.activeContainer.emit(Events.CONTAINER_LOADEDMETADATA)
|
|
160
|
+
core.activePlayback.emit(Events.PLAYBACK_SETTINGSUPDATE)
|
|
161
|
+
core.activeContainer.emit(Events.CONTAINER_SETTINGSUPDATE)
|
|
147
162
|
})
|
|
148
163
|
it('should set the selected rate to the defaultValue', () => {
|
|
149
164
|
expect(core.activePlayback.setPlaybackRate).toHaveBeenCalledWith(1.5)
|
package/src/types.ts
CHANGED
|
@@ -162,9 +162,10 @@ export interface PlayerConfig extends Record<string, unknown> {
|
|
|
162
162
|
mute?: boolean
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
165
|
+
* Stream type.
|
|
166
|
+
* @remark
|
|
167
|
+
* Should only be set if known in advance, as it should not change once determined.
|
|
168
|
+
* Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
|
|
168
169
|
*/
|
|
169
170
|
playbackType?: PlaybackType
|
|
170
171
|
|