@gcorevideo/player 2.19.15 → 2.20.1
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/level-selector/list.ejs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.css +1634 -1634
- package/dist/index.js +585 -416
- package/dist/player.d.ts +268 -72
- package/dist/plugins/index.css +1567 -1567
- package/dist/plugins/index.js +526 -357
- package/docs/api/player.clapprnerdstats.md +12 -259
- package/docs/api/player.dvrcontrols.md +5 -1
- package/docs/api/player.errorscreen.attributes.md +3 -0
- package/docs/api/player.errorscreen.bindevents.md +3 -0
- package/docs/api/player.errorscreen.container.md +3 -0
- package/docs/api/player.errorscreen.hide.md +3 -0
- package/docs/api/player.errorscreen.md +27 -0
- package/docs/api/player.errorscreen.name.md +3 -0
- package/docs/api/player.errorscreen.render.md +3 -0
- package/docs/api/player.errorscreen.show.md +3 -0
- package/docs/api/player.errorscreen.supportedversion.md +3 -0
- package/docs/api/player.errorscreen.template.md +3 -0
- package/docs/api/player.errorscreen.unbindevents.md +3 -0
- package/docs/api/{player.playbackrate.template.md → player.initeventdata.event.md} +3 -3
- package/docs/api/{player.playbackrate.updateplaybackrate.md → player.initeventdata.md} +15 -11
- package/docs/api/player.md +88 -5
- package/docs/api/player.pictureinpicture.md +9 -197
- package/docs/api/player.playbackrate.md +10 -314
- package/docs/api/{player.playbackrate.onplay.md → player.stalleventdata.count.md} +5 -7
- package/docs/api/{player.playbackrate.name.md → player.stalleventdata.event.md} +3 -3
- package/docs/api/player.stalleventdata.md +112 -0
- package/docs/api/player.stalleventdata.time.md +13 -0
- package/docs/api/player.stalleventdata.total_ms.md +13 -0
- package/docs/api/{player.pluginsettings.md → player.starteventdata.event.md} +3 -5
- package/docs/api/{player.playbackrate.onrateselect.md → player.starteventdata.md} +15 -11
- package/docs/api/{player.statistics._constructor_.md → player.telemetry._constructor_.md} +6 -3
- package/docs/api/player.telemetry.md +146 -0
- package/docs/api/{player.volumefade.name.md → player.telemetry.name.md} +4 -2
- package/docs/api/{player.clapprnerdstats.supportedversion.md → player.telemetry.supportedversion.md} +4 -2
- package/docs/api/player.telemetryevent.md +89 -0
- package/docs/api/player.telemetryeventdata.md +15 -0
- package/docs/api/player.telemetrypluginsettings.md +57 -0
- package/docs/api/player.telemetrypluginsettings.send.md +13 -0
- package/docs/api/player.telemetryrecord.md +17 -0
- package/docs/api/player.volumefade.md +0 -93
- package/docs/api/{player.pictureinpicture.name.md → player.watcheventdata.event.md} +3 -3
- package/docs/api/{player.playbackrate.setselectedrate.md → player.watcheventdata.md} +15 -11
- package/lib/index.plugins.d.ts +2 -2
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -2
- package/lib/playback/hls-playback/HlsPlayback.js +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +38 -5
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +63 -17
- package/lib/plugins/dvr-controls/DvrControls.d.ts +5 -2
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +5 -2
- package/lib/plugins/error-screen/ErrorScreen.d.ts +5 -0
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +5 -0
- package/lib/plugins/index.d.ts +2 -3
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/index.js +2 -3
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +32 -4
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -1
- package/lib/plugins/picture-in-picture/PictureInPicture.js +30 -2
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +47 -14
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +38 -9
- package/lib/plugins/statistics/Statistics.d.ts +38 -3
- package/lib/plugins/statistics/Statistics.d.ts.map +1 -1
- package/lib/plugins/statistics/Statistics.js +51 -9
- package/lib/plugins/telemetry/Telemetry.d.ts +135 -0
- package/lib/plugins/telemetry/Telemetry.d.ts.map +1 -0
- package/lib/plugins/telemetry/Telemetry.js +180 -0
- package/lib/plugins/volume-fade/VolumeFade.d.ts +7 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +8 -1
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -2
- package/src/playback/hls-playback/HlsPlayback.ts +1 -1
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +240 -173
- package/src/plugins/dvr-controls/DvrControls.ts +5 -2
- package/src/plugins/error-screen/ErrorScreen.ts +5 -0
- package/src/plugins/index.ts +2 -3
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +47 -26
- package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +18 -18
- package/src/plugins/picture-in-picture/PictureInPicture.ts +35 -7
- package/src/plugins/playback-rate/PlaybackRate.ts +53 -24
- package/src/plugins/telemetry/Telemetry.ts +299 -0
- package/src/plugins/volume-fade/VolumeFade.ts +9 -2
- package/temp/player.api.json +2322 -3281
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.clapprnerdstats.attributes.md +0 -17
- package/docs/api/player.clapprnerdstats.bindevents.md +0 -18
- package/docs/api/player.clapprnerdstats.events.md +0 -18
- package/docs/api/player.clapprnerdstats.name.md +0 -14
- package/docs/api/player.clapprnerdstats.playerheight.md +0 -14
- package/docs/api/player.clapprnerdstats.playerwidth.md +0 -14
- package/docs/api/player.clapprnerdstats.render.md +0 -18
- package/docs/api/player.clapprnerdstats.statsboxelem.md +0 -14
- package/docs/api/player.clapprnerdstats.statsboxwidththreshold.md +0 -14
- package/docs/api/player.clapprnerdstats.template.md +0 -14
- package/docs/api/player.pictureinpicture.bindevents.md +0 -15
- package/docs/api/player.pictureinpicture.events.md +0 -13
- package/docs/api/player.pictureinpicture.exitpictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.render.md +0 -15
- package/docs/api/player.pictureinpicture.requestpictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.supportedversion.md +0 -13
- package/docs/api/player.pictureinpicture.togglepictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.version.md +0 -11
- package/docs/api/player.pictureinpicture.videoelement.md +0 -11
- package/docs/api/player.playbackrate.attributes.md +0 -14
- package/docs/api/player.playbackrate.bindevents.md +0 -15
- package/docs/api/player.playbackrate.events.md +0 -15
- package/docs/api/player.playbackrate.gettitle.md +0 -15
- package/docs/api/player.playbackrate.goback.md +0 -15
- package/docs/api/player.playbackrate.highlightcurrentrate.md +0 -15
- package/docs/api/player.playbackrate.onfinishad.md +0 -15
- package/docs/api/player.playbackrate.onshowmenu.md +0 -15
- package/docs/api/player.playbackrate.onstartad.md +0 -15
- package/docs/api/player.playbackrate.onstop.md +0 -15
- package/docs/api/player.playbackrate.reload.md +0 -15
- package/docs/api/player.playbackrate.render.md +0 -15
- package/docs/api/player.playbackrate.supportedversion.md +0 -13
- package/docs/api/player.playbackrate.unbindevents.md +0 -15
- package/docs/api/player.statistics.bindevents.md +0 -15
- package/docs/api/player.statistics.md +0 -141
- package/docs/api/player.statistics.name.md +0 -11
- package/docs/api/player.statistics.supportedversion.md +0 -13
- package/docs/api/player.volumefade.bindevents.md +0 -18
- package/docs/api/player.volumefade.unbindevents.md +0 -18
- package/src/plugins/statistics/Statistics.ts +0 -207
- /package/src/plugins/{statistics → telemetry}/Statistics copy.xts +0 -0
|
@@ -44,6 +44,7 @@ describe('LevelSelector', () => {
|
|
|
44
44
|
const activeContainer = createContainer()
|
|
45
45
|
activePlayback = createPlayback()
|
|
46
46
|
let mediaControl: UICorePlugin | null = null
|
|
47
|
+
let bottomGear: UICorePlugin | null = null
|
|
47
48
|
core = Object.assign(new EventLite(), {
|
|
48
49
|
activeContainer,
|
|
49
50
|
activePlayback,
|
|
@@ -57,10 +58,14 @@ describe('LevelSelector', () => {
|
|
|
57
58
|
if (name === 'media_control') {
|
|
58
59
|
return mediaControl
|
|
59
60
|
}
|
|
61
|
+
if (name === 'bottom_gear') {
|
|
62
|
+
return bottomGear
|
|
63
|
+
}
|
|
60
64
|
return null
|
|
61
65
|
}),
|
|
62
66
|
})
|
|
63
67
|
mediaControl = createMediaControl(core)
|
|
68
|
+
bottomGear = createBottomGear(core)
|
|
64
69
|
levelSelector = new LevelSelector(core)
|
|
65
70
|
})
|
|
66
71
|
describe('initially', () => {
|
|
@@ -71,29 +76,15 @@ describe('LevelSelector', () => {
|
|
|
71
76
|
await clock.tickAsync(1)
|
|
72
77
|
})
|
|
73
78
|
it('should render the proper level label', () => {
|
|
79
|
+
// @ts-ignore
|
|
74
80
|
expect(levelSelector.el.textContent).toMatchQualityLevelLabel('Auto')
|
|
75
81
|
})
|
|
76
82
|
})
|
|
77
83
|
describe.each([
|
|
78
|
-
[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'Auto',
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
'standard label',
|
|
86
|
-
LEVELS,
|
|
87
|
-
0,
|
|
88
|
-
'360p',
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
'custom label',
|
|
92
|
-
LEVELS,
|
|
93
|
-
1,
|
|
94
|
-
'HD',
|
|
95
|
-
],
|
|
96
|
-
])("%s", (_, levels, current, label) => {
|
|
84
|
+
['auto', LEVELS, -1, 'Auto'],
|
|
85
|
+
['standard label', LEVELS, 0, '360p'],
|
|
86
|
+
['custom label', LEVELS, 1, 'HD'],
|
|
87
|
+
])('%s', (_, levels, current, label) => {
|
|
97
88
|
beforeEach(async () => {
|
|
98
89
|
core.emit('core:active:container:changed')
|
|
99
90
|
await clock.tickAsync(1)
|
|
@@ -102,14 +93,19 @@ describe('LevelSelector', () => {
|
|
|
102
93
|
await clock.tickAsync(1)
|
|
103
94
|
levelSelector.$el.find('.gear-option').click()
|
|
104
95
|
await clock.tickAsync(1)
|
|
105
|
-
levelSelector.$el
|
|
96
|
+
levelSelector.$el
|
|
97
|
+
.find(`.gear-sub-menu_btn[data-id="${current}"]`)
|
|
98
|
+
.click()
|
|
106
99
|
await clock.tickAsync(1)
|
|
107
100
|
})
|
|
108
101
|
it('should render the proper level labels', () => {
|
|
109
102
|
expect(levelSelector.el.innerHTML).toMatchSnapshot()
|
|
110
103
|
})
|
|
111
104
|
it('should render the selected level', () => {
|
|
112
|
-
expect(
|
|
105
|
+
expect(
|
|
106
|
+
levelSelector.$el.find('ul.gear-sub-menu .current')[0].textContent,
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
).toMatchQualityLevelOption(label)
|
|
113
109
|
})
|
|
114
110
|
})
|
|
115
111
|
})
|
|
@@ -118,6 +114,7 @@ describe('LevelSelector', () => {
|
|
|
118
114
|
const activeContainer = createContainer()
|
|
119
115
|
activePlayback = createPlayback()
|
|
120
116
|
let mediaControl: UICorePlugin | null = null
|
|
117
|
+
let bottomGear: UICorePlugin | null = null
|
|
121
118
|
core = Object.assign(new EventLite(), {
|
|
122
119
|
activeContainer,
|
|
123
120
|
activePlayback,
|
|
@@ -131,10 +128,14 @@ describe('LevelSelector', () => {
|
|
|
131
128
|
if (name === 'media_control') {
|
|
132
129
|
return mediaControl
|
|
133
130
|
}
|
|
131
|
+
if (name === 'bottom_gear') {
|
|
132
|
+
return bottomGear
|
|
133
|
+
}
|
|
134
134
|
return null
|
|
135
135
|
}),
|
|
136
136
|
})
|
|
137
137
|
mediaControl = createMediaControl(core)
|
|
138
|
+
bottomGear = createBottomGear(core)
|
|
138
139
|
levelSelector = new LevelSelector(core)
|
|
139
140
|
})
|
|
140
141
|
describe('basically', () => {
|
|
@@ -146,7 +147,8 @@ describe('LevelSelector', () => {
|
|
|
146
147
|
})
|
|
147
148
|
it('should render the restricted quality level label', () => {
|
|
148
149
|
expect(
|
|
149
|
-
levelSelector.el.textContent
|
|
150
|
+
levelSelector.el.textContent,
|
|
151
|
+
// @ts-ignore
|
|
150
152
|
).toMatchQualityLevelLabel('360p')
|
|
151
153
|
|
|
152
154
|
expect(levelSelector.el.innerHTML).toMatchSnapshot()
|
|
@@ -185,7 +187,10 @@ describe('LevelSelector', () => {
|
|
|
185
187
|
expect(levelSelector.el.innerHTML).toMatchSnapshot()
|
|
186
188
|
})
|
|
187
189
|
it('should properly apply the restriction', () => {
|
|
188
|
-
expect(
|
|
190
|
+
expect(
|
|
191
|
+
levelSelector.$el.find('li:not(.level-disabled)')[0].textContent,
|
|
192
|
+
// @ts-ignore
|
|
193
|
+
).toMatchQualityLevelOption('360p')
|
|
189
194
|
})
|
|
190
195
|
})
|
|
191
196
|
})
|
|
@@ -217,7 +222,10 @@ expect.extend({
|
|
|
217
222
|
.trim()
|
|
218
223
|
return {
|
|
219
224
|
pass: rendered.includes(`Quality ${expected}`),
|
|
220
|
-
message: () =>
|
|
225
|
+
message: () =>
|
|
226
|
+
`Quality label must${
|
|
227
|
+
isNot ? ' not' : ''
|
|
228
|
+
} be ${expected} in "${rendered}"`,
|
|
221
229
|
}
|
|
222
230
|
},
|
|
223
231
|
toMatchQualityLevelOption(received, expected) {
|
|
@@ -228,13 +236,26 @@ expect.extend({
|
|
|
228
236
|
.trim()
|
|
229
237
|
return {
|
|
230
238
|
pass: rendered === expected,
|
|
231
|
-
message: () =>
|
|
239
|
+
message: () =>
|
|
240
|
+
`Quality option must${
|
|
241
|
+
isNot ? ' not' : ''
|
|
242
|
+
} be ${expected} in "${rendered}"`,
|
|
232
243
|
}
|
|
233
|
-
}
|
|
244
|
+
},
|
|
234
245
|
})
|
|
235
246
|
|
|
236
247
|
function createMediaControl(core: any) {
|
|
237
248
|
const mediaControl = new UICorePlugin(core)
|
|
249
|
+
// @ts-ignore
|
|
238
250
|
mediaControl.getElement = vi.fn().mockReturnValue(null)
|
|
239
251
|
return mediaControl
|
|
240
252
|
}
|
|
253
|
+
|
|
254
|
+
function createBottomGear(core: any) {
|
|
255
|
+
const bottomGear = new UICorePlugin(core)
|
|
256
|
+
// @ts-ignore
|
|
257
|
+
bottomGear.getElement = vi.fn().mockReturnValue(null)
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
bottomGear.setContent = vi.fn()
|
|
260
|
+
return bottomGear
|
|
261
|
+
}
|
|
@@ -8,7 +8,7 @@ exports[`LevelSelector > basically > auto > should render the proper level label
|
|
|
8
8
|
<ul class="gear-sub-menu">
|
|
9
9
|
|
|
10
10
|
<li class="current">
|
|
11
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="-1">
|
|
11
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="-1" id="level_selector_auto">
|
|
12
12
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
13
13
|
Auto
|
|
14
14
|
</a>
|
|
@@ -16,21 +16,21 @@ exports[`LevelSelector > basically > auto > should render the proper level label
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
<li class="">
|
|
19
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
19
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" id="level_selector_1080">
|
|
20
20
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
21
21
|
1080p
|
|
22
22
|
</a>
|
|
23
23
|
</li>
|
|
24
24
|
|
|
25
25
|
<li class="">
|
|
26
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1">
|
|
26
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1" id="level_selector_720">
|
|
27
27
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
28
28
|
HD
|
|
29
29
|
</a>
|
|
30
30
|
</li>
|
|
31
31
|
|
|
32
32
|
<li class="">
|
|
33
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="0">
|
|
33
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="0" id="level_selector_360">
|
|
34
34
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
35
35
|
360p
|
|
36
36
|
</a>
|
|
@@ -48,7 +48,7 @@ exports[`LevelSelector > basically > custom label > should render the proper lev
|
|
|
48
48
|
<ul class="gear-sub-menu">
|
|
49
49
|
|
|
50
50
|
<li class="">
|
|
51
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1">
|
|
51
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto">
|
|
52
52
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
53
53
|
Auto
|
|
54
54
|
</a>
|
|
@@ -56,21 +56,21 @@ exports[`LevelSelector > basically > custom label > should render the proper lev
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
<li class="">
|
|
59
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
59
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" id="level_selector_1080">
|
|
60
60
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
61
61
|
1080p
|
|
62
62
|
</a>
|
|
63
63
|
</li>
|
|
64
64
|
|
|
65
65
|
<li class="current">
|
|
66
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="1">
|
|
66
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="1" id="level_selector_720">
|
|
67
67
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
68
68
|
HD
|
|
69
69
|
</a>
|
|
70
70
|
</li>
|
|
71
71
|
|
|
72
72
|
<li class="">
|
|
73
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="0">
|
|
73
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="0" id="level_selector_360">
|
|
74
74
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
75
75
|
360p
|
|
76
76
|
</a>
|
|
@@ -88,7 +88,7 @@ exports[`LevelSelector > basically > standard label > should render the proper l
|
|
|
88
88
|
<ul class="gear-sub-menu">
|
|
89
89
|
|
|
90
90
|
<li class="">
|
|
91
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1">
|
|
91
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto">
|
|
92
92
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
93
93
|
Auto
|
|
94
94
|
</a>
|
|
@@ -96,21 +96,21 @@ exports[`LevelSelector > basically > standard label > should render the proper l
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
<li class="">
|
|
99
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
99
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" id="level_selector_1080">
|
|
100
100
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
101
101
|
1080p
|
|
102
102
|
</a>
|
|
103
103
|
</li>
|
|
104
104
|
|
|
105
105
|
<li class="">
|
|
106
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1">
|
|
106
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1" id="level_selector_720">
|
|
107
107
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
108
108
|
HD
|
|
109
109
|
</a>
|
|
110
110
|
</li>
|
|
111
111
|
|
|
112
112
|
<li class="current">
|
|
113
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0">
|
|
113
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0" id="level_selector_360">
|
|
114
114
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
115
115
|
360p
|
|
116
116
|
</a>
|
|
@@ -139,21 +139,21 @@ exports[`LevelSelector > options.restrictResolution > given vertical video forma
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
<li class="level-disabled">
|
|
142
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
142
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" id="level_selector_1080">
|
|
143
143
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
144
144
|
1080p
|
|
145
145
|
</a>
|
|
146
146
|
</li>
|
|
147
147
|
|
|
148
148
|
<li class="level-disabled">
|
|
149
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1">
|
|
149
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1" id="level_selector_1280">
|
|
150
150
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
151
151
|
720p
|
|
152
152
|
</a>
|
|
153
153
|
</li>
|
|
154
154
|
|
|
155
155
|
<li class="current">
|
|
156
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0">
|
|
156
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0" id="level_selector_640">
|
|
157
157
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
158
158
|
360p
|
|
159
159
|
</a>
|
|
@@ -172,21 +172,21 @@ exports[`LevelSelector > options.restrictResolution > given vertical video forma
|
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
<li class="level-disabled">
|
|
175
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
175
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" id="level_selector_1080">
|
|
176
176
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
177
177
|
1080p
|
|
178
178
|
</a>
|
|
179
179
|
</li>
|
|
180
180
|
|
|
181
181
|
<li class="level-disabled">
|
|
182
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1">
|
|
182
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1" id="level_selector_1280">
|
|
183
183
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
184
184
|
720p
|
|
185
185
|
</a>
|
|
186
186
|
</li>
|
|
187
187
|
|
|
188
188
|
<li class="current">
|
|
189
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0">
|
|
189
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0" id="level_selector_640">
|
|
190
190
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
191
191
|
360p
|
|
192
192
|
</a>
|
|
@@ -9,31 +9,56 @@ import '../../../assets/picture-in-picture/button.scss';
|
|
|
9
9
|
|
|
10
10
|
const VERSION = '0.0.1';
|
|
11
11
|
|
|
12
|
-
const T = `plugins.
|
|
13
|
-
|
|
12
|
+
const T = `plugins.pip`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Enables picture in picture mode.
|
|
16
|
+
* @beta
|
|
17
|
+
* @remarks
|
|
18
|
+
* Depends on:
|
|
19
|
+
*
|
|
20
|
+
* - {@link MediaControl}
|
|
21
|
+
*
|
|
22
|
+
* It renders a button to toggle picture in picture mode in the media control UI.
|
|
23
|
+
*/
|
|
14
24
|
export class PictureInPicture extends UICorePlugin {
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
15
28
|
get name() {
|
|
16
|
-
return '
|
|
29
|
+
return 'pip';
|
|
17
30
|
}
|
|
18
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
19
35
|
get supportedVersion() {
|
|
20
36
|
return { min: CLAPPR_VERSION };
|
|
21
37
|
}
|
|
22
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
23
42
|
static get version() {
|
|
24
43
|
return VERSION;
|
|
25
44
|
}
|
|
26
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
27
49
|
override get events() {
|
|
28
50
|
return {
|
|
29
51
|
'click button': 'togglePictureInPicture',
|
|
30
52
|
};
|
|
31
53
|
}
|
|
32
54
|
|
|
33
|
-
get videoElement() {
|
|
55
|
+
private get videoElement() {
|
|
34
56
|
return this.core.activePlayback.el;
|
|
35
57
|
}
|
|
36
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
37
62
|
override bindEvents() {
|
|
38
63
|
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
39
64
|
}
|
|
@@ -47,6 +72,9 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
47
72
|
return document.pictureInPictureEnabled && !!HTMLVideoElement.prototype.requestPictureInPicture;
|
|
48
73
|
}
|
|
49
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
50
78
|
override render() {
|
|
51
79
|
if (!this.isPiPSupported()) {
|
|
52
80
|
return this;
|
|
@@ -64,7 +92,7 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
64
92
|
return this;
|
|
65
93
|
}
|
|
66
94
|
|
|
67
|
-
togglePictureInPicture() {
|
|
95
|
+
private togglePictureInPicture() {
|
|
68
96
|
trace(`${T} togglePictureInPicture`);
|
|
69
97
|
if (this.videoElement !== document.pictureInPictureElement) {
|
|
70
98
|
this.requestPictureInPicture();
|
|
@@ -73,14 +101,14 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
73
101
|
}
|
|
74
102
|
}
|
|
75
103
|
|
|
76
|
-
requestPictureInPicture() {
|
|
104
|
+
private requestPictureInPicture() {
|
|
77
105
|
trace(`${T} requestPictureInPicture`, {
|
|
78
106
|
videoElement: !!this.videoElement,
|
|
79
107
|
});
|
|
80
108
|
this.videoElement.requestPictureInPicture();
|
|
81
109
|
}
|
|
82
110
|
|
|
83
|
-
exitPictureInPicture() {
|
|
111
|
+
private exitPictureInPicture() {
|
|
84
112
|
trace(`${T} exitPictureInPicture`);
|
|
85
113
|
document.exitPictureInPicture();
|
|
86
114
|
}
|
|
@@ -31,6 +31,19 @@ const DEFAULT_PLAYBACK_RATE = '1.0';
|
|
|
31
31
|
// TODO
|
|
32
32
|
const MEDIACONTROL_PLAYBACKRATE = 'playbackRate';
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Allows changing the playback speed of the video.
|
|
36
|
+
* @beta
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Depends on:
|
|
40
|
+
*
|
|
41
|
+
* - {@link MediaControl | media_control}
|
|
42
|
+
*
|
|
43
|
+
* - {@link BottomGear | bottom_gear}
|
|
44
|
+
*
|
|
45
|
+
* It renders a button in the gear menu, which opens a dropdown with the available playback rates.
|
|
46
|
+
*/
|
|
34
47
|
export class PlaybackRate extends UICorePlugin {
|
|
35
48
|
private currentPlayback: Playback | null = null;
|
|
36
49
|
|
|
@@ -40,18 +53,29 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
40
53
|
|
|
41
54
|
private selectedRate: string = DEFAULT_PLAYBACK_RATE;
|
|
42
55
|
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
43
59
|
get name() {
|
|
44
|
-
return '
|
|
60
|
+
return 'playback_rate';
|
|
45
61
|
}
|
|
46
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
47
66
|
get supportedVersion() {
|
|
48
67
|
return { min: CLAPPR_VERSION };
|
|
49
68
|
}
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
private static readonly template = template(pluginHtml);
|
|
71
|
+
|
|
72
|
+
private static readonly buttonTemplate = template(buttonHtml);
|
|
73
|
+
|
|
74
|
+
private static readonly listTemplate = template(listHtml);
|
|
54
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
55
79
|
override get attributes() {
|
|
56
80
|
return {
|
|
57
81
|
'class': this.name,
|
|
@@ -59,6 +83,9 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
59
83
|
};
|
|
60
84
|
}
|
|
61
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
62
89
|
override get events() {
|
|
63
90
|
return {
|
|
64
91
|
'click .gear-sub-menu_btn': 'onRateSelect',
|
|
@@ -67,8 +94,12 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
67
94
|
};
|
|
68
95
|
}
|
|
69
96
|
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
70
100
|
override bindEvents() {
|
|
71
101
|
this.listenTo(this.core, 'gear:rendered', this.render);
|
|
102
|
+
// TODO this.core.getPlugin('media_control'), bottom_gear
|
|
72
103
|
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
73
104
|
this.listenTo(this.core.mediaControl, MEDIACONTROL_PLAYBACKRATE, this.updatePlaybackRate);
|
|
74
105
|
|
|
@@ -87,7 +118,7 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
87
118
|
}
|
|
88
119
|
}
|
|
89
120
|
|
|
90
|
-
unBindEvents() {
|
|
121
|
+
private unBindEvents() {
|
|
91
122
|
this.stopListening(this.core, 'gear:rendered', this.render);
|
|
92
123
|
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
93
124
|
this.stopListening(this.core, 'core:advertisement:start', this.onStartAd);
|
|
@@ -121,7 +152,7 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
121
152
|
}
|
|
122
153
|
}
|
|
123
154
|
|
|
124
|
-
reload() {
|
|
155
|
+
private reload() {
|
|
125
156
|
this.unBindEvents();
|
|
126
157
|
this.bindEvents();
|
|
127
158
|
}
|
|
@@ -136,6 +167,9 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
136
167
|
return !(this.currentPlayback?.tagName !== 'video' && this.currentPlayback?.tagName !== 'audio');
|
|
137
168
|
}
|
|
138
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
139
173
|
override render() {
|
|
140
174
|
const container = this.core.activeContainer;
|
|
141
175
|
|
|
@@ -153,9 +187,7 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
153
187
|
}
|
|
154
188
|
|
|
155
189
|
if (this.shouldRender()) {
|
|
156
|
-
const
|
|
157
|
-
// const html = t({ playbackRates: this.playbackRates, title: this.getTitle() });
|
|
158
|
-
const button = t({
|
|
190
|
+
const button = PlaybackRate.buttonTemplate({
|
|
159
191
|
title: this.getTitle(),
|
|
160
192
|
speedIcon,
|
|
161
193
|
arrowRightIcon,
|
|
@@ -177,19 +209,19 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
177
209
|
return this;
|
|
178
210
|
}
|
|
179
211
|
|
|
180
|
-
onStartAd() {
|
|
212
|
+
private onStartAd() {
|
|
181
213
|
this.prevSelectedRate = this.selectedRate;
|
|
182
214
|
this.setSelectedRate('1.0');
|
|
183
215
|
this.listenToOnce(this.currentPlayback, Events.PLAYBACK_PLAY, this.onFinishAd);
|
|
184
216
|
}
|
|
185
217
|
|
|
186
|
-
onFinishAd() {
|
|
218
|
+
private onFinishAd() {
|
|
187
219
|
if (this.prevSelectedRate) {
|
|
188
220
|
this.setSelectedRate(this.prevSelectedRate);
|
|
189
221
|
}
|
|
190
222
|
}
|
|
191
223
|
|
|
192
|
-
onPlay() {
|
|
224
|
+
private onPlay() {
|
|
193
225
|
if (!this.core.mediaControl.$el.hasClass('dvr')) {
|
|
194
226
|
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
195
227
|
this.updatePlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
@@ -200,11 +232,10 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
200
232
|
}
|
|
201
233
|
}
|
|
202
234
|
|
|
203
|
-
onStop() {
|
|
204
|
-
|
|
235
|
+
private onStop() {
|
|
205
236
|
}
|
|
206
237
|
|
|
207
|
-
onRateSelect(event: MouseEvent) {
|
|
238
|
+
private onRateSelect(event: MouseEvent) {
|
|
208
239
|
event.stopPropagation();
|
|
209
240
|
const rate = (event.currentTarget as HTMLElement).dataset.rate;
|
|
210
241
|
if (rate) {
|
|
@@ -215,10 +246,8 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
215
246
|
return false;
|
|
216
247
|
}
|
|
217
248
|
|
|
218
|
-
onShowMenu() {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this.$el.html(t({
|
|
249
|
+
private onShowMenu() {
|
|
250
|
+
this.$el.html(PlaybackRate.listTemplate({
|
|
222
251
|
playbackRates: this.playbackRates,
|
|
223
252
|
arrowLeftIcon,
|
|
224
253
|
checkIcon,
|
|
@@ -228,15 +257,15 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
228
257
|
this.highlightCurrentRate();
|
|
229
258
|
}
|
|
230
259
|
|
|
231
|
-
goBack() {
|
|
260
|
+
private goBack() {
|
|
232
261
|
this.core.trigger('gear:refresh');
|
|
233
262
|
}
|
|
234
263
|
|
|
235
|
-
updatePlaybackRate(rate: string) {
|
|
264
|
+
private updatePlaybackRate(rate: string) {
|
|
236
265
|
this.setSelectedRate(rate);
|
|
237
266
|
}
|
|
238
267
|
|
|
239
|
-
setSelectedRate(rate: string) {
|
|
268
|
+
private setSelectedRate(rate: string) {
|
|
240
269
|
// Set <video playbackRate="..."
|
|
241
270
|
this.core.$el.find('video,audio').get(0).playbackRate = rate;
|
|
242
271
|
this.selectedRate = rate;
|
|
@@ -244,7 +273,7 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
244
273
|
// Player.player.trigger('playbackRateChanged', rate);
|
|
245
274
|
}
|
|
246
275
|
|
|
247
|
-
getTitle() {
|
|
276
|
+
private getTitle() {
|
|
248
277
|
let title = this.selectedRate;
|
|
249
278
|
|
|
250
279
|
this.playbackRates.forEach((r) => {
|
|
@@ -256,7 +285,7 @@ export class PlaybackRate extends UICorePlugin {
|
|
|
256
285
|
return title;
|
|
257
286
|
}
|
|
258
287
|
|
|
259
|
-
highlightCurrentRate() {
|
|
288
|
+
private highlightCurrentRate() {
|
|
260
289
|
this.allRateElements().removeClass('current');
|
|
261
290
|
this.allRateElements().find('a').removeClass('gcore-skin-active');
|
|
262
291
|
|