@gcorevideo/player 2.22.10 → 2.22.12
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 +2 -2
- package/dist/index.css +1272 -1272
- package/dist/index.js +36 -10
- package/dist/plugins/index.css +971 -971
- package/dist/plugins/index.js +35 -9
- package/lib/Player.js +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +6 -0
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +34 -8
- package/package.json +1 -1
- package/src/Player.ts +1 -1
- package/src/plugins/playback-rate/PlaybackRate.ts +37 -8
- package/src/plugins/playback-rate/__tests__/PlaybackRate.test.ts +16 -1
- 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.12";
|
|
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,6 +16077,7 @@ 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);
|
|
16080
16083
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_SETTINGSUPDATE, this.onSettingsUpdate);
|
|
@@ -16109,17 +16112,30 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16109
16112
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
16110
16113
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
16111
16114
|
});
|
|
16112
|
-
|
|
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
|
+
}
|
|
16113
16123
|
}
|
|
16114
16124
|
onMetaDataLoaded() {
|
|
16115
16125
|
trace(`${T$7} onMetaDataLoaded`, {
|
|
16116
16126
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
16117
16127
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
16118
16128
|
});
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
this.
|
|
16122
|
-
}
|
|
16129
|
+
this.metadataLoaded = true;
|
|
16130
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
16131
|
+
this.mount();
|
|
16132
|
+
}
|
|
16133
|
+
else {
|
|
16134
|
+
this.mountTimerId = setTimeout(() => {
|
|
16135
|
+
this.mountTimerId = null;
|
|
16136
|
+
this.mount();
|
|
16137
|
+
}, 25);
|
|
16138
|
+
}
|
|
16123
16139
|
}
|
|
16124
16140
|
allRateElements() {
|
|
16125
16141
|
return this.$el.find('#playback-rate-menu li');
|
|
@@ -16166,9 +16182,19 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16166
16182
|
i18n: this.core.i18n,
|
|
16167
16183
|
playbackRates: this.playbackRates,
|
|
16168
16184
|
}));
|
|
16169
|
-
this.mount()
|
|
16185
|
+
// this.mount()
|
|
16170
16186
|
return this;
|
|
16171
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
|
+
}
|
|
16172
16198
|
// private onStartAd() {
|
|
16173
16199
|
// this.prevSelectedRate = this.selectedRate
|
|
16174
16200
|
// this.resetPlaybackRate()
|
|
@@ -16230,8 +16256,8 @@ class PlaybackRate extends UICorePlugin {
|
|
|
16230
16256
|
}
|
|
16231
16257
|
getTitle() {
|
|
16232
16258
|
const rate = this.selectedRate;
|
|
16233
|
-
return (this.playbackRates.find((r) => r.value === rate)
|
|
16234
|
-
`x${rate}`);
|
|
16259
|
+
return (this.playbackRates.find((r) => r.value === rate)
|
|
16260
|
+
?.label || `x${rate}`);
|
|
16235
16261
|
}
|
|
16236
16262
|
highlightCurrentRate() {
|
|
16237
16263
|
trace(`${T$7} highlightCurrentRate`, {
|
package/lib/Player.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -93,6 +95,10 @@ export declare class PlaybackRate extends UICorePlugin {
|
|
|
93
95
|
* @internal
|
|
94
96
|
*/
|
|
95
97
|
render(): this;
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
destroy(): import("@clappr/core").UIObject;
|
|
96
102
|
private onPlay;
|
|
97
103
|
private syncRate;
|
|
98
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,6 +118,7 @@ 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);
|
|
121
124
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_SETTINGSUPDATE, this.onSettingsUpdate);
|
|
@@ -152,17 +155,30 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
152
155
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
153
156
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
154
157
|
});
|
|
155
|
-
|
|
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
|
+
}
|
|
156
166
|
}
|
|
157
167
|
onMetaDataLoaded() {
|
|
158
168
|
trace(`${T} onMetaDataLoaded`, {
|
|
159
169
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
160
170
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
161
171
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
this.
|
|
165
|
-
}
|
|
172
|
+
this.metadataLoaded = true;
|
|
173
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
174
|
+
this.mount();
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.mountTimerId = setTimeout(() => {
|
|
178
|
+
this.mountTimerId = null;
|
|
179
|
+
this.mount();
|
|
180
|
+
}, 25);
|
|
181
|
+
}
|
|
166
182
|
}
|
|
167
183
|
allRateElements() {
|
|
168
184
|
return this.$el.find('#playback-rate-menu li');
|
|
@@ -210,9 +226,19 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
210
226
|
i18n: this.core.i18n,
|
|
211
227
|
playbackRates: this.playbackRates,
|
|
212
228
|
}));
|
|
213
|
-
this.mount()
|
|
229
|
+
// this.mount()
|
|
214
230
|
return this;
|
|
215
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
|
+
}
|
|
216
242
|
// private onStartAd() {
|
|
217
243
|
// this.prevSelectedRate = this.selectedRate
|
|
218
244
|
// this.resetPlaybackRate()
|
|
@@ -274,8 +300,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
274
300
|
}
|
|
275
301
|
getTitle() {
|
|
276
302
|
const rate = this.selectedRate;
|
|
277
|
-
return (this.playbackRates.find((r) => r.value === rate)
|
|
278
|
-
`x${rate}`);
|
|
303
|
+
return (this.playbackRates.find((r) => r.value === rate)
|
|
304
|
+
?.label || `x${rate}`);
|
|
279
305
|
}
|
|
280
306
|
highlightCurrentRate() {
|
|
281
307
|
trace(`${T} highlightCurrentRate`, {
|
package/package.json
CHANGED
package/src/Player.ts
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,6 +167,7 @@ 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)
|
|
167
173
|
this.listenTo(
|
|
@@ -218,7 +224,14 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
218
224
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
219
225
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
220
226
|
})
|
|
221
|
-
|
|
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
|
+
}
|
|
222
235
|
}
|
|
223
236
|
|
|
224
237
|
private onMetaDataLoaded() {
|
|
@@ -226,10 +239,15 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
226
239
|
playbackType: this.core.activePlayback.getPlaybackType(),
|
|
227
240
|
dvrEnabled: this.core.activePlayback.dvrEnabled,
|
|
228
241
|
})
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.
|
|
232
|
-
}
|
|
242
|
+
this.metadataLoaded = true
|
|
243
|
+
if (this.playbackSettingsUpdateReceived) {
|
|
244
|
+
this.mount()
|
|
245
|
+
} else {
|
|
246
|
+
this.mountTimerId = setTimeout(() => {
|
|
247
|
+
this.mountTimerId = null
|
|
248
|
+
this.mount()
|
|
249
|
+
}, 25)
|
|
250
|
+
}
|
|
233
251
|
}
|
|
234
252
|
|
|
235
253
|
private allRateElements(): ZeptoResult {
|
|
@@ -295,11 +313,22 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
295
313
|
}),
|
|
296
314
|
)
|
|
297
315
|
|
|
298
|
-
this.mount()
|
|
316
|
+
// this.mount()
|
|
299
317
|
|
|
300
318
|
return this
|
|
301
319
|
}
|
|
302
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
|
+
|
|
303
332
|
// private onStartAd() {
|
|
304
333
|
// this.prevSelectedRate = this.selectedRate
|
|
305
334
|
// this.resetPlaybackRate()
|
|
@@ -375,8 +404,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
375
404
|
private getTitle() {
|
|
376
405
|
const rate = this.selectedRate
|
|
377
406
|
return (
|
|
378
|
-
this.playbackRates.find((r: PlaybackRateOption) => r.value === rate)
|
|
379
|
-
|
|
407
|
+
this.playbackRates.find((r: PlaybackRateOption) => r.value === rate)
|
|
408
|
+
?.label || `x${rate}`
|
|
380
409
|
)
|
|
381
410
|
}
|
|
382
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)
|