@gcorevideo/player 2.22.18 → 2.22.20
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/dist/core.js +1 -1
- package/dist/index.css +803 -810
- package/dist/index.js +195 -176
- package/dist/player.d.ts +121 -108
- package/dist/plugins/index.css +904 -911
- package/dist/plugins/index.js +132 -112
- package/docs/api/player.bitratetrackrecord.md +20 -0
- package/docs/api/player.clapprstats.exportmetrics.md +2 -2
- package/docs/api/player.clapprstats.md +0 -4
- 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.md +57 -2
- 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 +6 -2
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +20 -9
- 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/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/media-control/MediaControl.ts +21 -9
- 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/testUtils.ts +11 -5
- package/src/types.ts +1 -1
- package/temp/player.api.json +630 -12
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -20,11 +20,30 @@ describe('DvrControls', () => {
|
|
|
20
20
|
}
|
|
21
21
|
core.getPlugin.mockImplementation((name: string) => plugins[name])
|
|
22
22
|
dvrControls = new DvrControls(core)
|
|
23
|
-
|
|
23
|
+
core.emit(Events.CORE_READY)
|
|
24
|
+
mediaControl.trigger(Events.MEDIACONTROL_RENDERED)
|
|
25
|
+
core.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED, core.activeContainer)
|
|
26
|
+
})
|
|
27
|
+
describe('basically', () => {
|
|
28
|
+
it('should render', () => {
|
|
29
|
+
expect(dvrControls.el.innerHTML).toMatchSnapshot()
|
|
30
|
+
expect(dvrControls.el.textContent).toMatch(/\blive\b/)
|
|
31
|
+
expect(dvrControls.el.textContent).toMatch(/\bback_to_live\b/)
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
describe('while playback type is unknown', () => {
|
|
35
|
+
it('should not mount', () => {
|
|
36
|
+
expect(mediaControl.mount).not.toHaveBeenCalledWith(
|
|
37
|
+
'dvr',
|
|
38
|
+
dvrControls.$el,
|
|
39
|
+
)
|
|
40
|
+
})
|
|
24
41
|
})
|
|
25
42
|
describe('live stream', () => {
|
|
26
43
|
beforeEach(() => {
|
|
27
44
|
core.getPlaybackType.mockReturnValue('live')
|
|
45
|
+
core.activeContainer.getPlaybackType.mockReturnValue('live')
|
|
46
|
+
core.activePlayback.getPlaybackType.mockReturnValue('live')
|
|
28
47
|
})
|
|
29
48
|
describe.each([
|
|
30
49
|
['no DVR', false, false, false],
|
|
@@ -33,36 +52,75 @@ describe('DvrControls', () => {
|
|
|
33
52
|
beforeEach(() => {
|
|
34
53
|
core.activePlayback.dvrEnabled = dvrEnabled
|
|
35
54
|
core.activeContainer.isDvrEnabled.mockReturnValue(dvrEnabled)
|
|
36
|
-
core.
|
|
37
|
-
core.
|
|
55
|
+
core.activePlayback.emit(Events.PLAYBACK_LOADEDMETADATA)
|
|
56
|
+
core.activeContainer.emit(Events.CONTAINER_LOADEDMETADATA)
|
|
38
57
|
if (dvrInUse) {
|
|
39
58
|
core.activePlayback.dvrInUse = true
|
|
40
59
|
core.activeContainer.isDvrInUse.mockReturnValue(true)
|
|
41
|
-
core.activeContainer.emit(
|
|
60
|
+
core.activeContainer.emit(
|
|
61
|
+
Events.CONTAINER_PLAYBACKDVRSTATECHANGED,
|
|
62
|
+
true,
|
|
63
|
+
)
|
|
42
64
|
}
|
|
43
65
|
})
|
|
44
|
-
|
|
45
|
-
expect(dvrControls.el.textContent).toBeTruthy()
|
|
46
|
-
expect(dvrControls.el.innerHTML).toMatchSnapshot()
|
|
47
|
-
})
|
|
66
|
+
// TODO let the media control itself handle this
|
|
48
67
|
it('should hide duration and position indicators', () => {
|
|
49
|
-
expect(mediaControl.toggleElement).toHaveBeenCalledWith(
|
|
50
|
-
|
|
68
|
+
expect(mediaControl.toggleElement).toHaveBeenCalledWith(
|
|
69
|
+
'duration',
|
|
70
|
+
false,
|
|
71
|
+
)
|
|
72
|
+
expect(mediaControl.toggleElement).toHaveBeenCalledWith(
|
|
73
|
+
'position',
|
|
74
|
+
false,
|
|
75
|
+
)
|
|
51
76
|
})
|
|
52
|
-
it('should
|
|
53
|
-
expect(mediaControl.
|
|
77
|
+
it('should mount to the media control', () => {
|
|
78
|
+
expect(mediaControl.mount).toHaveBeenCalledWith('dvr', dvrControls.$el)
|
|
54
79
|
})
|
|
80
|
+
if (dvrEnabled) {
|
|
81
|
+
if (dvrInUse) {
|
|
82
|
+
it('should show back_to_live button', () => {
|
|
83
|
+
expect(
|
|
84
|
+
dvrControls.$el
|
|
85
|
+
.find('#media-control-back-to-live')
|
|
86
|
+
.css('display'),
|
|
87
|
+
).not.toBe('none')
|
|
88
|
+
})
|
|
89
|
+
it('should hide live inficator', () => {
|
|
90
|
+
expect(
|
|
91
|
+
dvrControls.$el.find('#media-control-live').css('display'),
|
|
92
|
+
).toBe('none')
|
|
93
|
+
})
|
|
94
|
+
} else {
|
|
95
|
+
it('should show live inficator', () => {
|
|
96
|
+
expect(
|
|
97
|
+
dvrControls.$el.find('#media-control-live').css('display'),
|
|
98
|
+
).not.toBe('none')
|
|
99
|
+
})
|
|
100
|
+
it('should hide back_to_live button', () => {
|
|
101
|
+
expect(
|
|
102
|
+
dvrControls.$el
|
|
103
|
+
.find('#media-control-back-to-live')
|
|
104
|
+
.css('display'),
|
|
105
|
+
).toBe('none')
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
}
|
|
55
109
|
})
|
|
56
110
|
describe('when back_to_live button is clicked', () => {
|
|
57
111
|
beforeEach(() => {
|
|
58
112
|
core.activePlayback.dvrEnabled = true
|
|
59
|
-
core.
|
|
60
|
-
core.
|
|
113
|
+
core.activeContainer.isDvrEnabled.mockReturnValue(true)
|
|
114
|
+
core.activePlayback.emit(Events.PLAYBACK_LOADEDMETADATA)
|
|
115
|
+
core.activeContainer.emit(Events.CONTAINER_LOADEDMETADATA)
|
|
61
116
|
core.activeContainer.getDuration.mockReturnValue(180)
|
|
62
|
-
core.activeContainer.
|
|
63
|
-
|
|
117
|
+
core.activeContainer.emit(
|
|
118
|
+
Events.CONTAINER_PLAYBACKDVRSTATECHANGED,
|
|
119
|
+
true,
|
|
120
|
+
)
|
|
121
|
+
dvrControls.$el.find('#media-control-back-to-live').click()
|
|
64
122
|
})
|
|
65
|
-
it('should
|
|
123
|
+
it('should play stream', () => {
|
|
66
124
|
expect(core.activeContainer.play).toHaveBeenCalled()
|
|
67
125
|
})
|
|
68
126
|
it('should seek to live edge', () => {
|
|
@@ -70,20 +128,20 @@ describe('DvrControls', () => {
|
|
|
70
128
|
})
|
|
71
129
|
})
|
|
72
130
|
})
|
|
73
|
-
describe('
|
|
131
|
+
describe('VOD stream', () => {
|
|
74
132
|
beforeEach(() => {
|
|
75
133
|
core.getPlaybackType.mockReturnValue(Playback.VOD)
|
|
76
134
|
core.activeContainer.getPlaybackType.mockReturnValue(Playback.VOD)
|
|
77
135
|
core.activePlayback.getPlaybackType.mockReturnValue(Playback.VOD)
|
|
136
|
+
core.activePlayback.emit(Events.PLAYBACK_LOADEDMETADATA)
|
|
137
|
+
core.activeContainer.emit(Events.CONTAINER_LOADEDMETADATA)
|
|
78
138
|
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
expect(dvrControls.el.textContent).toContain('live')
|
|
86
|
-
expect(dvrControls.el.textContent).toContain('back_to_live')
|
|
139
|
+
// TODO handle mount points in MediaControl
|
|
140
|
+
it('should not mount', () => {
|
|
141
|
+
expect(mediaControl.mount).not.toHaveBeenCalledWith(
|
|
142
|
+
'dvr',
|
|
143
|
+
expect.anything(),
|
|
144
|
+
)
|
|
87
145
|
})
|
|
88
146
|
})
|
|
89
147
|
})
|
|
@@ -5,15 +5,3 @@ exports[`DvrControls > basically > should render 1`] = `
|
|
|
5
5
|
<button type="button" class="live-button" aria-label="back_to_live" id="media-control-back-to-live">back_to_live</button>
|
|
6
6
|
"
|
|
7
7
|
`;
|
|
8
|
-
|
|
9
|
-
exports[`DvrControls > live stream > DVR at live edge > should render 1`] = `
|
|
10
|
-
"<div class="live-info" id="media-control-live">live</div>
|
|
11
|
-
<button type="button" class="live-button" aria-label="back_to_live" id="media-control-back-to-live">back_to_live</button>
|
|
12
|
-
"
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`DvrControls > live stream > no DVR > should render 1`] = `
|
|
16
|
-
"<div class="live-info" id="media-control-live">live</div>
|
|
17
|
-
<button type="button" class="live-button" aria-label="back_to_live" id="media-control-back-to-live">back_to_live</button>
|
|
18
|
-
"
|
|
19
|
-
`;
|
|
@@ -81,6 +81,16 @@ export type MediaControlElement =
|
|
|
81
81
|
| MediaControlLayerElement
|
|
82
82
|
| MediaControlRightElement
|
|
83
83
|
|
|
84
|
+
const MANAGED_ELEMENTS: MediaControlElement[] = [
|
|
85
|
+
'dvr',
|
|
86
|
+
'duration',
|
|
87
|
+
'fullscreen',
|
|
88
|
+
'hd-indicator',
|
|
89
|
+
'position',
|
|
90
|
+
'seekbar',
|
|
91
|
+
'volume',
|
|
92
|
+
]
|
|
93
|
+
|
|
84
94
|
/**
|
|
85
95
|
* Specifies the allowed media control elements in each area.
|
|
86
96
|
* Can be used to restrict rendered media control elements.
|
|
@@ -99,8 +109,6 @@ const DEFAULT_SETTINGS: MediaControlSettings = {
|
|
|
99
109
|
right: [
|
|
100
110
|
'audiotracks',
|
|
101
111
|
'cc',
|
|
102
|
-
// 'dvr',
|
|
103
|
-
// 'duration',
|
|
104
112
|
'fullscreen',
|
|
105
113
|
'gear',
|
|
106
114
|
'multicamera',
|
|
@@ -122,10 +130,10 @@ const T = 'plugins.media_control'
|
|
|
122
130
|
const LEFT_ORDER = [
|
|
123
131
|
'playpause',
|
|
124
132
|
'playstop',
|
|
125
|
-
'dvr',
|
|
126
133
|
'volume',
|
|
127
134
|
'position',
|
|
128
135
|
'duration',
|
|
136
|
+
'dvr',
|
|
129
137
|
]
|
|
130
138
|
|
|
131
139
|
const { Config, Fullscreen, formatTime, extend, removeArrayItem } = Utils
|
|
@@ -996,8 +1004,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
996
1004
|
}
|
|
997
1005
|
this.$el.show()
|
|
998
1006
|
this.trigger(Events.MEDIACONTROL_SHOW, this.name)
|
|
999
|
-
this.
|
|
1000
|
-
this.container.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name)
|
|
1007
|
+
this.core.activeContainer?.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name)
|
|
1001
1008
|
this.$el.removeClass('media-control-hide')
|
|
1002
1009
|
this.hideId = setTimeout(() => this.hide(), timeout)
|
|
1003
1010
|
if (event) {
|
|
@@ -1066,7 +1073,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1066
1073
|
)
|
|
1067
1074
|
trace(`${T} updateSettings`, { newSettings })
|
|
1068
1075
|
|
|
1069
|
-
newSettings.left.push('clips') // TODO
|
|
1076
|
+
newSettings.left.push('clips') // TODO settings
|
|
1070
1077
|
// TODO make order controlled via CSS
|
|
1071
1078
|
newSettings.left = orderByOrderPattern(
|
|
1072
1079
|
[...newSettings.left, 'volume', 'clips'],
|
|
@@ -1155,7 +1162,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
1155
1162
|
* Get a media control element DOM node
|
|
1156
1163
|
* @param name - The name of the media control element
|
|
1157
1164
|
* @returns The DOM node to render to or extend
|
|
1158
|
-
* @deprecated Use {@link MediaControl.putElement} instead
|
|
1159
1165
|
* @remarks
|
|
1160
1166
|
* Use this method to render custom media control UI in a plugin
|
|
1161
1167
|
* @example
|
|
@@ -1171,7 +1177,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1171
1177
|
*/
|
|
1172
1178
|
mount(name: MediaControlElement, element: ZeptoResult) {
|
|
1173
1179
|
const panel = this.getElementLocation(name)
|
|
1174
|
-
trace(`${T}
|
|
1180
|
+
trace(`${T} mount`, { name, panel: !!panel })
|
|
1175
1181
|
if (panel) {
|
|
1176
1182
|
const current = panel.find(`[data-${name}]`)
|
|
1177
1183
|
element.attr(`data-${name}`, '')
|
|
@@ -1188,6 +1194,11 @@ export class MediaControl extends UICorePlugin {
|
|
|
1188
1194
|
}
|
|
1189
1195
|
}
|
|
1190
1196
|
|
|
1197
|
+
/**
|
|
1198
|
+
* @deprecated Use {@link MediaControl.mount} instead
|
|
1199
|
+
* @param name
|
|
1200
|
+
* @param element
|
|
1201
|
+
*/
|
|
1191
1202
|
putElement(name: MediaControlElement, element: ZeptoResult) {
|
|
1192
1203
|
this.mount(name, element)
|
|
1193
1204
|
}
|
|
@@ -1195,7 +1206,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1195
1206
|
/**
|
|
1196
1207
|
* Toggle the visibility of a media control element
|
|
1197
1208
|
* @param name - The name of the media control element
|
|
1198
|
-
* @param show -
|
|
1209
|
+
* @param show - Visibility state
|
|
1199
1210
|
*/
|
|
1200
1211
|
toggleElement(area: MediaControlElement, show: boolean) {
|
|
1201
1212
|
this.$el.find(`[data-${area}]`).toggle(show)
|
|
@@ -1456,6 +1467,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1456
1467
|
width: this.options.width,
|
|
1457
1468
|
height: this.options.height,
|
|
1458
1469
|
})
|
|
1470
|
+
// TODO check out
|
|
1459
1471
|
this.hideVolumeBar(0)
|
|
1460
1472
|
}, 0)
|
|
1461
1473
|
|
|
@@ -189,7 +189,7 @@ describe('MediaControl', () => {
|
|
|
189
189
|
})
|
|
190
190
|
})
|
|
191
191
|
})
|
|
192
|
-
describe('
|
|
192
|
+
describe('mount', () => {
|
|
193
193
|
beforeEach(async () => {
|
|
194
194
|
mediaControl = new MediaControl(core)
|
|
195
195
|
core.emit(Events.CORE_READY)
|
|
@@ -212,7 +212,7 @@ describe('MediaControl', () => {
|
|
|
212
212
|
const element = document.createElement('div')
|
|
213
213
|
element.className = 'my-media-control'
|
|
214
214
|
element.textContent = 'test'
|
|
215
|
-
mediaControl.
|
|
215
|
+
mediaControl.mount(mcName, $(element))
|
|
216
216
|
|
|
217
217
|
expect(mediaControl.el.innerHTML).toMatchSnapshot()
|
|
218
218
|
expect(
|
|
@@ -234,19 +234,22 @@ describe('MediaControl', () => {
|
|
|
234
234
|
seekEnabled: true,
|
|
235
235
|
}
|
|
236
236
|
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED, core.activeContainer)
|
|
237
|
+
core.activePlayback.getPlaybackType.mockReturnValue(Playback.LIVE)
|
|
238
|
+
core.activeContainer.getPlaybackType.mockReturnValue(Playback.LIVE)
|
|
239
|
+
core.getPlaybackType.mockReturnValue(Playback.LIVE)
|
|
237
240
|
await runMetadataLoaded(core)
|
|
238
241
|
})
|
|
239
242
|
describe('when enabled', () => {
|
|
240
243
|
beforeEach(() => {
|
|
241
244
|
core.activePlayback.dvrEnabled = true
|
|
242
245
|
core.activeContainer.isDvrEnabled.mockReturnValue(true)
|
|
243
|
-
core.activeContainer.emit(Events.CONTAINER_SETTINGSUPDATE
|
|
246
|
+
core.activeContainer.emit(Events.CONTAINER_SETTINGSUPDATE)
|
|
244
247
|
})
|
|
245
248
|
it('should enable DVR controls', () => {
|
|
246
249
|
const element = document.createElement('div')
|
|
247
250
|
element.className = 'my-dvr-controls'
|
|
248
251
|
element.textContent = 'live'
|
|
249
|
-
mediaControl.
|
|
252
|
+
mediaControl.mount('dvr', $(element))
|
|
250
253
|
expect(mediaControl.el.innerHTML).toMatchSnapshot()
|
|
251
254
|
expect(
|
|
252
255
|
mediaControl.$el.find('.media-control-left-panel .my-dvr-controls')
|
|
@@ -259,7 +262,7 @@ describe('MediaControl', () => {
|
|
|
259
262
|
const element = document.createElement('div')
|
|
260
263
|
element.className = 'my-dvr-controls'
|
|
261
264
|
element.textContent = 'live'
|
|
262
|
-
mediaControl.
|
|
265
|
+
mediaControl.mount('dvr', $(element))
|
|
263
266
|
expect(mediaControl.el.innerHTML).toMatchSnapshot()
|
|
264
267
|
expect(
|
|
265
268
|
mediaControl.$el.find('.media-control-left-panel .my-dvr-controls')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`MediaControl >
|
|
3
|
+
exports[`MediaControl > mount > audiotracks > should put the element in the right panel 1`] = `
|
|
4
4
|
"<div class="media-control-background" data-background=""></div>
|
|
5
5
|
|
|
6
6
|
<div class="media-control-layer gcore-skin-bg-color" data-controls="">
|
|
@@ -26,9 +26,9 @@ exports[`MediaControl > putElement > audiotracks > should put the element in the
|
|
|
26
26
|
|
|
27
27
|
<div class="bar-container" data-volume="">
|
|
28
28
|
<div class="bar-background" data-volume="">
|
|
29
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
29
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
30
30
|
</div>
|
|
31
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
31
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
32
32
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
@@ -55,7 +55,7 @@ exports[`MediaControl > putElement > audiotracks > should put the element in the
|
|
|
55
55
|
<style>:root {}</style>"
|
|
56
56
|
`;
|
|
57
57
|
|
|
58
|
-
exports[`MediaControl >
|
|
58
|
+
exports[`MediaControl > mount > cc > should put the element in the right panel 1`] = `
|
|
59
59
|
"<div class="media-control-background" data-background=""></div>
|
|
60
60
|
|
|
61
61
|
<div class="media-control-layer gcore-skin-bg-color" data-controls="">
|
|
@@ -81,9 +81,9 @@ exports[`MediaControl > putElement > cc > should put the element in the right pa
|
|
|
81
81
|
|
|
82
82
|
<div class="bar-container" data-volume="">
|
|
83
83
|
<div class="bar-background" data-volume="">
|
|
84
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
84
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
85
85
|
</div>
|
|
86
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
86
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
87
87
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
@@ -110,7 +110,7 @@ exports[`MediaControl > putElement > cc > should put the element in the right pa
|
|
|
110
110
|
<style>:root {}</style>"
|
|
111
111
|
`;
|
|
112
112
|
|
|
113
|
-
exports[`MediaControl >
|
|
113
|
+
exports[`MediaControl > mount > gear > should put the element in the right panel 1`] = `
|
|
114
114
|
"<div class="media-control-background" data-background=""></div>
|
|
115
115
|
|
|
116
116
|
<div class="media-control-layer gcore-skin-bg-color" data-controls="">
|
|
@@ -136,9 +136,9 @@ exports[`MediaControl > putElement > gear > should put the element in the right
|
|
|
136
136
|
|
|
137
137
|
<div class="bar-container" data-volume="">
|
|
138
138
|
<div class="bar-background" data-volume="">
|
|
139
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
139
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
140
140
|
</div>
|
|
141
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
141
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
142
142
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
@@ -165,7 +165,7 @@ exports[`MediaControl > putElement > gear > should put the element in the right
|
|
|
165
165
|
<style>:root {}</style>"
|
|
166
166
|
`;
|
|
167
167
|
|
|
168
|
-
exports[`MediaControl >
|
|
168
|
+
exports[`MediaControl > mount > pip > should put the element in the right panel 1`] = `
|
|
169
169
|
"<div class="media-control-background" data-background=""></div>
|
|
170
170
|
|
|
171
171
|
<div class="media-control-layer gcore-skin-bg-color" data-controls="">
|
|
@@ -191,9 +191,9 @@ exports[`MediaControl > putElement > pip > should put the element in the right p
|
|
|
191
191
|
|
|
192
192
|
<div class="bar-container" data-volume="">
|
|
193
193
|
<div class="bar-background" data-volume="">
|
|
194
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
194
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
195
195
|
</div>
|
|
196
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
196
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
197
197
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
198
198
|
</div>
|
|
199
199
|
</div>
|
|
@@ -248,9 +248,9 @@ exports[`MediaControl > rendering timing > once metadata is loaded > should wait
|
|
|
248
248
|
|
|
249
249
|
<div class="bar-container" data-volume="">
|
|
250
250
|
<div class="bar-background" data-volume="">
|
|
251
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
251
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
252
252
|
</div>
|
|
253
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
253
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
254
254
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
255
255
|
</div>
|
|
256
256
|
</div>
|
|
@@ -271,11 +271,11 @@ exports[`MediaControl > rendering timing > once metadata is loaded > should wait
|
|
|
271
271
|
<div class="bar-container" data-seekbar="">
|
|
272
272
|
<div class="bar-background" data-seekbar="">
|
|
273
273
|
<div class="bar-fill-1" data-seekbar=""></div>
|
|
274
|
-
<div class="bar-fill-2 gcore-skin-main-color" data-seekbar="" style=""></div>
|
|
274
|
+
<div class="bar-fill-2 gcore-skin-main-color" data-seekbar="" style="width: 0%;"></div>
|
|
275
275
|
<div class="bar-hover" data-seekbar=""></div>
|
|
276
276
|
</div>
|
|
277
277
|
</div>
|
|
278
|
-
<div class="bar-scrubber" data-seekbar="" style="">
|
|
278
|
+
<div class="bar-scrubber" data-seekbar="" style="left: 0%;">
|
|
279
279
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-seekbar=""></div>
|
|
280
280
|
</div>
|
|
281
281
|
|
|
@@ -324,9 +324,9 @@ exports[`MediaControl > updateSettings > dvr > when disabled > should disable DV
|
|
|
324
324
|
|
|
325
325
|
<div class="bar-container" data-volume="">
|
|
326
326
|
<div class="bar-background" data-volume="">
|
|
327
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
327
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
328
328
|
</div>
|
|
329
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
329
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
330
330
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
331
331
|
</div>
|
|
332
332
|
</div>
|
|
@@ -385,9 +385,9 @@ exports[`MediaControl > updateSettings > dvr > when enabled > should enable DVR
|
|
|
385
385
|
|
|
386
386
|
<div class="bar-container" data-volume="">
|
|
387
387
|
<div class="bar-background" data-volume="">
|
|
388
|
-
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style=""></div>
|
|
388
|
+
<div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
|
|
389
389
|
</div>
|
|
390
|
-
<div class="bar-scrubber" data-volume="" style="">
|
|
390
|
+
<div class="bar-scrubber" data-volume="" style="left: 100%;">
|
|
391
391
|
<div class="bar-scrubber-icon gcore-skin-main-color" data-volume=""></div>
|
|
392
392
|
</div>
|
|
393
393
|
</div>
|
|
@@ -53,7 +53,7 @@ describe('ClosedCaptions', () => {
|
|
|
53
53
|
it('should render', () => {
|
|
54
54
|
expect(cc.el.innerHTML).toMatchSnapshot()
|
|
55
55
|
expect(cc.$el.find('[data-cc-button]').length).toEqual(1)
|
|
56
|
-
expect(mediaControl.
|
|
56
|
+
expect(mediaControl.mount).toHaveBeenCalledWith('cc', cc.$el)
|
|
57
57
|
})
|
|
58
58
|
})
|
|
59
59
|
})
|
|
@@ -627,7 +627,7 @@ export class VastAds extends UICorePlugin {
|
|
|
627
627
|
|
|
628
628
|
// Attempt to get click-to-pause plugin. (May interfere with advert click handling)
|
|
629
629
|
this._clickToPausePlugin = this._container?.getPlugin(
|
|
630
|
-
'
|
|
630
|
+
'click_to_pause',
|
|
631
631
|
)
|
|
632
632
|
|
|
633
633
|
assert(this.playback, 'playback is not defined')
|
|
@@ -72,7 +72,7 @@ export default class RollManager extends Events {
|
|
|
72
72
|
this._playback = this.core.activePlayback;
|
|
73
73
|
this._contentElement = this._playback.el as HTMLMediaElement;
|
|
74
74
|
this._posterPlugin = this._container.getPlugin('poster');
|
|
75
|
-
this._clickToPausePlugin = this._container.getPlugin('
|
|
75
|
+
this._clickToPausePlugin = this._container.getPlugin('click_to_pause');
|
|
76
76
|
this._adContainer = _adContainer;
|
|
77
77
|
this._events = {};
|
|
78
78
|
this._pr = Math.floor(Math.random() * 1000000);
|
package/src/testUtils.ts
CHANGED
|
@@ -100,7 +100,7 @@ export function createMockCore(
|
|
|
100
100
|
...options,
|
|
101
101
|
},
|
|
102
102
|
configure: vi.fn(),
|
|
103
|
-
getPlaybackType: vi.fn()
|
|
103
|
+
getPlaybackType: vi.fn(),
|
|
104
104
|
getPlugin: vi.fn(),
|
|
105
105
|
load: vi.fn(),
|
|
106
106
|
trigger: emitter.emit,
|
|
@@ -140,7 +140,7 @@ export function createMockPlayback(name = 'mock') {
|
|
|
140
140
|
getDuration: vi.fn().mockImplementation(() => 100),
|
|
141
141
|
enterPiP: vi.fn(),
|
|
142
142
|
exitPiP: vi.fn(),
|
|
143
|
-
getPlaybackType: vi.fn()
|
|
143
|
+
getPlaybackType: vi.fn(),
|
|
144
144
|
getStartTimeOffset: vi.fn().mockImplementation(() => 0),
|
|
145
145
|
getCurrentTime: vi.fn().mockImplementation(() => 0),
|
|
146
146
|
isHighDefinitionInUse: vi.fn().mockImplementation(() => false),
|
|
@@ -157,7 +157,10 @@ export function createMockPlayback(name = 'mock') {
|
|
|
157
157
|
})
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
export function createMockContainer(
|
|
160
|
+
export function createMockContainer(
|
|
161
|
+
options: Record<string, unknown> = {},
|
|
162
|
+
playback: any = createMockPlayback(),
|
|
163
|
+
) {
|
|
161
164
|
const el = playback.el
|
|
162
165
|
const emitter = new Events()
|
|
163
166
|
return Object.assign(emitter, {
|
|
@@ -167,7 +170,7 @@ export function createMockContainer(options: Record<string, unknown> = {}, playb
|
|
|
167
170
|
$el: $(el),
|
|
168
171
|
getDuration: vi.fn().mockReturnValue(0),
|
|
169
172
|
getPlugin: vi.fn(),
|
|
170
|
-
getPlaybackType: vi.fn()
|
|
173
|
+
getPlaybackType: vi.fn(),
|
|
171
174
|
isDvrInUse: vi.fn().mockReturnValue(false),
|
|
172
175
|
isDvrEnabled: vi.fn().mockReturnValue(false),
|
|
173
176
|
isPlaying: vi.fn().mockReturnValue(false),
|
|
@@ -202,7 +205,10 @@ export function createMockBottomGear(core: any) {
|
|
|
202
205
|
if (existing.length) {
|
|
203
206
|
return existing
|
|
204
207
|
}
|
|
205
|
-
return $('<li></li>')
|
|
208
|
+
return $('<li></li>')
|
|
209
|
+
.attr(`data-${name}`, '')
|
|
210
|
+
.append($el)
|
|
211
|
+
.appendTo(plugin.$el)
|
|
206
212
|
})
|
|
207
213
|
plugin.refresh = vi.fn()
|
|
208
214
|
return plugin
|
package/src/types.ts
CHANGED
|
@@ -163,7 +163,7 @@ export interface PlayerConfig extends Record<string, unknown> {
|
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* Stream type.
|
|
166
|
-
* @
|
|
166
|
+
* @remarks
|
|
167
167
|
* Should only be set if known in advance, as it should not change once determined.
|
|
168
168
|
* Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
|
|
169
169
|
*/
|