@gcorevideo/player 2.23.2 → 2.23.3
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 +1432 -1432
- package/dist/index.js +19 -15
- package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +15 -8
- package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -1
- package/lib/plugins/thumbnails/Thumbnails.js +3 -6
- package/lib/testUtils.d.ts +1 -0
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +3 -0
- package/package.json +1 -1
- package/src/plugins/bottom-gear/BottomGear.ts +17 -14
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +51 -14
- package/src/plugins/thumbnails/Thumbnails.ts +3 -6
- package/src/plugins/thumbnails/__tests__/Thumbnails.test.ts +20 -3
- package/src/plugins/thumbnails/__tests__/__snapshots__/Thumbnails.test.ts.snap +1 -1
- package/src/testUtils.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -43303,7 +43303,7 @@ class Player {
|
|
|
43303
43303
|
}
|
|
43304
43304
|
}
|
|
43305
43305
|
|
|
43306
|
-
var version$1 = "2.23.
|
|
43306
|
+
var version$1 = "2.23.3";
|
|
43307
43307
|
|
|
43308
43308
|
var packages = {
|
|
43309
43309
|
"node_modules/@clappr/core": {
|
|
@@ -45214,7 +45214,6 @@ class BottomGear extends UICorePlugin {
|
|
|
45214
45214
|
*/
|
|
45215
45215
|
bindEvents() {
|
|
45216
45216
|
this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
|
|
45217
|
-
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
45218
45217
|
}
|
|
45219
45218
|
/**
|
|
45220
45219
|
* Adds a custom option to the gear menu
|
|
@@ -45266,13 +45265,12 @@ class BottomGear extends UICorePlugin {
|
|
|
45266
45265
|
}
|
|
45267
45266
|
return $item;
|
|
45268
45267
|
}
|
|
45269
|
-
|
|
45270
|
-
trace(`${T$g} onActiveContainerChanged`);
|
|
45271
|
-
this.bindContainerEvents();
|
|
45272
|
-
}
|
|
45273
|
-
bindContainerEvents() {
|
|
45268
|
+
bindContainerEvents(container) {
|
|
45274
45269
|
trace(`${T$g} bindContainerEvents`);
|
|
45275
|
-
this.listenTo(
|
|
45270
|
+
this.listenTo(container, Events$1.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
|
|
45271
|
+
this.listenTo(container, Events$1.CONTAINER_CLICK, () => {
|
|
45272
|
+
this.collapse();
|
|
45273
|
+
});
|
|
45276
45274
|
}
|
|
45277
45275
|
highDefinitionUpdate(isHd) {
|
|
45278
45276
|
trace(`${T$g} highDefinitionUpdate`, { isHd });
|
|
@@ -45307,6 +45305,9 @@ class BottomGear extends UICorePlugin {
|
|
|
45307
45305
|
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
45308
45306
|
*/
|
|
45309
45307
|
refresh() {
|
|
45308
|
+
this.collapseSubmenus();
|
|
45309
|
+
}
|
|
45310
|
+
collapseSubmenus() {
|
|
45310
45311
|
this.$el.find('.gear-sub-menu-wrapper').hide();
|
|
45311
45312
|
this.$el.find('#gear-options').show();
|
|
45312
45313
|
}
|
|
@@ -45325,10 +45326,12 @@ class BottomGear extends UICorePlugin {
|
|
|
45325
45326
|
trace(`${T$g} toggleMenu`, { hidden: this.collapsed });
|
|
45326
45327
|
}
|
|
45327
45328
|
collapse() {
|
|
45328
|
-
trace(`${T$g}
|
|
45329
|
+
trace(`${T$g} collapse`);
|
|
45329
45330
|
this.collapsed = true;
|
|
45330
45331
|
this.$el.find('#gear-options-wrapper').hide();
|
|
45331
45332
|
this.$el.find('#gear-button').attr('aria-expanded', 'false');
|
|
45333
|
+
// TODO hide submenus
|
|
45334
|
+
this.collapseSubmenus();
|
|
45332
45335
|
}
|
|
45333
45336
|
onCoreReady() {
|
|
45334
45337
|
trace(`${T$g} onCoreReady`);
|
|
@@ -45336,11 +45339,15 @@ class BottomGear extends UICorePlugin {
|
|
|
45336
45339
|
assert(mediaControl, 'media_control plugin is required');
|
|
45337
45340
|
this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.onMediaControlRendered);
|
|
45338
45341
|
this.listenTo(mediaControl, Events$1.MEDIACONTROL_HIDE, this.collapse);
|
|
45342
|
+
this.listenTo(mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, () => {
|
|
45343
|
+
this.bindContainerEvents(mediaControl.container);
|
|
45344
|
+
});
|
|
45339
45345
|
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, (from) => {
|
|
45340
45346
|
if (from !== this.name) {
|
|
45341
45347
|
this.collapse();
|
|
45342
45348
|
}
|
|
45343
45349
|
});
|
|
45350
|
+
this.bindContainerEvents(mediaControl.container);
|
|
45344
45351
|
}
|
|
45345
45352
|
onMediaControlRendered() {
|
|
45346
45353
|
trace(`${T$g} onMediaControlRendered`);
|
|
@@ -52173,11 +52180,9 @@ class Thumbnails extends UICorePlugin {
|
|
|
52173
52180
|
mediaControl.$el.first().after(this.$el);
|
|
52174
52181
|
}
|
|
52175
52182
|
onMouseMoveSeekbar(_, pos) {
|
|
52176
|
-
|
|
52177
|
-
|
|
52178
|
-
|
|
52179
|
-
this.update();
|
|
52180
|
-
}
|
|
52183
|
+
this.hoverPosition = pos;
|
|
52184
|
+
this.showing = true;
|
|
52185
|
+
this.update();
|
|
52181
52186
|
}
|
|
52182
52187
|
onMouseLeave() {
|
|
52183
52188
|
this.showing = false;
|
|
@@ -52289,7 +52294,6 @@ class Thumbnails extends UICorePlugin {
|
|
|
52289
52294
|
// determine which thumbnail applies to the current time
|
|
52290
52295
|
const thumbIndex = this.getThumbIndexForTime(hoverTime);
|
|
52291
52296
|
const thumb = this.thumbs[thumbIndex];
|
|
52292
|
-
// update thumbnail
|
|
52293
52297
|
const $spotlight = this.$el.find('#thumbnails-spotlight');
|
|
52294
52298
|
this.buildThumbImage(thumb, this.spotlightHeight, $spotlight.find('.thumbnail-container')).appendTo($spotlight);
|
|
52295
52299
|
const elWidth = this.$el.width();
|
|
@@ -138,7 +138,6 @@ export declare class BottomGear extends UICorePlugin {
|
|
|
138
138
|
* ```
|
|
139
139
|
*/
|
|
140
140
|
addItem(name: string, $subMenu?: ZeptoResult): ZeptoResult;
|
|
141
|
-
private onActiveContainerChanged;
|
|
142
141
|
private bindContainerEvents;
|
|
143
142
|
private highDefinitionUpdate;
|
|
144
143
|
/**
|
|
@@ -151,6 +150,7 @@ export declare class BottomGear extends UICorePlugin {
|
|
|
151
150
|
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
152
151
|
*/
|
|
153
152
|
refresh(): void;
|
|
153
|
+
private collapseSubmenus;
|
|
154
154
|
private toggleMenu;
|
|
155
155
|
private collapse;
|
|
156
156
|
private onCoreReady;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkD,MAAM,cAAc,CAAA;AAO3F,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,QAAQ,aAAa;CACtB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,EAAE,CAAQ;IAElB,OAAO,CAAC,QAAQ,CAAK;IAErB,OAAO,CAAC,SAAS,CAAQ;IAEzB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAInB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW;IA6B1D,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACM,MAAM;IAsBf;;;;OAIG;IACH,OAAO;IAIP,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,KAAK;CAOd"}
|
|
@@ -134,7 +134,6 @@ export class BottomGear extends UICorePlugin {
|
|
|
134
134
|
*/
|
|
135
135
|
bindEvents() {
|
|
136
136
|
this.listenToOnce(this.core, ClapprEvents.CORE_READY, this.onCoreReady);
|
|
137
|
-
this.listenTo(this.core, ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
138
137
|
}
|
|
139
138
|
/**
|
|
140
139
|
* Adds a custom option to the gear menu
|
|
@@ -186,13 +185,12 @@ export class BottomGear extends UICorePlugin {
|
|
|
186
185
|
}
|
|
187
186
|
return $item;
|
|
188
187
|
}
|
|
189
|
-
|
|
190
|
-
trace(`${T} onActiveContainerChanged`);
|
|
191
|
-
this.bindContainerEvents();
|
|
192
|
-
}
|
|
193
|
-
bindContainerEvents() {
|
|
188
|
+
bindContainerEvents(container) {
|
|
194
189
|
trace(`${T} bindContainerEvents`);
|
|
195
|
-
this.listenTo(
|
|
190
|
+
this.listenTo(container, ClapprEvents.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
|
|
191
|
+
this.listenTo(container, ClapprEvents.CONTAINER_CLICK, () => {
|
|
192
|
+
this.collapse();
|
|
193
|
+
});
|
|
196
194
|
}
|
|
197
195
|
highDefinitionUpdate(isHd) {
|
|
198
196
|
trace(`${T} highDefinitionUpdate`, { isHd });
|
|
@@ -227,6 +225,9 @@ export class BottomGear extends UICorePlugin {
|
|
|
227
225
|
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
228
226
|
*/
|
|
229
227
|
refresh() {
|
|
228
|
+
this.collapseSubmenus();
|
|
229
|
+
}
|
|
230
|
+
collapseSubmenus() {
|
|
230
231
|
this.$el.find('.gear-sub-menu-wrapper').hide();
|
|
231
232
|
this.$el.find('#gear-options').show();
|
|
232
233
|
}
|
|
@@ -245,10 +246,12 @@ export class BottomGear extends UICorePlugin {
|
|
|
245
246
|
trace(`${T} toggleMenu`, { hidden: this.collapsed });
|
|
246
247
|
}
|
|
247
248
|
collapse() {
|
|
248
|
-
trace(`${T}
|
|
249
|
+
trace(`${T} collapse`);
|
|
249
250
|
this.collapsed = true;
|
|
250
251
|
this.$el.find('#gear-options-wrapper').hide();
|
|
251
252
|
this.$el.find('#gear-button').attr('aria-expanded', 'false');
|
|
253
|
+
// TODO hide submenus
|
|
254
|
+
this.collapseSubmenus();
|
|
252
255
|
}
|
|
253
256
|
onCoreReady() {
|
|
254
257
|
trace(`${T} onCoreReady`);
|
|
@@ -256,11 +259,15 @@ export class BottomGear extends UICorePlugin {
|
|
|
256
259
|
assert(mediaControl, 'media_control plugin is required');
|
|
257
260
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_RENDERED, this.onMediaControlRendered);
|
|
258
261
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.collapse);
|
|
262
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_CONTAINERCHANGED, () => {
|
|
263
|
+
this.bindContainerEvents(mediaControl.container);
|
|
264
|
+
});
|
|
259
265
|
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, (from) => {
|
|
260
266
|
if (from !== this.name) {
|
|
261
267
|
this.collapse();
|
|
262
268
|
}
|
|
263
269
|
});
|
|
270
|
+
this.bindContainerEvents(mediaControl.container);
|
|
264
271
|
}
|
|
265
272
|
onMediaControlRendered() {
|
|
266
273
|
trace(`${T} onMediaControlRendered`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thumbnails.d.ts","sourceRoot":"","sources":["../../../src/plugins/thumbnails/Thumbnails.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,IAAI,EACL,MAAM,cAAc,CAAA;AAUrB,OAAO,uCAAuC,CAAA;AAM9C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,qBAAqB,CAAoB;IAEjD,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,gBAAgB,CAAY;IAEpC,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,cAAc,CAAI;IAE1B,OAAO,CAAC,MAAM,CAAsB;IAEpC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAE3C,IAAI,EAAE,IAAI;IAgBtB,OAAO,CAAC,iBAAiB;IAiCzB;;OAEG;IACM,UAAU;IAInB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,WAAW;YAmDL,eAAe;IAO7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"Thumbnails.d.ts","sourceRoot":"","sources":["../../../src/plugins/thumbnails/Thumbnails.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,IAAI,EACL,MAAM,cAAc,CAAA;AAUrB,OAAO,uCAAuC,CAAA;AAM9C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,qBAAqB,CAAoB;IAEjD,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,gBAAgB,CAAY;IAEpC,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,cAAc,CAAI;IAE1B,OAAO,CAAC,MAAM,CAAsB;IAEpC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAE3C,IAAI,EAAE,IAAI;IAgBtB,OAAO,CAAC,iBAAiB;IAiCzB;;OAEG;IACM,UAAU;IAInB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,WAAW;YAmDL,eAAe;IAO7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,cAAc;IAuEtB,OAAO,CAAC,oBAAoB;IAiD5B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,WAAW;IAgBnB,OAAO,KAAK,YAAY,GAMvB;IAEQ,MAAM;CAShB"}
|
|
@@ -174,11 +174,9 @@ export class Thumbnails extends UICorePlugin {
|
|
|
174
174
|
mediaControl.$el.first().after(this.$el);
|
|
175
175
|
}
|
|
176
176
|
onMouseMoveSeekbar(_, pos) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.update();
|
|
181
|
-
}
|
|
177
|
+
this.hoverPosition = pos;
|
|
178
|
+
this.showing = true;
|
|
179
|
+
this.update();
|
|
182
180
|
}
|
|
183
181
|
onMouseLeave() {
|
|
184
182
|
this.showing = false;
|
|
@@ -290,7 +288,6 @@ export class Thumbnails extends UICorePlugin {
|
|
|
290
288
|
// determine which thumbnail applies to the current time
|
|
291
289
|
const thumbIndex = this.getThumbIndexForTime(hoverTime);
|
|
292
290
|
const thumb = this.thumbs[thumbIndex];
|
|
293
|
-
// update thumbnail
|
|
294
291
|
const $spotlight = this.$el.find('#thumbnails-spotlight');
|
|
295
292
|
this.buildThumbImage(thumb, this.spotlightHeight, $spotlight.find('.thumbnail-container')).appendTo($spotlight);
|
|
296
293
|
const elWidth = this.$el.width();
|
package/lib/testUtils.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare function createMockContainer(options?: Record<string, unknown>, p
|
|
|
75
75
|
getDuration: import("vitest").Mock<(...args: any[]) => any>;
|
|
76
76
|
getPlugin: import("vitest").Mock<(...args: any[]) => any>;
|
|
77
77
|
getPlaybackType: import("vitest").Mock<(...args: any[]) => any>;
|
|
78
|
+
getStartTimeOffset: import("vitest").Mock<(...args: any[]) => any>;
|
|
78
79
|
isDvrInUse: import("vitest").Mock<(...args: any[]) => any>;
|
|
79
80
|
isDvrEnabled: import("vitest").Mock<(...args: any[]) => any>;
|
|
80
81
|
isHighDefinitionInUse: 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,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC/C;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAA0B
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC/C;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAA0B;;;;;;;;;;;;;;;;;;;;;;;;EA6BrC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAiB/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
|
package/lib/testUtils.js
CHANGED
|
@@ -87,6 +87,7 @@ export function createMockContainer(options = {}, playback = createMockPlayback(
|
|
|
87
87
|
getDuration: vi.fn().mockReturnValue(0),
|
|
88
88
|
getPlugin: vi.fn(),
|
|
89
89
|
getPlaybackType: vi.fn(),
|
|
90
|
+
getStartTimeOffset: vi.fn().mockReturnValue(0),
|
|
90
91
|
isDvrInUse: vi.fn().mockReturnValue(false),
|
|
91
92
|
isDvrEnabled: vi.fn().mockReturnValue(false),
|
|
92
93
|
isHighDefinitionInUse: vi.fn().mockReturnValue(false),
|
|
@@ -107,6 +108,8 @@ export function createMockMediaControl(core) {
|
|
|
107
108
|
// @ts-ignore
|
|
108
109
|
mediaControl.mount = vi.fn();
|
|
109
110
|
// @ts-ignore
|
|
111
|
+
mediaControl.container = core.activeContainer;
|
|
112
|
+
// @ts-ignore
|
|
110
113
|
mediaControl.toggleElement = vi.fn();
|
|
111
114
|
vi.spyOn(mediaControl, 'trigger');
|
|
112
115
|
core.$el.append(mediaControl.$el);
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UICorePlugin, template, Events as ClapprEvents,
|
|
1
|
+
import { UICorePlugin, template, Events as ClapprEvents, $, Container } from '@clappr/core'
|
|
2
2
|
import { trace } from '@gcorevideo/utils'
|
|
3
3
|
import assert from 'assert'
|
|
4
4
|
|
|
@@ -150,11 +150,6 @@ export class BottomGear extends UICorePlugin {
|
|
|
150
150
|
*/
|
|
151
151
|
override bindEvents() {
|
|
152
152
|
this.listenToOnce(this.core, ClapprEvents.CORE_READY, this.onCoreReady)
|
|
153
|
-
this.listenTo(
|
|
154
|
-
this.core,
|
|
155
|
-
ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED,
|
|
156
|
-
this.onActiveContainerChanged,
|
|
157
|
-
)
|
|
158
153
|
}
|
|
159
154
|
|
|
160
155
|
/**
|
|
@@ -208,18 +203,16 @@ export class BottomGear extends UICorePlugin {
|
|
|
208
203
|
return $item
|
|
209
204
|
}
|
|
210
205
|
|
|
211
|
-
private
|
|
212
|
-
trace(`${T} onActiveContainerChanged`)
|
|
213
|
-
this.bindContainerEvents()
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
private bindContainerEvents() {
|
|
206
|
+
private bindContainerEvents(container: Container) {
|
|
217
207
|
trace(`${T} bindContainerEvents`)
|
|
218
208
|
this.listenTo(
|
|
219
|
-
|
|
209
|
+
container,
|
|
220
210
|
ClapprEvents.CONTAINER_HIGHDEFINITIONUPDATE,
|
|
221
211
|
this.highDefinitionUpdate,
|
|
222
212
|
)
|
|
213
|
+
this.listenTo(container, ClapprEvents.CONTAINER_CLICK, () => {
|
|
214
|
+
this.collapse()
|
|
215
|
+
})
|
|
223
216
|
}
|
|
224
217
|
|
|
225
218
|
private highDefinitionUpdate(isHd: boolean) {
|
|
@@ -259,6 +252,10 @@ export class BottomGear extends UICorePlugin {
|
|
|
259
252
|
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
260
253
|
*/
|
|
261
254
|
refresh() {
|
|
255
|
+
this.collapseSubmenus()
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private collapseSubmenus() {
|
|
262
259
|
this.$el.find('.gear-sub-menu-wrapper').hide()
|
|
263
260
|
this.$el.find('#gear-options').show()
|
|
264
261
|
}
|
|
@@ -278,10 +275,12 @@ export class BottomGear extends UICorePlugin {
|
|
|
278
275
|
}
|
|
279
276
|
|
|
280
277
|
private collapse() {
|
|
281
|
-
trace(`${T}
|
|
278
|
+
trace(`${T} collapse`)
|
|
282
279
|
this.collapsed = true;
|
|
283
280
|
this.$el.find('#gear-options-wrapper').hide()
|
|
284
281
|
this.$el.find('#gear-button').attr('aria-expanded', 'false')
|
|
282
|
+
// TODO hide submenus
|
|
283
|
+
this.collapseSubmenus()
|
|
285
284
|
}
|
|
286
285
|
|
|
287
286
|
private onCoreReady() {
|
|
@@ -294,6 +293,9 @@ export class BottomGear extends UICorePlugin {
|
|
|
294
293
|
this.onMediaControlRendered,
|
|
295
294
|
)
|
|
296
295
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.collapse)
|
|
296
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_CONTAINERCHANGED, () => {
|
|
297
|
+
this.bindContainerEvents(mediaControl.container)
|
|
298
|
+
})
|
|
297
299
|
this.listenTo(
|
|
298
300
|
mediaControl,
|
|
299
301
|
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
@@ -303,6 +305,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
303
305
|
}
|
|
304
306
|
},
|
|
305
307
|
)
|
|
308
|
+
this.bindContainerEvents(mediaControl.container)
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
private onMediaControlRendered() {
|
|
@@ -2,7 +2,7 @@ import { MockedFunction, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
2
2
|
|
|
3
3
|
import { BottomGear, GearEvents } from '../BottomGear'
|
|
4
4
|
import { createMockCore, createMockMediaControl } from '../../../testUtils'
|
|
5
|
-
import { Events } from '@clappr/core'
|
|
5
|
+
import { $, Events } from '@clappr/core'
|
|
6
6
|
import { ExtendedEvents } from '../../media-control/MediaControl'
|
|
7
7
|
|
|
8
8
|
// import { LogTracer, Logger, setTracer } from '@gcorevideo/utils'
|
|
@@ -17,19 +17,18 @@ describe('BottomGear', () => {
|
|
|
17
17
|
let onGearRendered: MockedFunction<() => void>
|
|
18
18
|
beforeEach(() => {
|
|
19
19
|
core = createMockCore()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
mediaControl = createMockMediaControl(core)
|
|
21
|
+
core.getPlugin = vi
|
|
22
|
+
.fn()
|
|
23
|
+
.mockImplementation((name) =>
|
|
24
|
+
name === 'media_control' ? mediaControl : null,
|
|
25
|
+
)
|
|
26
26
|
})
|
|
27
27
|
describe('basically', () => {
|
|
28
28
|
beforeEach(() => {
|
|
29
29
|
bottomGear = new BottomGear(core)
|
|
30
30
|
onGearRendered = vi.fn()
|
|
31
31
|
bottomGear.on(GearEvents.RENDERED, onGearRendered, null)
|
|
32
|
-
bottomGear.render()
|
|
33
32
|
core.emit(Events.CORE_READY)
|
|
34
33
|
bottomGear.addItem('test', null).html('<button>test</button>')
|
|
35
34
|
})
|
|
@@ -92,9 +91,9 @@ describe('BottomGear', () => {
|
|
|
92
91
|
bottomGear.$el.find('#gear-button').click()
|
|
93
92
|
})
|
|
94
93
|
it('should collapse the gear menu', () => {
|
|
95
|
-
expect(
|
|
96
|
-
'
|
|
97
|
-
)
|
|
94
|
+
expect(
|
|
95
|
+
bottomGear.$el.find('#gear-options-wrapper').css('display'),
|
|
96
|
+
).toBe('none')
|
|
98
97
|
expect(bottomGear.$el.find('#gear-button').attr('aria-expanded')).toBe(
|
|
99
98
|
'false',
|
|
100
99
|
)
|
|
@@ -104,9 +103,6 @@ describe('BottomGear', () => {
|
|
|
104
103
|
describe('when there are no items', () => {
|
|
105
104
|
beforeEach(() => {
|
|
106
105
|
bottomGear = new BottomGear(core)
|
|
107
|
-
onGearRendered = vi.fn()
|
|
108
|
-
bottomGear.on(GearEvents.RENDERED, onGearRendered, null)
|
|
109
|
-
bottomGear.render()
|
|
110
106
|
core.emit(Events.CORE_READY)
|
|
111
107
|
})
|
|
112
108
|
it('should render hidden', () => {
|
|
@@ -117,4 +113,45 @@ describe('BottomGear', () => {
|
|
|
117
113
|
expect(bottomGear.$el.css('display')).not.toBe('none')
|
|
118
114
|
})
|
|
119
115
|
})
|
|
116
|
+
describe('when container is clicked', () => {
|
|
117
|
+
beforeEach(async () => {
|
|
118
|
+
bottomGear = new BottomGear(core)
|
|
119
|
+
core.emit(Events.CORE_READY)
|
|
120
|
+
bottomGear
|
|
121
|
+
.addItem('test', $('<ul id="test-options"><li>Item</li></ul>'))
|
|
122
|
+
.html('<button id="test-button">test</button>')
|
|
123
|
+
bottomGear.$el.find('#gear-button').click()
|
|
124
|
+
})
|
|
125
|
+
describe('basically', () => {
|
|
126
|
+
beforeEach(async () => {
|
|
127
|
+
mediaControl.container.trigger(Events.CONTAINER_CLICK)
|
|
128
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
129
|
+
})
|
|
130
|
+
it('should collapse the gear menu', () => {
|
|
131
|
+
expect(bottomGear.$el.find('#gear-options-wrapper').css('display')).toBe(
|
|
132
|
+
'none',
|
|
133
|
+
)
|
|
134
|
+
expect(bottomGear.$el.find('#gear-button').attr('aria-expanded')).toBe(
|
|
135
|
+
'false',
|
|
136
|
+
)
|
|
137
|
+
expect(bottomGear.$el.find('#test-options').css('display')).toBe('none')
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
describe('when submenu is open', () => {
|
|
141
|
+
beforeEach(async () => {
|
|
142
|
+
// bottomGear.$el.find('#test-submenu').click()
|
|
143
|
+
bottomGear.$el.find('#test-options').show(); // as if it was clicked
|
|
144
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
145
|
+
mediaControl.container.trigger(Events.CONTAINER_CLICK)
|
|
146
|
+
})
|
|
147
|
+
it('should collapse it as well', () => {
|
|
148
|
+
expect(bottomGear.$el.find('#test-options').css('display')).toBe(
|
|
149
|
+
'none',
|
|
150
|
+
)
|
|
151
|
+
expect(bottomGear.$el.find('#gear-options').css('display')).not.toBe(
|
|
152
|
+
'none',
|
|
153
|
+
)
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
})
|
|
120
157
|
})
|
|
@@ -261,11 +261,9 @@ export class Thumbnails extends UICorePlugin {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
private onMouseMoveSeekbar(_: MouseEvent, pos: number) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.update()
|
|
268
|
-
}
|
|
264
|
+
this.hoverPosition = pos
|
|
265
|
+
this.showing = true
|
|
266
|
+
this.update()
|
|
269
267
|
}
|
|
270
268
|
|
|
271
269
|
private onMouseLeave() {
|
|
@@ -415,7 +413,6 @@ export class Thumbnails extends UICorePlugin {
|
|
|
415
413
|
const thumbIndex = this.getThumbIndexForTime(hoverTime)
|
|
416
414
|
const thumb = this.thumbs[thumbIndex]
|
|
417
415
|
|
|
418
|
-
// update thumbnail
|
|
419
416
|
const $spotlight = this.$el.find('#thumbnails-spotlight')
|
|
420
417
|
|
|
421
418
|
this.buildThumbImage(
|
|
@@ -8,7 +8,7 @@ import { createMockCore, createMockMediaControl } from '../../../testUtils'
|
|
|
8
8
|
import { Thumbnails } from '../Thumbnails'
|
|
9
9
|
import { loadImageDimensions } from '../utils'
|
|
10
10
|
|
|
11
|
-
import { Logger, LogTracer, setTracer } from '@gcorevideo/utils'
|
|
11
|
+
// import { Logger, LogTracer, setTracer } from '@gcorevideo/utils'
|
|
12
12
|
|
|
13
13
|
// Logger.enable('*')
|
|
14
14
|
// setTracer(new LogTracer('Thumbnails.test'))
|
|
@@ -30,11 +30,11 @@ describe('Thumbnails', () => {
|
|
|
30
30
|
vtt: `
|
|
31
31
|
1
|
|
32
32
|
00:00:00.000 --> 00:00:01.000
|
|
33
|
-
sprite.png#xywh=
|
|
33
|
+
sprite.png#xywh=0,0,100,100
|
|
34
34
|
|
|
35
35
|
2
|
|
36
36
|
00:00:01.000 --> 00:00:02.000
|
|
37
|
-
sprite.png#xywh=
|
|
37
|
+
sprite.png#xywh=100,0,100,100
|
|
38
38
|
`,
|
|
39
39
|
},
|
|
40
40
|
})
|
|
@@ -69,4 +69,21 @@ sprite.png#xywh=200,200,100,100
|
|
|
69
69
|
expect(thumbnails.$el.hasClass('hidden')).toBe(true)
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
|
+
describe('update', () => {
|
|
73
|
+
describe('when mouse pointer is over the scrubber', () => {
|
|
74
|
+
beforeEach(async () => {
|
|
75
|
+
core.emit(Events.CORE_READY)
|
|
76
|
+
await new Promise(resolve => setTimeout(resolve, 1))
|
|
77
|
+
mediaControl.container.getDuration.mockReturnValue(5)
|
|
78
|
+
vi.spyOn(thumbnails.$el, 'width').mockReturnValue(300)
|
|
79
|
+
mediaControl.trigger(Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, {}, 0.5)
|
|
80
|
+
})
|
|
81
|
+
it('should show thumbnails', () => {
|
|
82
|
+
expect(thumbnails.$el.hasClass('hidden')).toBe(false)
|
|
83
|
+
})
|
|
84
|
+
it('should show the matching spotlight thumbnail', () => {
|
|
85
|
+
expect(thumbnails.$el.find('#thumbnails-spotlight .thumbnail-container').css('background-position')).toBe('-100px 0px')
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
})
|
|
72
89
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Thumbnails > loading > should render 1`] = `
|
|
4
4
|
"<div class="thumbnails-text" id="thumbnails-text"></div>
|
|
5
5
|
<div class="backdrop" id="thumbnails-backdrop" style="height: 100px;">
|
|
6
|
-
<div class="carousel" id="thumbnails-carousel"><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position:
|
|
6
|
+
<div class="carousel" id="thumbnails-carousel"><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position: 0px 0px;"></div><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position: -100px 0px;"></div></div>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="spotlight" id="thumbnails-spotlight" style="height: 100px;"></div>
|
|
9
9
|
"
|
package/src/testUtils.ts
CHANGED
|
@@ -98,6 +98,7 @@ export function createMockContainer(
|
|
|
98
98
|
getDuration: vi.fn().mockReturnValue(0),
|
|
99
99
|
getPlugin: vi.fn(),
|
|
100
100
|
getPlaybackType: vi.fn(),
|
|
101
|
+
getStartTimeOffset: vi.fn().mockReturnValue(0),
|
|
101
102
|
isDvrInUse: vi.fn().mockReturnValue(false),
|
|
102
103
|
isDvrEnabled: vi.fn().mockReturnValue(false),
|
|
103
104
|
isHighDefinitionInUse: vi.fn().mockReturnValue(false),
|
|
@@ -121,6 +122,8 @@ export function createMockMediaControl(core: any) {
|
|
|
121
122
|
// @ts-ignore
|
|
122
123
|
mediaControl.mount = vi.fn()
|
|
123
124
|
// @ts-ignore
|
|
125
|
+
mediaControl.container = core.activeContainer
|
|
126
|
+
// @ts-ignore
|
|
124
127
|
mediaControl.toggleElement = vi.fn()
|
|
125
128
|
vi.spyOn(mediaControl, 'trigger')
|
|
126
129
|
core.$el.append(mediaControl.$el)
|