@gcorevideo/player 2.28.17 → 2.28.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/dist/core.js +1 -1
- package/dist/index.css +188 -188
- package/dist/index.embed.js +21 -13
- package/dist/index.js +26 -15
- package/lib/plugins/media-control/MediaControl.d.ts +1 -0
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +25 -14
- package/package.json +1 -1
- package/src/plugins/media-control/MediaControl.ts +27 -13
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -312,10 +312,9 @@ export class MediaControl extends UICorePlugin {
|
|
|
312
312
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_PAUSE, this.changeTogglePlay);
|
|
313
313
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_STOP, this.changeTogglePlay);
|
|
314
314
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_DBLCLICK, this.toggleFullscreen);
|
|
315
|
-
|
|
316
|
-
this.
|
|
317
|
-
}
|
|
318
|
-
this.listenTo(this.core.activeContainer, Events.CONTAINER_CLICK, clk);
|
|
315
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_CLICK, () => {
|
|
316
|
+
this.clickaway(this.core.activeContainer.$el[0]);
|
|
317
|
+
});
|
|
319
318
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
320
319
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_PROGRESS, this.updateProgressBar);
|
|
321
320
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_SETTINGSUPDATE, this.updateSettings);
|
|
@@ -332,12 +331,14 @@ export class MediaControl extends UICorePlugin {
|
|
|
332
331
|
});
|
|
333
332
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_MOUSE_ENTER, this.show);
|
|
334
333
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_MOUSE_LEAVE, this.delayHide);
|
|
334
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_DESTROYED, () => {
|
|
335
|
+
this.clickaway(null);
|
|
336
|
+
});
|
|
335
337
|
}
|
|
336
338
|
/**
|
|
337
339
|
* Hides the media control UI
|
|
338
340
|
*/
|
|
339
341
|
disable() {
|
|
340
|
-
trace(`${T} disable`);
|
|
341
342
|
this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
|
|
342
343
|
this.hide();
|
|
343
344
|
this.unbindKeyEvents();
|
|
@@ -763,12 +764,12 @@ export class MediaControl extends UICorePlugin {
|
|
|
763
764
|
});
|
|
764
765
|
this.userKeepVisible = true;
|
|
765
766
|
}
|
|
766
|
-
resetUserKeepVisible() {
|
|
767
|
+
resetUserKeepVisible = () => {
|
|
767
768
|
trace(`${T} resetUserKeepVisible`, {
|
|
768
769
|
userKeepVisible: this.userKeepVisible,
|
|
769
770
|
});
|
|
770
771
|
this.userKeepVisible = false;
|
|
771
|
-
}
|
|
772
|
+
};
|
|
772
773
|
isVisible() {
|
|
773
774
|
return !this.$el.hasClass('media-control-hide');
|
|
774
775
|
}
|
|
@@ -1262,6 +1263,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1262
1263
|
});
|
|
1263
1264
|
this.hide(this.options.hideMediaControlDelay || DEFAULT_HIDE_DELAY);
|
|
1264
1265
|
}
|
|
1266
|
+
clickaway = clickaway(this.resetUserKeepVisible);
|
|
1265
1267
|
}
|
|
1266
1268
|
MediaControl.extend = function (properties) {
|
|
1267
1269
|
return extend(MediaControl, properties);
|
|
@@ -1302,14 +1304,23 @@ function mergeElements(a, b) {
|
|
|
1302
1304
|
return acc;
|
|
1303
1305
|
}, a);
|
|
1304
1306
|
}
|
|
1305
|
-
function clickaway(callback
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1307
|
+
function clickaway(callback) {
|
|
1308
|
+
let handler = (event) => { };
|
|
1309
|
+
return (node) => {
|
|
1310
|
+
window.removeEventListener('click', handler);
|
|
1311
|
+
if (!node) {
|
|
1312
|
+
return;
|
|
1310
1313
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1314
|
+
handler = (event) => {
|
|
1315
|
+
trace(`${T} clickaway`, {
|
|
1316
|
+
node,
|
|
1317
|
+
event,
|
|
1318
|
+
});
|
|
1319
|
+
if (!node.contains(event.target)) {
|
|
1320
|
+
callback();
|
|
1321
|
+
window.removeEventListener('click', handler);
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1313
1324
|
window.addEventListener('click', handler);
|
|
1314
1325
|
};
|
|
1315
1326
|
}
|
package/package.json
CHANGED
|
@@ -468,13 +468,12 @@ export class MediaControl extends UICorePlugin {
|
|
|
468
468
|
Events.CONTAINER_DBLCLICK,
|
|
469
469
|
this.toggleFullscreen,
|
|
470
470
|
)
|
|
471
|
-
const clk = clickaway(() => {
|
|
472
|
-
this.resetUserKeepVisible()
|
|
473
|
-
}, this.core.activeContainer.$el[0])
|
|
474
471
|
this.listenTo(
|
|
475
472
|
this.core.activeContainer,
|
|
476
473
|
Events.CONTAINER_CLICK,
|
|
477
|
-
|
|
474
|
+
() => {
|
|
475
|
+
this.clickaway(this.core.activeContainer.$el[0])
|
|
476
|
+
},
|
|
478
477
|
)
|
|
479
478
|
this.listenTo(
|
|
480
479
|
this.core.activeContainer,
|
|
@@ -532,13 +531,16 @@ export class MediaControl extends UICorePlugin {
|
|
|
532
531
|
})
|
|
533
532
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_MOUSE_ENTER, this.show)
|
|
534
533
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_MOUSE_LEAVE, this.delayHide)
|
|
534
|
+
|
|
535
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_DESTROYED, () => {
|
|
536
|
+
this.clickaway(null)
|
|
537
|
+
})
|
|
535
538
|
}
|
|
536
539
|
|
|
537
540
|
/**
|
|
538
541
|
* Hides the media control UI
|
|
539
542
|
*/
|
|
540
543
|
override disable() {
|
|
541
|
-
trace(`${T} disable`)
|
|
542
544
|
this.userDisabled = true // TODO distinguish between user and system (e.g., unplayable) disabled?
|
|
543
545
|
this.hide()
|
|
544
546
|
this.unbindKeyEvents()
|
|
@@ -1050,7 +1052,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1050
1052
|
this.userKeepVisible = true
|
|
1051
1053
|
}
|
|
1052
1054
|
|
|
1053
|
-
private resetUserKeepVisible() {
|
|
1055
|
+
private resetUserKeepVisible = () => {
|
|
1054
1056
|
trace(`${T} resetUserKeepVisible`, {
|
|
1055
1057
|
userKeepVisible: this.userKeepVisible,
|
|
1056
1058
|
})
|
|
@@ -1654,6 +1656,8 @@ export class MediaControl extends UICorePlugin {
|
|
|
1654
1656
|
})
|
|
1655
1657
|
this.hide(this.options.hideMediaControlDelay || DEFAULT_HIDE_DELAY)
|
|
1656
1658
|
}
|
|
1659
|
+
|
|
1660
|
+
private clickaway = clickaway(this.resetUserKeepVisible)
|
|
1657
1661
|
}
|
|
1658
1662
|
|
|
1659
1663
|
MediaControl.extend = function (properties) {
|
|
@@ -1708,14 +1712,24 @@ function mergeElements(
|
|
|
1708
1712
|
}, a)
|
|
1709
1713
|
}
|
|
1710
1714
|
|
|
1711
|
-
function clickaway(callback: () => void
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1715
|
+
function clickaway(callback: () => void) {
|
|
1716
|
+
let handler = (event: MouseEvent | TouchEvent) => {}
|
|
1717
|
+
|
|
1718
|
+
return (node: HTMLElement | null) => {
|
|
1719
|
+
window.removeEventListener('click', handler)
|
|
1720
|
+
if (!node) {
|
|
1721
|
+
return
|
|
1722
|
+
}
|
|
1723
|
+
handler = (event: MouseEvent | TouchEvent) => {
|
|
1724
|
+
trace(`${T} clickaway`, {
|
|
1725
|
+
node,
|
|
1726
|
+
event,
|
|
1727
|
+
})
|
|
1728
|
+
if (!node.contains(event.target as Node)) {
|
|
1729
|
+
callback()
|
|
1730
|
+
window.removeEventListener('click', handler)
|
|
1731
|
+
}
|
|
1716
1732
|
}
|
|
1717
|
-
}
|
|
1718
|
-
return () => {
|
|
1719
1733
|
window.addEventListener('click', handler)
|
|
1720
1734
|
}
|
|
1721
1735
|
}
|