@gcorevideo/player 2.22.18 → 2.22.21
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/audio-selector/track-selector.ejs +3 -3
- package/assets/bottom-gear/bottomgear.ejs +3 -3
- package/assets/dvr-controls/dvr_controls.scss +0 -12
- package/assets/level-selector/button.ejs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.css +664 -671
- package/dist/index.js +285 -260
- package/dist/player.d.ts +144 -123
- package/dist/plugins/index.css +758 -765
- package/dist/plugins/index.js +194 -172
- package/docs/api/player.clapprstats.exportmetrics.md +2 -2
- package/docs/api/player.clapprstats.md +0 -4
- package/docs/api/player.clapprstatsbitratetrack.md +20 -0
- package/docs/api/player.clapprstatschronograph.md +115 -0
- package/docs/api/player.clapprstatscounter.md +211 -0
- package/docs/api/player.clapprstatsevents.md +51 -0
- package/docs/api/player.clapprstatsmetrics.md +52 -0
- package/docs/api/player.clipspluginsettings.md +1 -1
- package/docs/api/player.gearevents.md +1 -1
- package/docs/api/player.md +57 -2
- package/docs/api/player.mediacontrol.mount.md +0 -5
- package/docs/api/player.mediacontrol.putelement.md +5 -0
- package/docs/api/player.mediacontrol.toggleelement.md +1 -1
- package/docs/api/player.nerdstats.md +3 -3
- package/docs/api/player.playerconfig.md +1 -1
- package/docs/api/player.playerconfig.playbacktype.md +6 -1
- package/docs/api/player.timeupdate.md +6 -3
- package/lib/plugins/audio-selector/AudioSelector.d.ts +1 -1
- package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioSelector.js +15 -8
- package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +2 -2
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +4 -4
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +4 -4
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +5 -2
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +31 -33
- package/lib/plugins/clappr-stats/types.d.ts +21 -21
- package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/types.js +22 -22
- package/lib/plugins/clappr-stats/utils.d.ts +2 -2
- package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
- package/lib/plugins/clips/Clips.d.ts +1 -1
- package/lib/plugins/dvr-controls/DvrControls.d.ts +6 -2
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +39 -27
- package/lib/plugins/media-control/MediaControl.d.ts +9 -2
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +26 -10
- package/lib/plugins/picture-in-picture/PictureInPicture.js +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +1 -1
- package/lib/plugins/vast-ads/VastAds.js +1 -1
- package/lib/plugins/vast-ads/rollmanager.js +1 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts +25 -10
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +62 -60
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +7 -4
- package/lib/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/playback/__tests__/HTML5Video.test.ts +2 -2
- package/src/plugins/audio-selector/AudioSelector.ts +14 -7
- package/src/plugins/audio-selector/__tests__/AudioSelector.test.ts +8 -8
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +15 -15
- package/src/plugins/bottom-gear/BottomGear.ts +2 -2
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +8 -5
- package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +3 -3
- package/src/plugins/clappr-nerd-stats/NerdStats.ts +5 -5
- package/src/plugins/clappr-stats/ClapprStats.ts +41 -40
- package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +12 -12
- package/src/plugins/clappr-stats/types.ts +21 -21
- package/src/plugins/clappr-stats/utils.ts +2 -2
- package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
- package/src/plugins/clips/Clips.ts +1 -1
- package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
- package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +1 -1
- package/src/plugins/dvr-controls/DvrControls.ts +51 -37
- package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +84 -26
- package/src/plugins/dvr-controls/__tests__/__snapshots__/DvrControls.test.ts.snap +0 -12
- package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +1 -1
- package/src/plugins/media-control/MediaControl.ts +27 -10
- package/src/plugins/media-control/__tests__/MediaControl.test.ts +8 -5
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +20 -20
- package/src/plugins/picture-in-picture/PictureInPicture.ts +1 -1
- package/src/plugins/subtitles/ClosedCaptions.ts +1 -1
- package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -1
- package/src/plugins/vast-ads/VastAds.ts +1 -1
- package/src/plugins/vast-ads/rollmanager.ts +1 -1
- package/src/plugins/volume-fade/VolumeFade.ts +92 -75
- package/src/testUtils.ts +11 -5
- package/src/types.ts +1 -1
- package/temp/player.api.json +634 -16
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,8 +3,7 @@ import assert from 'assert';
|
|
|
3
3
|
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
4
|
import dvrHTML from '../../../assets/dvr-controls/index.ejs';
|
|
5
5
|
import '../../../assets/dvr-controls/dvr_controls.scss';
|
|
6
|
-
|
|
7
|
-
const T = 'plugins.dvr_controls';
|
|
6
|
+
// const T = 'plugins.dvr_controls'
|
|
8
7
|
/**
|
|
9
8
|
* `PLUGIN` that adds the DVR controls to the media control UI
|
|
10
9
|
*
|
|
@@ -53,19 +52,17 @@ export class DvrControls extends UICorePlugin {
|
|
|
53
52
|
* @internal
|
|
54
53
|
*/
|
|
55
54
|
bindEvents() {
|
|
56
|
-
this.
|
|
57
|
-
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.
|
|
55
|
+
this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
|
|
56
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
58
57
|
}
|
|
59
58
|
onCoreReady() {
|
|
60
59
|
const mediaControl = this.core.getPlugin('media_control');
|
|
61
60
|
assert(mediaControl, 'media_control plugin is required');
|
|
62
|
-
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.
|
|
63
|
-
// MediaControl has been rendered
|
|
64
|
-
this.render();
|
|
61
|
+
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.mount);
|
|
65
62
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
63
|
+
onActiveContainerChanged() {
|
|
64
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_LOADEDMETADATA, this.onMetadataLoaded);
|
|
65
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.onDvrStateChanged);
|
|
69
66
|
}
|
|
70
67
|
click() {
|
|
71
68
|
const container = this.core.activeContainer;
|
|
@@ -74,30 +71,45 @@ export class DvrControls extends UICorePlugin {
|
|
|
74
71
|
}
|
|
75
72
|
container.seek(container.getDuration());
|
|
76
73
|
}
|
|
77
|
-
shouldRender() {
|
|
78
|
-
return this.core.getPlaybackType() === Playback.LIVE;
|
|
79
|
-
}
|
|
80
74
|
/**
|
|
81
75
|
* @internal
|
|
82
76
|
*/
|
|
83
77
|
render() {
|
|
84
|
-
trace(`${T} render`, {
|
|
85
|
-
dvrEnabled: this.core.activePlayback?.dvrEnabled,
|
|
86
|
-
playbackType: this.core.getPlaybackType(),
|
|
87
|
-
});
|
|
88
|
-
const mediaControl = this.core.getPlugin('media_control');
|
|
89
|
-
if (!mediaControl) {
|
|
90
|
-
return this;
|
|
91
|
-
}
|
|
92
|
-
if (!this.shouldRender()) {
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
mediaControl.toggleElement('duration', false);
|
|
96
|
-
mediaControl.toggleElement('position', false);
|
|
97
78
|
this.$el.html(DvrControls.template({
|
|
98
79
|
i18n: this.core.i18n,
|
|
99
80
|
}));
|
|
100
|
-
mediaControl.putElement('dvr', this.$el);
|
|
101
81
|
return this;
|
|
102
82
|
}
|
|
83
|
+
onMediacontrolRendered() {
|
|
84
|
+
this.render();
|
|
85
|
+
}
|
|
86
|
+
onMetadataLoaded() {
|
|
87
|
+
this.mount();
|
|
88
|
+
this.toggleState(this.core.activeContainer.isDvrInUse());
|
|
89
|
+
}
|
|
90
|
+
mount() {
|
|
91
|
+
// TODO move mount point management logic to MediaControl
|
|
92
|
+
if (this.core.getPlaybackType() !== Playback.LIVE) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
96
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
97
|
+
// TODO -> to MediaControl
|
|
98
|
+
mediaControl.toggleElement('duration', false);
|
|
99
|
+
mediaControl.toggleElement('position', false);
|
|
100
|
+
mediaControl.mount('dvr', this.$el);
|
|
101
|
+
}
|
|
102
|
+
onDvrStateChanged(dvrInUse) {
|
|
103
|
+
this.toggleState(dvrInUse);
|
|
104
|
+
}
|
|
105
|
+
toggleState(dvrInUse) {
|
|
106
|
+
if (dvrInUse) {
|
|
107
|
+
this.$el.find('#media-control-back-to-live').show();
|
|
108
|
+
this.$el.find('#media-control-live').hide();
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.$el.find('#media-control-back-to-live').hide();
|
|
112
|
+
this.$el.find('#media-control-live').show();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
103
115
|
}
|
|
@@ -32,6 +32,9 @@ export type MediaControlSettings = {
|
|
|
32
32
|
default: MediaControlLayerElement[];
|
|
33
33
|
seekEnabled: boolean;
|
|
34
34
|
};
|
|
35
|
+
export declare enum ExtendedEvents {
|
|
36
|
+
MEDIACONTROL_VOLUME = "mediacontrol:volume"
|
|
37
|
+
}
|
|
35
38
|
/**
|
|
36
39
|
* `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
37
40
|
* @beta
|
|
@@ -232,7 +235,6 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
232
235
|
* Get a media control element DOM node
|
|
233
236
|
* @param name - The name of the media control element
|
|
234
237
|
* @returns The DOM node to render to or extend
|
|
235
|
-
* @deprecated Use {@link MediaControl.putElement} instead
|
|
236
238
|
* @remarks
|
|
237
239
|
* Use this method to render custom media control UI in a plugin
|
|
238
240
|
* @example
|
|
@@ -247,11 +249,16 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
247
249
|
* ```
|
|
248
250
|
*/
|
|
249
251
|
mount(name: MediaControlElement, element: ZeptoResult): void;
|
|
252
|
+
/**
|
|
253
|
+
* @deprecated Use {@link MediaControl.mount} instead
|
|
254
|
+
* @param name
|
|
255
|
+
* @param element
|
|
256
|
+
*/
|
|
250
257
|
putElement(name: MediaControlElement, element: ZeptoResult): void;
|
|
251
258
|
/**
|
|
252
259
|
* Toggle the visibility of a media control element
|
|
253
260
|
* @param name - The name of the media control element
|
|
254
|
-
* @param show -
|
|
261
|
+
* @param show - Visibility state
|
|
255
262
|
*/
|
|
256
263
|
toggleElement(area: MediaControlElement, show: boolean): void;
|
|
257
264
|
private getRightPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,kDAAkD,CAAA;AAWzD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,QAAQ,GACR,OAAO,CAAA;AAEX;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,IAAI,GACJ,YAAY,GACZ,cAAc,GACd,MAAM,GACN,aAAa,GACb,KAAK,GACL,IAAI,CAAA;AAER;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,kDAAkD,CAAA;AAWzD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,QAAQ,GACR,OAAO,CAAA;AAEX;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,IAAI,GACJ,YAAY,GACZ,cAAc,GACd,MAAM,GACN,aAAa,GACb,KAAK,GACL,IAAI,CAAA;AAER;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,CAAA;AAY5B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,uBAAuB,EAAE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pB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,WAAW;IAiCnB,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACM,OAAO;IAUhB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACM,MAAM;IA6Ef,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAcvB;;OAEG;IACH,mBAAmB;IAMnB;;OAEG;IACH,qBAAqB;IAOrB,OAAO,CAAC,6BAA6B;IAQrC,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,iBAAiB;CAO1B"}
|
|
@@ -20,14 +20,21 @@ import volumeMaxIcon from '../../../assets/icons/new/volume-max.svg';
|
|
|
20
20
|
import volumeOffIcon from '../../../assets/icons/new/volume-off.svg';
|
|
21
21
|
import fullscreenOffIcon from '../../../assets/icons/new/fullscreen-off.svg';
|
|
22
22
|
import fullscreenOnIcon from '../../../assets/icons/new/fullscreen-on.svg';
|
|
23
|
+
const MANAGED_ELEMENTS = [
|
|
24
|
+
'dvr',
|
|
25
|
+
'duration',
|
|
26
|
+
'fullscreen',
|
|
27
|
+
'hd-indicator',
|
|
28
|
+
'position',
|
|
29
|
+
'seekbar',
|
|
30
|
+
'volume',
|
|
31
|
+
];
|
|
23
32
|
const DEFAULT_SETTINGS = {
|
|
24
33
|
default: [],
|
|
25
34
|
left: ['dvr'],
|
|
26
35
|
right: [
|
|
27
36
|
'audiotracks',
|
|
28
37
|
'cc',
|
|
29
|
-
// 'dvr',
|
|
30
|
-
// 'duration',
|
|
31
38
|
'fullscreen',
|
|
32
39
|
'gear',
|
|
33
40
|
'multicamera',
|
|
@@ -46,11 +53,15 @@ const T = 'plugins.media_control';
|
|
|
46
53
|
const LEFT_ORDER = [
|
|
47
54
|
'playpause',
|
|
48
55
|
'playstop',
|
|
49
|
-
'dvr',
|
|
50
56
|
'volume',
|
|
51
57
|
'position',
|
|
52
58
|
'duration',
|
|
59
|
+
'dvr',
|
|
53
60
|
];
|
|
61
|
+
export var ExtendedEvents;
|
|
62
|
+
(function (ExtendedEvents) {
|
|
63
|
+
ExtendedEvents["MEDIACONTROL_VOLUME"] = "mediacontrol:volume";
|
|
64
|
+
})(ExtendedEvents || (ExtendedEvents = {}));
|
|
54
65
|
const { Config, Fullscreen, formatTime, extend, removeArrayItem } = Utils;
|
|
55
66
|
function orderByOrderPattern(arr, order) {
|
|
56
67
|
const arrWithoutDuplicates = [...new Set(arr)];
|
|
@@ -531,14 +542,15 @@ export class MediaControl extends UICorePlugin {
|
|
|
531
542
|
// if the container is not ready etc
|
|
532
543
|
this.intendedVolume = value;
|
|
533
544
|
this.persistConfig && !isInitialVolume && Config.persist('volume', value);
|
|
534
|
-
// TODO
|
|
535
545
|
const setWhenContainerReady = () => {
|
|
536
546
|
if (this.core.activeContainer && this.core.activeContainer.isReady) {
|
|
537
547
|
this.core.activeContainer.setVolume(value);
|
|
548
|
+
this.trigger(ExtendedEvents.MEDIACONTROL_VOLUME, value);
|
|
538
549
|
}
|
|
539
550
|
else {
|
|
540
551
|
this.listenToOnce(this.core.activeContainer, Events.CONTAINER_READY, () => {
|
|
541
552
|
this.core.activeContainer.setVolume(value);
|
|
553
|
+
this.trigger(ExtendedEvents.MEDIACONTROL_VOLUME, value);
|
|
542
554
|
});
|
|
543
555
|
}
|
|
544
556
|
};
|
|
@@ -696,8 +708,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
696
708
|
}
|
|
697
709
|
this.$el.show();
|
|
698
710
|
this.trigger(Events.MEDIACONTROL_SHOW, this.name);
|
|
699
|
-
this.
|
|
700
|
-
this.container.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name);
|
|
711
|
+
this.core.activeContainer?.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name);
|
|
701
712
|
this.$el.removeClass('media-control-hide');
|
|
702
713
|
this.hideId = setTimeout(() => this.hide(), timeout);
|
|
703
714
|
if (event) {
|
|
@@ -751,7 +762,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
751
762
|
right: [],
|
|
752
763
|
}, this.core.activeContainer.settings);
|
|
753
764
|
trace(`${T} updateSettings`, { newSettings });
|
|
754
|
-
newSettings.left.push('clips'); // TODO
|
|
765
|
+
newSettings.left.push('clips'); // TODO settings
|
|
755
766
|
// TODO make order controlled via CSS
|
|
756
767
|
newSettings.left = orderByOrderPattern([...newSettings.left, 'volume', 'clips'], LEFT_ORDER);
|
|
757
768
|
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
@@ -814,7 +825,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
814
825
|
* Get a media control element DOM node
|
|
815
826
|
* @param name - The name of the media control element
|
|
816
827
|
* @returns The DOM node to render to or extend
|
|
817
|
-
* @deprecated Use {@link MediaControl.putElement} instead
|
|
818
828
|
* @remarks
|
|
819
829
|
* Use this method to render custom media control UI in a plugin
|
|
820
830
|
* @example
|
|
@@ -830,7 +840,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
830
840
|
*/
|
|
831
841
|
mount(name, element) {
|
|
832
842
|
const panel = this.getElementLocation(name);
|
|
833
|
-
trace(`${T}
|
|
843
|
+
trace(`${T} mount`, { name, panel: !!panel });
|
|
834
844
|
if (panel) {
|
|
835
845
|
const current = panel.find(`[data-${name}]`);
|
|
836
846
|
element.attr(`data-${name}`, '');
|
|
@@ -847,13 +857,18 @@ export class MediaControl extends UICorePlugin {
|
|
|
847
857
|
return;
|
|
848
858
|
}
|
|
849
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* @deprecated Use {@link MediaControl.mount} instead
|
|
862
|
+
* @param name
|
|
863
|
+
* @param element
|
|
864
|
+
*/
|
|
850
865
|
putElement(name, element) {
|
|
851
866
|
this.mount(name, element);
|
|
852
867
|
}
|
|
853
868
|
/**
|
|
854
869
|
* Toggle the visibility of a media control element
|
|
855
870
|
* @param name - The name of the media control element
|
|
856
|
-
* @param show -
|
|
871
|
+
* @param show - Visibility state
|
|
857
872
|
*/
|
|
858
873
|
toggleElement(area, show) {
|
|
859
874
|
this.$el.find(`[data-${area}]`).toggle(show);
|
|
@@ -1069,6 +1084,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1069
1084
|
width: this.options.width,
|
|
1070
1085
|
height: this.options.height,
|
|
1071
1086
|
});
|
|
1087
|
+
// TODO check out
|
|
1072
1088
|
this.hideVolumeBar(0);
|
|
1073
1089
|
}, 0);
|
|
1074
1090
|
this.parseColors();
|
|
@@ -80,7 +80,7 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
80
80
|
this.$el.html(PictureInPicture.buttonTemplate({ pipIcon }));
|
|
81
81
|
const mediaControl = this.core.getPlugin('media_control');
|
|
82
82
|
if (mediaControl) {
|
|
83
|
-
mediaControl.
|
|
83
|
+
mediaControl.mount('pip', this.$el);
|
|
84
84
|
}
|
|
85
85
|
return this;
|
|
86
86
|
}
|
|
@@ -248,7 +248,7 @@ export class ClosedCaptions extends UICorePlugin {
|
|
|
248
248
|
this.$line = $(ClosedCaptions.templateString());
|
|
249
249
|
this.resizeFont();
|
|
250
250
|
this.core.activeContainer.$el.append(this.$line);
|
|
251
|
-
mediaControl.
|
|
251
|
+
mediaControl.mount('cc', this.$el);
|
|
252
252
|
this.updateSelection();
|
|
253
253
|
this.renderIcon();
|
|
254
254
|
return this;
|
|
@@ -440,7 +440,7 @@ export class VastAds extends UICorePlugin {
|
|
|
440
440
|
// Attempt to get poster plugin. (May interfere with media control)
|
|
441
441
|
this._posterPlugin = this._container?.getPlugin('poster');
|
|
442
442
|
// Attempt to get click-to-pause plugin. (May interfere with advert click handling)
|
|
443
|
-
this._clickToPausePlugin = this._container?.getPlugin('
|
|
443
|
+
this._clickToPausePlugin = this._container?.getPlugin('click_to_pause');
|
|
444
444
|
assert(this.playback, 'playback is not defined');
|
|
445
445
|
this._contentElement = this.playback.el;
|
|
446
446
|
if (this._pluginIsReady) {
|
|
@@ -56,7 +56,7 @@ export default class RollManager extends Events {
|
|
|
56
56
|
this._playback = this.core.activePlayback;
|
|
57
57
|
this._contentElement = this._playback.el;
|
|
58
58
|
this._posterPlugin = this._container.getPlugin('poster');
|
|
59
|
-
this._clickToPausePlugin = this._container.getPlugin('
|
|
59
|
+
this._clickToPausePlugin = this._container.getPlugin('click_to_pause');
|
|
60
60
|
this._adContainer = _adContainer;
|
|
61
61
|
this._events = {};
|
|
62
62
|
this._pr = Math.floor(Math.random() * 1000000);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UICorePlugin } from '@clappr/core';
|
|
1
|
+
import { UICorePlugin, Core } from '@clappr/core';
|
|
2
2
|
/**
|
|
3
3
|
* Events emitted by the VolumeFade plugin.
|
|
4
4
|
* @beta
|
|
@@ -6,30 +6,45 @@ import { UICorePlugin } from '@clappr/core';
|
|
|
6
6
|
export declare enum VolumeFadeEvents {
|
|
7
7
|
FADE = "core:volume:fade"
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export type VolumeFadeSettings = {
|
|
13
|
+
/**
|
|
14
|
+
* Initial active volume level, effective until volume is changed via media control
|
|
15
|
+
*/
|
|
16
|
+
level?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Fade duration, ms
|
|
19
|
+
*/
|
|
20
|
+
duration?: number;
|
|
21
|
+
};
|
|
9
22
|
/**
|
|
10
23
|
* `PLUGIN` that applies fade effect to the player's volume change.
|
|
11
24
|
* @beta
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Depends on {@link MediaControl} plugin.
|
|
28
|
+
* Configuration options - {@link VolumeFadeSettings}
|
|
12
29
|
*/
|
|
13
30
|
export declare class VolumeFade extends UICorePlugin {
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private interval;
|
|
31
|
+
private activeVolume;
|
|
32
|
+
private duration;
|
|
33
|
+
private timerId;
|
|
18
34
|
/**
|
|
19
35
|
* @internal
|
|
20
36
|
*/
|
|
21
37
|
get name(): string;
|
|
38
|
+
constructor(core: Core);
|
|
22
39
|
/**
|
|
23
40
|
* @internal
|
|
24
41
|
*/
|
|
25
42
|
bindEvents(): void;
|
|
26
|
-
private unBindEvents;
|
|
27
|
-
private _onUserChangeVolume;
|
|
28
|
-
private _onVolumeConfig;
|
|
29
43
|
private onCoreReady;
|
|
44
|
+
private onVolumeChange;
|
|
30
45
|
private onEnter;
|
|
31
|
-
private numberTo;
|
|
32
|
-
private clearCurrentInterval;
|
|
33
46
|
private onLeave;
|
|
47
|
+
private fade;
|
|
48
|
+
private stopFade;
|
|
34
49
|
}
|
|
35
50
|
//# sourceMappingURL=VolumeFade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolumeFade.d.ts","sourceRoot":"","sources":["../../../src/plugins/volume-fade/VolumeFade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"VolumeFade.d.ts","sourceRoot":"","sources":["../../../src/plugins/volume-fade/VolumeFade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,IAAI,EAAE,MAAM,cAAc,CAAA;AAMrE;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,IAAI,qBAAqB;CAC1B;AAMD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,YAAY,CAAI;IAExB,OAAO,CAAC,QAAQ,CAAI;IAEpB,OAAO,CAAC,OAAO,CAAuB;IAEtC;;OAEG;IACH,IAAI,IAAI,WAEP;gBAEW,IAAI,EAAE,IAAI;IAOtB;;OAEG;IACM,UAAU;IAInB,OAAO,CAAC,WAAW;IA6BnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,IAAI;IAqBZ,OAAO,CAAC,QAAQ;CAOjB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UICorePlugin, Events, Browser, $ } from '@clappr/core';
|
|
2
|
-
import { reportError } from '@gcorevideo/utils';
|
|
2
|
+
import { reportError, trace } from '@gcorevideo/utils';
|
|
3
|
+
import { ExtendedEvents } from '../media-control/MediaControl.js';
|
|
3
4
|
/**
|
|
4
5
|
* Events emitted by the VolumeFade plugin.
|
|
5
6
|
* @beta
|
|
@@ -8,98 +9,99 @@ export var VolumeFadeEvents;
|
|
|
8
9
|
(function (VolumeFadeEvents) {
|
|
9
10
|
VolumeFadeEvents["FADE"] = "core:volume:fade";
|
|
10
11
|
})(VolumeFadeEvents || (VolumeFadeEvents = {}));
|
|
12
|
+
const T = 'plugins.volume_fade';
|
|
13
|
+
const DEFAULT_DURATION = 600;
|
|
11
14
|
/**
|
|
12
15
|
* `PLUGIN` that applies fade effect to the player's volume change.
|
|
13
16
|
* @beta
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Depends on {@link MediaControl} plugin.
|
|
20
|
+
* Configuration options - {@link VolumeFadeSettings}
|
|
14
21
|
*/
|
|
15
22
|
export class VolumeFade extends UICorePlugin {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
interval = null;
|
|
23
|
+
activeVolume = 0;
|
|
24
|
+
duration = 0;
|
|
25
|
+
timerId = null;
|
|
20
26
|
/**
|
|
21
27
|
* @internal
|
|
22
28
|
*/
|
|
23
29
|
get name() {
|
|
24
30
|
return 'volume_fade';
|
|
25
31
|
}
|
|
32
|
+
constructor(core) {
|
|
33
|
+
super(core);
|
|
34
|
+
if (typeof this.options.volumeFade?.level === 'number') {
|
|
35
|
+
this.activeVolume = this.options.volumeFade.level;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
26
38
|
/**
|
|
27
39
|
* @internal
|
|
28
40
|
*/
|
|
29
41
|
bindEvents() {
|
|
30
|
-
// TODO on container changed
|
|
31
42
|
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
32
|
-
if (this.core.mediaControl) {
|
|
33
|
-
this.listenTo(this.core.mediaControl, 'mediacontrol:volume:user', this._onUserChangeVolume);
|
|
34
|
-
}
|
|
35
|
-
// this.listenTo(this.core, 'core:volume:config', this._onVolumeConfig);
|
|
36
|
-
}
|
|
37
|
-
unBindEvents() {
|
|
38
|
-
this.core.$el.off('mouseleave.volume');
|
|
39
|
-
this.core.$el.off('mouseenter.volume');
|
|
40
|
-
}
|
|
41
|
-
_onUserChangeVolume(volume) {
|
|
42
|
-
this._aboveBorderVolume = volume;
|
|
43
|
-
}
|
|
44
|
-
_onVolumeConfig(value) {
|
|
45
|
-
this._aboveBorderVolume = value;
|
|
46
|
-
this.container?.setVolume(0);
|
|
47
43
|
}
|
|
48
44
|
onCoreReady() {
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
if (this.core && this.core.$el) {
|
|
52
|
-
// TODO find out why options.playerElement instead of this.core.$el or this.container.$el
|
|
53
|
-
$(this.options.playerElement).on('mouseenter.volume', () => {
|
|
54
|
-
this.onEnter();
|
|
55
|
-
});
|
|
56
|
-
$(this.options.playerElement).on('mouseleave.volume', () => {
|
|
57
|
-
this.onLeave();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (!this._aboveBorderVolume) {
|
|
61
|
-
this._aboveBorderVolume = this.container?.volume && !isNaN(this.container.volume) ? this.container.volume : 80;
|
|
62
|
-
}
|
|
63
|
-
if (this.options.mute || Browser.isMobile) {
|
|
45
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
46
|
+
if (Browser.isMobile) {
|
|
64
47
|
this.destroy();
|
|
65
48
|
return;
|
|
66
49
|
}
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
if (mediaControl) {
|
|
51
|
+
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_VOLUME, this.onVolumeChange);
|
|
52
|
+
}
|
|
53
|
+
$(this.core.$el).on('mouseenter', () => this.onEnter());
|
|
54
|
+
$(this.core.$el).on('mouseleave', () => this.onLeave());
|
|
55
|
+
if (!this.activeVolume) {
|
|
56
|
+
this.activeVolume =
|
|
57
|
+
this.core.activeContainer?.volume &&
|
|
58
|
+
!isNaN(this.core.activeContainer.volume)
|
|
59
|
+
? this.core.activeContainer.volume
|
|
60
|
+
: 80;
|
|
61
|
+
}
|
|
62
|
+
this.duration = this.options.volumeFade?.duration || DEFAULT_DURATION;
|
|
63
|
+
// TODO check if mute must be respected
|
|
64
|
+
this.core.activeContainer?.setVolume(this.activeVolume);
|
|
65
|
+
this.core.activePlayback.volume(0);
|
|
66
|
+
}
|
|
67
|
+
onVolumeChange(volume) {
|
|
68
|
+
trace(`${T} onVolumeChange`, { volume });
|
|
69
|
+
this.activeVolume = volume;
|
|
69
70
|
}
|
|
70
71
|
onEnter() {
|
|
71
|
-
|
|
72
|
+
trace(`${T} onEnter`);
|
|
73
|
+
this.fade(this.duration, 1);
|
|
74
|
+
}
|
|
75
|
+
onLeave() {
|
|
76
|
+
trace(`${T} onLeave`);
|
|
77
|
+
this.fade(this.duration, 0);
|
|
72
78
|
}
|
|
73
|
-
|
|
74
|
-
this.
|
|
79
|
+
fade(duration, to) {
|
|
80
|
+
this.stopFade();
|
|
75
81
|
const start = new Date().getTime();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
+
const from = 1 - to;
|
|
83
|
+
this.timerId = setInterval(() => {
|
|
84
|
+
const delta = new Date().getTime() - start;
|
|
85
|
+
const progress = Math.min(1, delta / duration);
|
|
86
|
+
const normVol = progress * to + (1 - progress) * from;
|
|
87
|
+
const volume = normVol * this.activeVolume;
|
|
88
|
+
this.core.activePlayback.volume(volume);
|
|
82
89
|
try {
|
|
83
|
-
this.
|
|
84
|
-
this.core.trigger(VolumeFadeEvents.FADE, progress * this._aboveBorderVolume);
|
|
90
|
+
this.core.trigger(VolumeFadeEvents.FADE, volume);
|
|
85
91
|
}
|
|
86
92
|
catch (error) {
|
|
87
|
-
// LogManager.exception(error);
|
|
88
93
|
reportError(error);
|
|
89
|
-
this.clearCurrentInterval();
|
|
90
94
|
}
|
|
91
|
-
if (progress >= 1
|
|
92
|
-
this.
|
|
95
|
+
if (progress >= 1) {
|
|
96
|
+
this.stopFade();
|
|
93
97
|
}
|
|
94
98
|
}, 10);
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
+
stopFade() {
|
|
101
|
+
trace(`${T} stopFade`);
|
|
102
|
+
if (this.timerId !== null) {
|
|
103
|
+
clearInterval(this.timerId);
|
|
104
|
+
this.timerId = null;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
onLeave() {
|
|
103
|
-
this.numberTo(this.delay, 1);
|
|
104
|
-
}
|
|
105
107
|
}
|
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,C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,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,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAA0B;;;;;;;;;;;;;;;EAoBrC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAc/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
|
package/lib/testUtils.js
CHANGED
|
@@ -75,7 +75,7 @@ export function createMockCore(options = {}, container = createMockContainer(opt
|
|
|
75
75
|
...options,
|
|
76
76
|
},
|
|
77
77
|
configure: vi.fn(),
|
|
78
|
-
getPlaybackType: vi.fn()
|
|
78
|
+
getPlaybackType: vi.fn(),
|
|
79
79
|
getPlugin: vi.fn(),
|
|
80
80
|
load: vi.fn(),
|
|
81
81
|
trigger: emitter.emit,
|
|
@@ -112,7 +112,7 @@ export function createMockPlayback(name = 'mock') {
|
|
|
112
112
|
getDuration: vi.fn().mockImplementation(() => 100),
|
|
113
113
|
enterPiP: vi.fn(),
|
|
114
114
|
exitPiP: vi.fn(),
|
|
115
|
-
getPlaybackType: vi.fn()
|
|
115
|
+
getPlaybackType: vi.fn(),
|
|
116
116
|
getStartTimeOffset: vi.fn().mockImplementation(() => 0),
|
|
117
117
|
getCurrentTime: vi.fn().mockImplementation(() => 0),
|
|
118
118
|
isHighDefinitionInUse: vi.fn().mockImplementation(() => false),
|
|
@@ -138,7 +138,7 @@ export function createMockContainer(options = {}, playback = createMockPlayback(
|
|
|
138
138
|
$el: $(el),
|
|
139
139
|
getDuration: vi.fn().mockReturnValue(0),
|
|
140
140
|
getPlugin: vi.fn(),
|
|
141
|
-
getPlaybackType: vi.fn()
|
|
141
|
+
getPlaybackType: vi.fn(),
|
|
142
142
|
isDvrInUse: vi.fn().mockReturnValue(false),
|
|
143
143
|
isDvrEnabled: vi.fn().mockReturnValue(false),
|
|
144
144
|
isPlaying: vi.fn().mockReturnValue(false),
|
|
@@ -169,7 +169,10 @@ export function createMockBottomGear(core) {
|
|
|
169
169
|
if (existing.length) {
|
|
170
170
|
return existing;
|
|
171
171
|
}
|
|
172
|
-
return $('<li></li>')
|
|
172
|
+
return $('<li></li>')
|
|
173
|
+
.attr(`data-${name}`, '')
|
|
174
|
+
.append($el)
|
|
175
|
+
.appendTo(plugin.$el);
|
|
173
176
|
});
|
|
174
177
|
plugin.refresh = vi.fn();
|
|
175
178
|
return plugin;
|
package/lib/types.d.ts
CHANGED
|
@@ -145,7 +145,7 @@ export interface PlayerConfig extends Record<string, unknown> {
|
|
|
145
145
|
mute?: boolean;
|
|
146
146
|
/**
|
|
147
147
|
* Stream type.
|
|
148
|
-
* @
|
|
148
|
+
* @remarks
|
|
149
149
|
* Should only be set if known in advance, as it should not change once determined.
|
|
150
150
|
* Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
|
|
151
151
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcorevideo/player",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.21",
|
|
4
4
|
"description": "Gcore JavaScript video player",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"format": "prettier --write src/",
|
|
18
18
|
"lint": "oxlint -c ../../.oxlintrc.json --tsconfig=./tsconfig.json --fix --ignore-path=../../.gitignore src",
|
|
19
19
|
"ship": "npm run build && npm run build:bundle && npm publish --access public",
|
|
20
|
-
"test": "NODE_OPTIONS='--trace-deprecation' vitest"
|
|
20
|
+
"test": "NODE_OPTIONS='--trace-deprecation' vitest --dom"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
44
44
|
"assert": "^2.1.0",
|
|
45
45
|
"eventemitter3": "^5.0.1",
|
|
46
|
-
"
|
|
46
|
+
"happy-dom": "^17.4.4",
|
|
47
47
|
"nodemon": "^3.1.9",
|
|
48
48
|
"rollup": "^4.27.4",
|
|
49
49
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
@@ -33,10 +33,10 @@ describe('HTML5Video', () => {
|
|
|
33
33
|
}
|
|
34
34
|
const html5Video = new HTML5Video({}, i18n, playerError)
|
|
35
35
|
html5Video.load('https://example.com/video.mp4')
|
|
36
|
-
|
|
36
|
+
vi.spyOn(html5Video.el as HTMLVideoElement, 'error', 'get').mockReturnValue({
|
|
37
37
|
code: MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
|
|
38
38
|
message: 'Media source not supported',
|
|
39
|
-
}
|
|
39
|
+
} as any)
|
|
40
40
|
html5Video.el.dispatchEvent(new Event('error', { bubbles: true }))
|
|
41
41
|
expect(playerError.createError).toHaveBeenCalledWith(expect.objectContaining({
|
|
42
42
|
code: PlaybackErrorCode.MediaSourceUnavailable,
|