@gcorevideo/player 2.22.21 → 2.22.23
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/clappr-nerd-stats/clappr-nerd-stats.ejs +30 -30
- package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +18 -14
- package/dist/core.js +1 -1
- package/dist/index.css +1433 -1425
- package/dist/index.js +4335 -4299
- package/dist/player.d.ts +32 -10
- package/dist/plugins/index.css +632 -624
- package/dist/plugins/index.js +5366 -5334
- package/docs/api/player.extendedevents.md +45 -0
- package/docs/api/player.md +21 -1
- package/docs/api/player.volumefade._constructor_.md +50 -0
- package/docs/api/player.volumefade.md +40 -1
- package/docs/api/player.volumefadesettings.md +18 -0
- 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/plugins/audio-selector/AudioTracks.d.ts +67 -0
- package/lib/plugins/audio-selector/AudioTracks.d.ts.map +1 -0
- package/lib/plugins/audio-selector/AudioTracks.js +176 -0
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +6 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +2 -1
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +19 -3
- package/lib/plugins/clappr-nerd-stats/speedtest/index.js +1 -1
- package/lib/plugins/clappr-nerd-stats/utils.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/utils.js +14 -15
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +1 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +3 -0
- package/lib/plugins/click-to-pause/ClickToPause.js +6 -7
- package/lib/plugins/media-control/MediaControl.d.ts +2 -1
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +1 -0
- package/lib/plugins/skip-time/SkipTime.d.ts +2 -2
- package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -1
- package/lib/plugins/skip-time/SkipTime.js +6 -5
- package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +10 -3
- package/lib/plugins/volume-fade/VolumeFade.d.ts +3 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +6 -3
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -2
- package/src/plugins/audio-selector/{AudioSelector.ts → AudioTracks.ts} +6 -3
- package/src/plugins/audio-selector/__tests__/{AudioSelector.test.ts → AudioTracks.test.ts} +24 -24
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +66 -0
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioTracks.test.ts.snap +67 -0
- package/src/plugins/bottom-gear/BottomGear.ts +10 -0
- package/src/plugins/clappr-nerd-stats/NerdStats.ts +26 -7
- package/src/plugins/clappr-nerd-stats/speedtest/index.ts +1 -1
- package/src/plugins/clappr-nerd-stats/utils.ts +20 -13
- package/src/plugins/clappr-stats/ClapprStats.ts +4 -0
- package/src/plugins/click-to-pause/ClickToPause.ts +6 -6
- package/src/plugins/media-control/MediaControl.ts +1 -0
- package/src/plugins/skip-time/SkipTime.ts +45 -38
- package/src/plugins/subtitles/ClosedCaptions.ts +17 -7
- package/src/plugins/volume-fade/VolumeFade.ts +6 -3
- package/temp/player.api.json +100 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`AudioTracks > given that audio tracks are available > should render menu hidden 1`] = `
|
|
4
|
+
"<button data-audiotracks-button="" class="gcore-skin-button-color" id="audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
5
|
+
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
6
|
+
</button>
|
|
7
|
+
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
8
|
+
|
|
9
|
+
<li class="">
|
|
10
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
11
|
+
English
|
|
12
|
+
</a>
|
|
13
|
+
</li>
|
|
14
|
+
|
|
15
|
+
<li class="">
|
|
16
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
17
|
+
Spanish
|
|
18
|
+
</a>
|
|
19
|
+
</li>
|
|
20
|
+
|
|
21
|
+
</ul>
|
|
22
|
+
"
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`AudioTracks > given that audio tracks are available > when button is clicked > should show menu 1`] = `
|
|
26
|
+
"<button data-audiotracks-button="" class="gcore-skin-button-color" id="audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
27
|
+
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
28
|
+
</button>
|
|
29
|
+
<ul class="gcore-skin-bg-color menu" id="audiotracks-select" role="menu">
|
|
30
|
+
|
|
31
|
+
<li class="">
|
|
32
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
33
|
+
English
|
|
34
|
+
</a>
|
|
35
|
+
</li>
|
|
36
|
+
|
|
37
|
+
<li class="">
|
|
38
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
39
|
+
Spanish
|
|
40
|
+
</a>
|
|
41
|
+
</li>
|
|
42
|
+
|
|
43
|
+
</ul>
|
|
44
|
+
"
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`AudioTracks > given that audio tracks are available > when button is clicked > when audio track is selected > should hide the menu 1`] = `
|
|
48
|
+
"<button data-audiotracks-button="" class="gcore-skin-button-color changing" id="audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
49
|
+
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
50
|
+
</button>
|
|
51
|
+
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
52
|
+
|
|
53
|
+
<li class="">
|
|
54
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
55
|
+
English
|
|
56
|
+
</a>
|
|
57
|
+
</li>
|
|
58
|
+
|
|
59
|
+
<li class="">
|
|
60
|
+
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
61
|
+
Spanish
|
|
62
|
+
</a>
|
|
63
|
+
</li>
|
|
64
|
+
|
|
65
|
+
</ul>
|
|
66
|
+
"
|
|
67
|
+
`;
|
|
@@ -10,6 +10,7 @@ import '../../../assets/bottom-gear/gear-sub-menu.scss'
|
|
|
10
10
|
import gearIcon from '../../../assets/icons/new/gear.svg'
|
|
11
11
|
import gearHdIcon from '../../../assets/icons/new/gear-hd.svg'
|
|
12
12
|
import { ZeptoResult } from '../../types.js'
|
|
13
|
+
import { ExtendedEvents } from '../media-control/MediaControl.js'
|
|
13
14
|
|
|
14
15
|
const VERSION = '2.19.12'
|
|
15
16
|
|
|
@@ -254,10 +255,14 @@ export class BottomGear extends UICorePlugin {
|
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
private toggleGearMenu() {
|
|
258
|
+
this.core
|
|
259
|
+
.getPlugin('media_control')
|
|
260
|
+
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE)
|
|
257
261
|
this.$el.find('#gear-options-wrapper').toggle()
|
|
258
262
|
}
|
|
259
263
|
|
|
260
264
|
private hide() {
|
|
265
|
+
trace(`${T} hide`)
|
|
261
266
|
this.$el.find('#gear-options-wrapper').hide()
|
|
262
267
|
}
|
|
263
268
|
|
|
@@ -271,6 +276,11 @@ export class BottomGear extends UICorePlugin {
|
|
|
271
276
|
this.onMediaControlRendered,
|
|
272
277
|
)
|
|
273
278
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.hide)
|
|
279
|
+
this.listenTo(
|
|
280
|
+
mediaControl,
|
|
281
|
+
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
282
|
+
this.hide,
|
|
283
|
+
)
|
|
274
284
|
}
|
|
275
285
|
|
|
276
286
|
private onMediaControlRendered() {
|
|
@@ -71,7 +71,7 @@ const T = 'plugins.nerd_stats'
|
|
|
71
71
|
* - {@link BottomGear} - where the button is attached
|
|
72
72
|
*
|
|
73
73
|
* - {@link ClapprStats} - to get the metrics from
|
|
74
|
-
*
|
|
74
|
+
*
|
|
75
75
|
* The plugin is rendered as an item in the gear menu.
|
|
76
76
|
*
|
|
77
77
|
* When clicked, it shows an overlay window with the information about the network speed, latency, etc,
|
|
@@ -313,7 +313,11 @@ export class NerdStats extends UICorePlugin {
|
|
|
313
313
|
private updateMetrics(metrics: PerfMetrics) {
|
|
314
314
|
trace(`${T} updateMetrics`, { custom: this.speedtestMetrics })
|
|
315
315
|
Object.assign(this.metrics, metrics)
|
|
316
|
-
this.
|
|
316
|
+
this.metrics.custom = {
|
|
317
|
+
...this.speedtestMetrics,
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
this.updateCustomMetrics()
|
|
317
321
|
|
|
318
322
|
this.$el
|
|
319
323
|
.find('#nerd-stats-current-time')
|
|
@@ -382,17 +386,25 @@ export class NerdStats extends UICorePlugin {
|
|
|
382
386
|
|
|
383
387
|
this.setStatsBoxSize()
|
|
384
388
|
drawSpeedTestResults()
|
|
385
|
-
|
|
386
|
-
this.speedtestMetrics,
|
|
387
|
-
this.$el.find('#nerd-stats-quality-vod'),
|
|
388
|
-
this.$el.find('#nerd-stats-quality-live'),
|
|
389
|
-
)
|
|
389
|
+
this.updateEstimatedQuality()
|
|
390
390
|
|
|
391
391
|
if (!this.open) {
|
|
392
392
|
this.hide()
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
private updateCustomMetrics() {
|
|
397
|
+
this.$el
|
|
398
|
+
.find('#nerd-stats-dl-text')
|
|
399
|
+
.text(this.metrics.custom.connectionSpeed.toFixed(2))
|
|
400
|
+
this.$el
|
|
401
|
+
.find('#nerd-stats-ping-text')
|
|
402
|
+
.text(this.metrics.custom.ping.toFixed(2))
|
|
403
|
+
this.$el
|
|
404
|
+
.find('#nerd-stats-jitter-text')
|
|
405
|
+
.text(this.metrics.custom.jitter.toFixed(2))
|
|
406
|
+
}
|
|
407
|
+
|
|
396
408
|
private updateEstimatedQuality() {
|
|
397
409
|
this.estimateQuality()
|
|
398
410
|
this.$el
|
|
@@ -401,6 +413,12 @@ export class NerdStats extends UICorePlugin {
|
|
|
401
413
|
this.$el
|
|
402
414
|
.find('#nerd-stats-quality-live-text')
|
|
403
415
|
.html(this.metrics.custom.liveQuality)
|
|
416
|
+
|
|
417
|
+
drawSummary(
|
|
418
|
+
this.speedtestMetrics,
|
|
419
|
+
this.$el.find('#nerd-stats-quality-vod'),
|
|
420
|
+
this.$el.find('#nerd-stats-quality-live'),
|
|
421
|
+
)
|
|
404
422
|
}
|
|
405
423
|
|
|
406
424
|
private setStatsBoxSize() {
|
|
@@ -455,6 +473,7 @@ export class NerdStats extends UICorePlugin {
|
|
|
455
473
|
this.speedtestMetrics.jitter = 0
|
|
456
474
|
|
|
457
475
|
if (clapprStats) {
|
|
476
|
+
clapprStats.clearMetrics()
|
|
458
477
|
this.updateMetrics(clapprStats.exportMetrics())
|
|
459
478
|
}
|
|
460
479
|
}
|
|
@@ -37,7 +37,7 @@ const getColor = (speedValue: number): string => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export function drawSpeedTestResults() {
|
|
40
|
-
const canvas = document.getElementById('
|
|
40
|
+
const canvas = document.getElementById('nerd-stats-speed-test-canvas');
|
|
41
41
|
if (!canvas) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
@@ -10,31 +10,41 @@ const qualityClasses = [
|
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
export const getDownloadQuality = (speedValue: number): number => {
|
|
13
|
+
if (!speedValue) {
|
|
14
|
+
return 0
|
|
15
|
+
}
|
|
13
16
|
if (speedValue < 3) {
|
|
14
17
|
return 1
|
|
15
|
-
}
|
|
18
|
+
}
|
|
19
|
+
if (speedValue < 7) {
|
|
16
20
|
return 2
|
|
17
|
-
}
|
|
21
|
+
}
|
|
22
|
+
if (speedValue < 13) {
|
|
18
23
|
return 3
|
|
19
|
-
}
|
|
24
|
+
}
|
|
25
|
+
if (speedValue < 25) {
|
|
20
26
|
return 4
|
|
21
|
-
} else {
|
|
22
|
-
return 5
|
|
23
27
|
}
|
|
28
|
+
return 5
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export const getPingQuality = (pingValue: number): number => {
|
|
32
|
+
if (!pingValue) {
|
|
33
|
+
return 0
|
|
34
|
+
}
|
|
27
35
|
if (pingValue < 20) {
|
|
28
36
|
return 5
|
|
29
|
-
}
|
|
37
|
+
}
|
|
38
|
+
if (pingValue < 50) {
|
|
30
39
|
return 4
|
|
31
|
-
}
|
|
40
|
+
}
|
|
41
|
+
if (pingValue < 100) {
|
|
32
42
|
return 3
|
|
33
|
-
}
|
|
43
|
+
}
|
|
44
|
+
if (pingValue < 150) {
|
|
34
45
|
return 2
|
|
35
|
-
} else {
|
|
36
|
-
return 1
|
|
37
46
|
}
|
|
47
|
+
return 1
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
export const generateQualityHtml = (quality: number): string => {
|
|
@@ -61,9 +71,6 @@ export const drawSummary = (
|
|
|
61
71
|
) => {
|
|
62
72
|
const { connectionSpeed, ping } = customMetrics
|
|
63
73
|
|
|
64
|
-
if (!connectionSpeed || !ping) {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
74
|
const downloadQuality = getDownloadQuality(connectionSpeed)
|
|
68
75
|
const pingQuality = getPingQuality(ping)
|
|
69
76
|
const liveQuality = Math.min(downloadQuality, pingQuality)
|
|
@@ -172,6 +172,10 @@ export class ClapprStats extends ContainerPlugin {
|
|
|
172
172
|
return structuredClone(this.metrics)
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
clearMetrics() {
|
|
176
|
+
this.metrics = newMetrics()
|
|
177
|
+
}
|
|
178
|
+
|
|
175
179
|
private onBitrate(newBitrate: QualityLevel) {
|
|
176
180
|
const bitrate = newBitrate.bitrate
|
|
177
181
|
const now = this.now()
|
|
@@ -58,13 +58,13 @@ export class ClickToPause extends ContainerPlugin {
|
|
|
58
58
|
|
|
59
59
|
if (isLivePlayback && !isDvrEnabled) {
|
|
60
60
|
this.togglePlay(true)
|
|
61
|
-
|
|
62
|
-
this.clearTimer()
|
|
63
|
-
this.timer = setTimeout(() => {
|
|
64
|
-
this.timer = null
|
|
65
|
-
this.togglePlay(false)
|
|
66
|
-
}, 300)
|
|
61
|
+
return
|
|
67
62
|
}
|
|
63
|
+
this.clearTimer()
|
|
64
|
+
this.timer = setTimeout(() => {
|
|
65
|
+
this.timer = null
|
|
66
|
+
this.togglePlay(false)
|
|
67
|
+
}, 300)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
private settingsUpdate() {
|
|
@@ -138,6 +138,7 @@ const LEFT_ORDER = [
|
|
|
138
138
|
|
|
139
139
|
export enum ExtendedEvents {
|
|
140
140
|
MEDIACONTROL_VOLUME = 'mediacontrol:volume',
|
|
141
|
+
MEDIACONTROL_MENU_COLLAPSE = 'mediacontrol:menu:collapse',
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
const { Config, Fullscreen, formatTime, extend, removeArrayItem } = Utils
|
|
@@ -1,113 +1,120 @@
|
|
|
1
|
-
import { UICorePlugin
|
|
1
|
+
import { UICorePlugin, Browser, Playback, Events, template } from '@clappr/core'
|
|
2
2
|
|
|
3
|
-
import { CLAPPR_VERSION } from '../../build.js'
|
|
3
|
+
import { CLAPPR_VERSION } from '../../build.js'
|
|
4
4
|
|
|
5
|
-
import pluginHtml from '../../../assets/skip-time/skip-time.ejs'
|
|
6
|
-
import '../../../assets/skip-time/style.scss'
|
|
5
|
+
import pluginHtml from '../../../assets/skip-time/skip-time.ejs'
|
|
6
|
+
import '../../../assets/skip-time/style.scss'
|
|
7
7
|
|
|
8
|
-
type Position = 'mid' | 'left' | 'right'
|
|
8
|
+
type Position = 'mid' | 'left' | 'right'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* `PLUGIN` that adds skip controls to the media control UI.
|
|
12
12
|
* @beta
|
|
13
13
|
*/
|
|
14
|
-
export class SkipTime extends
|
|
14
|
+
export class SkipTime extends UICorePlugin {
|
|
15
15
|
get name() {
|
|
16
|
-
return 'skip_time'
|
|
16
|
+
return 'skip_time'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
get supportedVersion() {
|
|
20
|
-
return { min: CLAPPR_VERSION }
|
|
20
|
+
return { min: CLAPPR_VERSION }
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
get container() {
|
|
24
|
-
return this.core && this.core.activeContainer
|
|
24
|
+
return this.core && this.core.activeContainer
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
get template() {
|
|
28
|
-
return template(pluginHtml)
|
|
28
|
+
return template(pluginHtml)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
override get attributes() {
|
|
32
32
|
return {
|
|
33
|
-
|
|
34
|
-
'data-skip-time': ''
|
|
35
|
-
}
|
|
33
|
+
class: this.name + '_plugin',
|
|
34
|
+
'data-skip-time': '',
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
private position: Position = 'mid'
|
|
38
|
+
private position: Position = 'mid'
|
|
39
39
|
|
|
40
40
|
override get events() {
|
|
41
41
|
return {
|
|
42
42
|
'click [data-skip-left]': 'setBack',
|
|
43
43
|
'click [data-skip-mid]': 'setMidClick',
|
|
44
44
|
'click [data-skip-right]': 'setForward',
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
override bindEvents() {
|
|
49
|
-
this.listenTo(this.core, Events.CORE_READY, this.render)
|
|
49
|
+
this.listenTo(this.core, Events.CORE_READY, this.render)
|
|
50
50
|
if (!this.container) {
|
|
51
|
-
return
|
|
51
|
+
return
|
|
52
52
|
}
|
|
53
|
-
this.listenTo(
|
|
53
|
+
this.listenTo(
|
|
54
|
+
this.container,
|
|
55
|
+
Events.CONTAINER_DBLCLICK,
|
|
56
|
+
this.handleRewindClicks,
|
|
57
|
+
)
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
setBack() {
|
|
57
|
-
this.position = 'left'
|
|
61
|
+
this.position = 'left'
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
handleRewindClicks() {
|
|
61
|
-
if (
|
|
62
|
-
this.
|
|
65
|
+
if (
|
|
66
|
+
this.core.getPlaybackType() === Playback.LIVE &&
|
|
67
|
+
!this.container.isDvrEnabled()
|
|
68
|
+
) {
|
|
69
|
+
this.toggleFullscreen()
|
|
63
70
|
|
|
64
|
-
return
|
|
71
|
+
return
|
|
65
72
|
}
|
|
66
73
|
if (Browser.isMobile) {
|
|
67
74
|
if (this.position === 'left') {
|
|
68
|
-
const seekPos = this.container.getCurrentTime() - 10
|
|
75
|
+
const seekPos = this.container.getCurrentTime() - 10
|
|
69
76
|
|
|
70
77
|
if (seekPos < 0) {
|
|
71
|
-
return
|
|
78
|
+
return
|
|
72
79
|
}
|
|
73
|
-
this.container.seek(seekPos)
|
|
80
|
+
this.container.seek(seekPos)
|
|
74
81
|
} else if (this.position === 'right') {
|
|
75
|
-
const seekPos = this.container.getCurrentTime() + 30
|
|
82
|
+
const seekPos = this.container.getCurrentTime() + 30
|
|
76
83
|
|
|
77
84
|
if (seekPos > this.container.getDuration()) {
|
|
78
|
-
return
|
|
85
|
+
return
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
this.container.seek(seekPos)
|
|
88
|
+
this.container.seek(seekPos)
|
|
82
89
|
} else {
|
|
83
|
-
this.toggleFullscreen()
|
|
90
|
+
this.toggleFullscreen()
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
setMidClick() {
|
|
89
|
-
this.position = 'mid'
|
|
96
|
+
this.position = 'mid'
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
setForward() {
|
|
93
|
-
this.position = 'right'
|
|
100
|
+
this.position = 'right'
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
toggleFullscreen() {
|
|
97
|
-
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name)
|
|
98
|
-
this.container.fullscreen()
|
|
99
|
-
this.core.toggleFullscreen()
|
|
104
|
+
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name)
|
|
105
|
+
this.container.fullscreen()
|
|
106
|
+
this.core.toggleFullscreen()
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
override render() {
|
|
103
|
-
this.$el.html(template(pluginHtml))
|
|
110
|
+
this.$el.html(template(pluginHtml))
|
|
104
111
|
|
|
105
112
|
if (this.core.activeContainer) {
|
|
106
|
-
this.core.activeContainer.$el.append(this.el)
|
|
113
|
+
this.core.activeContainer.$el.append(this.el)
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
this.bindEvents()
|
|
116
|
+
this.bindEvents()
|
|
110
117
|
|
|
111
|
-
return this
|
|
118
|
+
return this
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -13,6 +13,7 @@ import stringHTML from '../../../assets/subtitles/string.ejs'
|
|
|
13
13
|
|
|
14
14
|
import { isFullscreen } from '../utils/fullscreen.js'
|
|
15
15
|
import type { ZeptoResult } from '../../types.js'
|
|
16
|
+
import { ExtendedEvents } from '../media-control/MediaControl.js'
|
|
16
17
|
|
|
17
18
|
const VERSION: string = '2.19.14'
|
|
18
19
|
|
|
@@ -114,7 +115,11 @@ export class ClosedCaptions extends UICorePlugin {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
private get preselectedLanguage(): string {
|
|
117
|
-
return
|
|
118
|
+
return (
|
|
119
|
+
this.core.options.cc?.language ??
|
|
120
|
+
this.core.options.subtitles?.language ??
|
|
121
|
+
''
|
|
122
|
+
)
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
/**
|
|
@@ -135,9 +140,10 @@ export class ClosedCaptions extends UICorePlugin {
|
|
|
135
140
|
const mediaControl = this.core.getPlugin('media_control')
|
|
136
141
|
assert(mediaControl, 'media_control plugin is required')
|
|
137
142
|
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.render)
|
|
143
|
+
this.listenTo(mediaControl, Events.MEDIACONTROL_HIDE, this.hideMenu)
|
|
138
144
|
this.listenTo(
|
|
139
145
|
mediaControl,
|
|
140
|
-
|
|
146
|
+
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
141
147
|
this.hideMenu,
|
|
142
148
|
)
|
|
143
149
|
}
|
|
@@ -386,18 +392,20 @@ export class ClosedCaptions extends UICorePlugin {
|
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
private hideMenu() {
|
|
395
|
+
trace(`${T} hideMenu`)
|
|
389
396
|
;(this.$('[data-cc] ul') as ZeptoResult).hide()
|
|
390
397
|
}
|
|
391
398
|
|
|
392
399
|
private toggleMenu() {
|
|
393
400
|
trace(`${T} toggleMenu`)
|
|
394
|
-
|
|
401
|
+
this.core
|
|
402
|
+
.getPlugin('media_control')
|
|
403
|
+
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE)
|
|
404
|
+
this.$el.find('[data-cc] ul').toggle()
|
|
395
405
|
}
|
|
396
406
|
|
|
397
407
|
private itemElement(id: number): ZeptoResult {
|
|
398
|
-
return (
|
|
399
|
-
this.$(`ul li a[data-cc-select="${id}"]`) as ZeptoResult
|
|
400
|
-
).parent()
|
|
408
|
+
return (this.$(`ul li a[data-cc-select="${id}"]`) as ZeptoResult).parent()
|
|
401
409
|
}
|
|
402
410
|
|
|
403
411
|
private allItemElements(): ZeptoResult {
|
|
@@ -453,7 +461,9 @@ export class ClosedCaptions extends UICorePlugin {
|
|
|
453
461
|
trace(`${T} highlightCurrentSubtitles`, {
|
|
454
462
|
track: this.track?.id,
|
|
455
463
|
})
|
|
456
|
-
const currentLevelElement = this.itemElement(
|
|
464
|
+
const currentLevelElement = this.itemElement(
|
|
465
|
+
this.track ? this.track.id : -1,
|
|
466
|
+
)
|
|
457
467
|
currentLevelElement
|
|
458
468
|
.addClass('current')
|
|
459
469
|
.find('a')
|
|
@@ -15,6 +15,7 @@ export enum VolumeFadeEvents {
|
|
|
15
15
|
const T = 'plugins.volume_fade'
|
|
16
16
|
|
|
17
17
|
const DEFAULT_DURATION = 600
|
|
18
|
+
const DEFAULT_VOLUME_LEVEL = 80
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* @beta
|
|
@@ -31,10 +32,12 @@ export type VolumeFadeSettings = {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
* `PLUGIN` that
|
|
35
|
+
* `PLUGIN` that mutes the sound and fades it in when the mouse is over the player.
|
|
35
36
|
* @beta
|
|
36
37
|
*
|
|
37
38
|
* @remarks
|
|
39
|
+
* When the user moves the mouse over and away from the player, the sound is unmuted and unmuted with a fade effect.
|
|
40
|
+
*
|
|
38
41
|
* Depends on {@link MediaControl} plugin.
|
|
39
42
|
* Configuration options - {@link VolumeFadeSettings}
|
|
40
43
|
*/
|
|
@@ -86,11 +89,11 @@ export class VolumeFade extends UICorePlugin {
|
|
|
86
89
|
this.core.activeContainer?.volume &&
|
|
87
90
|
!isNaN(this.core.activeContainer.volume)
|
|
88
91
|
? this.core.activeContainer.volume
|
|
89
|
-
:
|
|
92
|
+
: DEFAULT_VOLUME_LEVEL
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
this.duration = this.options.volumeFade?.duration || DEFAULT_DURATION
|
|
93
|
-
// TODO check if mute must be respected
|
|
96
|
+
// TODO check if `mute` must be respected
|
|
94
97
|
this.core.activeContainer?.setVolume(this.activeVolume)
|
|
95
98
|
this.core.activePlayback.volume(0)
|
|
96
99
|
}
|
package/temp/player.api.json
CHANGED
|
@@ -1925,6 +1925,44 @@
|
|
|
1925
1925
|
"endIndex": 2
|
|
1926
1926
|
}
|
|
1927
1927
|
},
|
|
1928
|
+
{
|
|
1929
|
+
"kind": "Enum",
|
|
1930
|
+
"canonicalReference": "@gcorevideo/player!ExtendedEvents:enum",
|
|
1931
|
+
"docComment": "",
|
|
1932
|
+
"excerptTokens": [
|
|
1933
|
+
{
|
|
1934
|
+
"kind": "Content",
|
|
1935
|
+
"text": "export declare enum ExtendedEvents "
|
|
1936
|
+
}
|
|
1937
|
+
],
|
|
1938
|
+
"fileUrlPath": "src/plugins/media-control/MediaControl.ts",
|
|
1939
|
+
"releaseTag": "Public",
|
|
1940
|
+
"name": "ExtendedEvents",
|
|
1941
|
+
"preserveMemberOrder": false,
|
|
1942
|
+
"members": [
|
|
1943
|
+
{
|
|
1944
|
+
"kind": "EnumMember",
|
|
1945
|
+
"canonicalReference": "@gcorevideo/player!ExtendedEvents.MEDIACONTROL_VOLUME:member",
|
|
1946
|
+
"docComment": "",
|
|
1947
|
+
"excerptTokens": [
|
|
1948
|
+
{
|
|
1949
|
+
"kind": "Content",
|
|
1950
|
+
"text": "MEDIACONTROL_VOLUME = "
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
"kind": "Content",
|
|
1954
|
+
"text": "\"mediacontrol:volume\""
|
|
1955
|
+
}
|
|
1956
|
+
],
|
|
1957
|
+
"initializerTokenRange": {
|
|
1958
|
+
"startIndex": 1,
|
|
1959
|
+
"endIndex": 2
|
|
1960
|
+
},
|
|
1961
|
+
"releaseTag": "Public",
|
|
1962
|
+
"name": "MEDIACONTROL_VOLUME"
|
|
1963
|
+
}
|
|
1964
|
+
]
|
|
1965
|
+
},
|
|
1928
1966
|
{
|
|
1929
1967
|
"kind": "Class",
|
|
1930
1968
|
"canonicalReference": "@gcorevideo/player!Favicon:class",
|
|
@@ -9818,7 +9856,7 @@
|
|
|
9818
9856
|
{
|
|
9819
9857
|
"kind": "Class",
|
|
9820
9858
|
"canonicalReference": "@gcorevideo/player!VolumeFade:class",
|
|
9821
|
-
"docComment": "/**\n * `PLUGIN` that
|
|
9859
|
+
"docComment": "/**\n * `PLUGIN` that mutes the sound and fades it in when the mouse is over the player.\n *\n * @remarks\n *\n * When the user moves the mouse over and away from the player, the sound is unmuted and unmuted with a fade effect.\n *\n * Depends on {@link MediaControl} plugin. Configuration options - {@link VolumeFadeSettings}\n *\n * @beta\n */\n",
|
|
9822
9860
|
"excerptTokens": [
|
|
9823
9861
|
{
|
|
9824
9862
|
"kind": "Content",
|
|
@@ -9839,7 +9877,41 @@
|
|
|
9839
9877
|
"isAbstract": false,
|
|
9840
9878
|
"name": "VolumeFade",
|
|
9841
9879
|
"preserveMemberOrder": false,
|
|
9842
|
-
"members": [
|
|
9880
|
+
"members": [
|
|
9881
|
+
{
|
|
9882
|
+
"kind": "Constructor",
|
|
9883
|
+
"canonicalReference": "@gcorevideo/player!VolumeFade:constructor(1)",
|
|
9884
|
+
"docComment": "/**\n * Constructs a new instance of the `VolumeFade` class\n */\n",
|
|
9885
|
+
"excerptTokens": [
|
|
9886
|
+
{
|
|
9887
|
+
"kind": "Content",
|
|
9888
|
+
"text": "constructor(core: "
|
|
9889
|
+
},
|
|
9890
|
+
{
|
|
9891
|
+
"kind": "Reference",
|
|
9892
|
+
"text": "Core",
|
|
9893
|
+
"canonicalReference": "@clappr/core!default:class"
|
|
9894
|
+
},
|
|
9895
|
+
{
|
|
9896
|
+
"kind": "Content",
|
|
9897
|
+
"text": ");"
|
|
9898
|
+
}
|
|
9899
|
+
],
|
|
9900
|
+
"releaseTag": "Beta",
|
|
9901
|
+
"isProtected": false,
|
|
9902
|
+
"overloadIndex": 1,
|
|
9903
|
+
"parameters": [
|
|
9904
|
+
{
|
|
9905
|
+
"parameterName": "core",
|
|
9906
|
+
"parameterTypeTokenRange": {
|
|
9907
|
+
"startIndex": 1,
|
|
9908
|
+
"endIndex": 2
|
|
9909
|
+
},
|
|
9910
|
+
"isOptional": false
|
|
9911
|
+
}
|
|
9912
|
+
]
|
|
9913
|
+
}
|
|
9914
|
+
],
|
|
9843
9915
|
"extendsTokenRange": {
|
|
9844
9916
|
"startIndex": 1,
|
|
9845
9917
|
"endIndex": 2
|
|
@@ -9884,6 +9956,32 @@
|
|
|
9884
9956
|
}
|
|
9885
9957
|
]
|
|
9886
9958
|
},
|
|
9959
|
+
{
|
|
9960
|
+
"kind": "TypeAlias",
|
|
9961
|
+
"canonicalReference": "@gcorevideo/player!VolumeFadeSettings:type",
|
|
9962
|
+
"docComment": "/**\n * @beta\n */\n",
|
|
9963
|
+
"excerptTokens": [
|
|
9964
|
+
{
|
|
9965
|
+
"kind": "Content",
|
|
9966
|
+
"text": "export type VolumeFadeSettings = "
|
|
9967
|
+
},
|
|
9968
|
+
{
|
|
9969
|
+
"kind": "Content",
|
|
9970
|
+
"text": "{\n level?: number;\n duration?: number;\n}"
|
|
9971
|
+
},
|
|
9972
|
+
{
|
|
9973
|
+
"kind": "Content",
|
|
9974
|
+
"text": ";"
|
|
9975
|
+
}
|
|
9976
|
+
],
|
|
9977
|
+
"fileUrlPath": "src/plugins/volume-fade/VolumeFade.ts",
|
|
9978
|
+
"releaseTag": "Beta",
|
|
9979
|
+
"name": "VolumeFadeSettings",
|
|
9980
|
+
"typeTokenRange": {
|
|
9981
|
+
"startIndex": 1,
|
|
9982
|
+
"endIndex": 2
|
|
9983
|
+
}
|
|
9984
|
+
},
|
|
9887
9985
|
{
|
|
9888
9986
|
"kind": "Interface",
|
|
9889
9987
|
"canonicalReference": "@gcorevideo/player!WatchEventData:interface",
|