@gcorevideo/player 2.22.15 → 2.22.17
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/clips/clips.ejs +1 -0
- package/assets/clips/clips.scss +23 -3
- package/assets/level-selector/list.ejs +9 -3
- package/assets/media-control/media-control.ejs +1 -9
- package/assets/media-control/media-control.scss +0 -25
- package/assets/media-control/width370.scss +4 -4
- package/dist/core.js +6 -8
- package/dist/index.css +855 -855
- package/dist/index.js +609 -664
- package/dist/player.d.ts +426 -302
- package/dist/plugins/index.css +551 -551
- package/dist/plugins/index.js +648 -703
- package/docs/api/{player.audioselector.md → player.audiotracks.md} +3 -3
- package/docs/api/player.clapprstats.exportmetrics.md +1 -1
- package/docs/api/player.clapprstats.md +5 -15
- package/docs/api/player.clapprstatssettings.md +13 -0
- package/docs/api/{player.contextmenupluginsettings.preventshowcontextmenu.md → player.clips.destroy.md} +7 -3
- package/docs/api/{player.contextmenupluginsettings.label.md → player.clips.disable.md} +7 -3
- package/docs/api/player.clips.enable.md +18 -0
- package/docs/api/player.clips.md +170 -0
- package/docs/api/player.clips.render.md +18 -0
- package/docs/api/player.clips.supportedversion.md +16 -0
- package/docs/api/player.clips.version.md +14 -0
- package/docs/api/player.clipspluginsettings.md +2 -2
- package/docs/api/player.clipspluginsettings.text.md +1 -1
- package/docs/api/player.contextmenu.md +2 -0
- package/docs/api/player.contextmenupluginsettings.md +2 -40
- package/docs/api/{player.contextmenupluginsettings.url.md → player.contextmenupluginsettings.options.md} +3 -3
- package/docs/api/player.md +101 -37
- package/docs/api/player.mediacontrol.md +9 -15
- package/docs/api/{player.mediacontrol.getelement.md → player.mediacontrol.mount.md} +20 -7
- package/docs/api/player.mediacontrolelement.md +4 -2
- package/docs/api/player.mediacontrollayerelement.md +16 -0
- package/docs/api/player.mediacontrolleftelement.md +16 -0
- package/docs/api/player.mediacontrolrightelement.md +16 -0
- package/docs/api/player.mediacontrolsettings.md +23 -0
- package/docs/api/player.menuoption.md +21 -0
- package/docs/api/{player.clapprnerdstats._constructor_.md → player.nerdstats._constructor_.md} +3 -3
- package/docs/api/{player.clapprnerdstats.md → player.nerdstats.md} +5 -5
- package/docs/api/player.playbackrate.md +1 -1
- package/docs/api/player.playerconfig.md +1 -1
- package/docs/api/player.playerconfig.playbacktype.md +1 -1
- package/docs/api/player.qualitylevel.height.md +1 -1
- package/docs/api/player.qualitylevel.level.md +1 -1
- package/docs/api/player.qualitylevel.md +4 -4
- package/docs/api/player.qualitylevel.width.md +1 -1
- package/docs/api/{player.levelselector.events.md → player.qualitylevels.events.md} +2 -2
- package/docs/api/{player.levelselector.md → player.qualitylevels.md} +6 -6
- package/docs/api/{player.levelselectorpluginsettings.labels.md → player.qualitylevelspluginsettings.labels.md} +2 -2
- package/docs/api/{player.levelselectorpluginsettings.md → player.qualitylevelspluginsettings.md} +6 -6
- package/docs/api/{player.levelselectorpluginsettings.restrictresolution.md → player.qualitylevelspluginsettings.restrictresolution.md} +2 -2
- package/docs/api/player.timeposition.current.md +1 -1
- package/docs/api/player.timeposition.md +2 -2
- package/docs/api/player.timeposition.total.md +1 -1
- package/docs/api/player.timeprogress.md +6 -4
- package/docs/api/player.timevalue.md +1 -1
- package/lib/index.plugins.d.ts +2 -1
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +5 -7
- package/lib/playback.types.d.ts +22 -9
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +4 -0
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +20 -23
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +83 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +339 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +27 -32
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +94 -202
- package/lib/plugins/clappr-stats/types.d.ts +65 -24
- package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/types.js +37 -2
- package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/utils.js +1 -2
- package/lib/plugins/clips/Clips.d.ts +21 -16
- package/lib/plugins/clips/Clips.d.ts.map +1 -1
- package/lib/plugins/clips/Clips.js +96 -98
- package/lib/plugins/clips/types.d.ts +19 -0
- package/lib/plugins/clips/types.d.ts.map +1 -0
- package/lib/plugins/clips/types.js +1 -0
- package/lib/plugins/clips/utils.d.ts +4 -0
- package/lib/plugins/clips/utils.d.ts.map +1 -0
- package/lib/plugins/clips/utils.js +36 -0
- package/lib/plugins/media-control/MediaControl.d.ts +4 -7
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +19 -31
- package/lib/plugins/utils.d.ts +9 -1
- package/lib/plugins/utils.d.ts.map +1 -1
- package/lib/plugins/utils.js +9 -10
- package/lib/plugins/vast-ads/loaderxml.js +2 -2
- package/lib/testUtils.d.ts +2 -1
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +5 -7
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -1
- package/src/playback/dash-playback/DashPlayback.ts +5 -8
- package/src/playback.types.ts +23 -8
- package/src/plugins/clappr-nerd-stats/{ClapprNerdStats.ts → NerdStats.ts} +25 -30
- package/src/plugins/clappr-stats/ClapprStats.ts +242 -306
- package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +133 -0
- package/src/plugins/clappr-stats/types.ts +72 -25
- package/src/plugins/clappr-stats/utils.ts +1 -2
- package/src/plugins/clips/Clips.ts +116 -135
- package/src/plugins/clips/__tests__/Clips.test.ts +72 -0
- package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +14 -0
- package/src/plugins/clips/types.ts +22 -0
- package/src/plugins/clips/utils.ts +54 -0
- package/src/plugins/error-screen/__tests__/ErrorScreen.test.ts +3 -4
- package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +18 -18
- package/src/plugins/media-control/MediaControl.ts +31 -58
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +7 -35
- package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -0
- package/src/plugins/utils.ts +9 -7
- package/src/plugins/vast-ads/loaderxml.ts +2 -2
- package/src/testUtils.ts +5 -7
- package/temp/player.api.json +693 -471
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.clapprstats.setupdatemetrics.md +0 -56
- package/docs/api/player.clipsplugin.gettext.md +0 -58
- package/docs/api/player.clipsplugin.md +0 -59
- package/docs/api/player.mediacontrol.handlecustomarea.md +0 -52
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ClipsPlugin > should render indicator 1`] = `
|
|
4
|
+
"<div class="media-clip-text" id="clips-text">Introduction</div><svg width="0" height="0">
|
|
5
|
+
<defs>
|
|
6
|
+
<clipPath id="myClip">
|
|
7
|
+
<rect x="0" y="0" width="148" height="30"></rect>
|
|
8
|
+
<rect x="150" y="0" width="298" height="30"></rect>
|
|
9
|
+
<rect x="450" y="0" width="148" height="30"></rect>
|
|
10
|
+
</clipPath></defs></svg><style>
|
|
11
|
+
.bar-container[data-seekbar] {
|
|
12
|
+
clip-path: url("#myClip");
|
|
13
|
+
}</style>"
|
|
14
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clip description.
|
|
3
|
+
* @beta
|
|
4
|
+
*/
|
|
5
|
+
export type ClipDesc = {
|
|
6
|
+
/**
|
|
7
|
+
* Start time of the clip in the video timeline, s.
|
|
8
|
+
*/
|
|
9
|
+
start: number
|
|
10
|
+
/**
|
|
11
|
+
* Text to display over the seekbar.
|
|
12
|
+
*/
|
|
13
|
+
text: string
|
|
14
|
+
/**
|
|
15
|
+
* End time of the clip (start time of the next clip).
|
|
16
|
+
*/
|
|
17
|
+
end: number
|
|
18
|
+
/**
|
|
19
|
+
* Index of the clip.
|
|
20
|
+
*/
|
|
21
|
+
// index: number
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ClipDesc } from './types.js'
|
|
2
|
+
import { parseClipTime } from '../utils.js'
|
|
3
|
+
|
|
4
|
+
type ClipItem = {
|
|
5
|
+
start: number
|
|
6
|
+
text: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function parseClips(text: string): ClipDesc[] {
|
|
10
|
+
const clipsArr = text
|
|
11
|
+
.split('\n')
|
|
12
|
+
.map((val: string) => {
|
|
13
|
+
const matchRes = val.match(/(((\d+:)?\d+:)?\d+) (.+)/i)
|
|
14
|
+
return matchRes
|
|
15
|
+
? {
|
|
16
|
+
start: parseClipTime(matchRes[1]),
|
|
17
|
+
text: matchRes[4],
|
|
18
|
+
}
|
|
19
|
+
: null
|
|
20
|
+
})
|
|
21
|
+
.filter((clip: ClipItem | null) => clip !== null)
|
|
22
|
+
.sort((a: ClipItem, b: ClipItem) => a.start - b.start)
|
|
23
|
+
return clipsArr.map((clip: ClipItem, index: number) => ({
|
|
24
|
+
start: clip.start,
|
|
25
|
+
text: clip.text,
|
|
26
|
+
end: index < clipsArr.length - 1 ? clipsArr[index + 1].start : 0,
|
|
27
|
+
}))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function buildSvg(clips: ClipDesc[], duration: number, barWidth: number): string {
|
|
31
|
+
let svg =
|
|
32
|
+
'<svg width="0" height="0">\n' + '<defs>\n' + '<clipPath id="myClip">\n'
|
|
33
|
+
let rightEdge = 0
|
|
34
|
+
|
|
35
|
+
clips.forEach((val) => {
|
|
36
|
+
const end = val.end || duration
|
|
37
|
+
|
|
38
|
+
const chunkWidth = Math.round(((end - val.start) * barWidth) / duration)
|
|
39
|
+
|
|
40
|
+
svg += `<rect x="${rightEdge}" y="0" width="${
|
|
41
|
+
chunkWidth - 2
|
|
42
|
+
}" height="30"/>\n`
|
|
43
|
+
rightEdge += chunkWidth
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
if (rightEdge < barWidth) {
|
|
47
|
+
svg += `<rect x="${rightEdge}" y="0" width="${
|
|
48
|
+
barWidth - rightEdge
|
|
49
|
+
}" height="30"/>\n`
|
|
50
|
+
}
|
|
51
|
+
svg += '</clipPath>' + '</defs>' + '</svg>'
|
|
52
|
+
|
|
53
|
+
return svg
|
|
54
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createMockCore } from '../../../testUtils'
|
|
2
2
|
import { ErrorScreen } from '../ErrorScreen'
|
|
3
3
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
4
|
|
|
@@ -9,9 +9,8 @@ describe('ErrorScreen', () => {
|
|
|
9
9
|
let errorScreen: ErrorScreen
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
core = createMockCore()
|
|
12
|
-
container =
|
|
13
|
-
playback =
|
|
14
|
-
container.playback = playback
|
|
12
|
+
container = core.activeContainer
|
|
13
|
+
playback = container.playback
|
|
15
14
|
core.activeContainer = container
|
|
16
15
|
})
|
|
17
16
|
describe('on error', () => {
|
|
@@ -8,7 +8,7 @@ exports[`QualityLevels > basically > auto > should render the selected level 1`]
|
|
|
8
8
|
<ul class="gear-sub-menu quality-levels" id="level-selector-menu" role="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" id="level_selector_auto">
|
|
11
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="-1" id="level_selector_auto" aria-checked="true" role="menuitemradio">
|
|
12
12
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
13
13
|
auto
|
|
14
14
|
</a>
|
|
@@ -16,21 +16,21 @@ exports[`QualityLevels > basically > auto > should render the selected level 1`]
|
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" id="level_selector_1080">
|
|
20
20
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
21
21
|
Full HD
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" 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" aria-disabled="false" aria-checked="false" role="menuitemradio" 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[`QualityLevels > basically > custom label > should render the selected l
|
|
|
48
48
|
<ul class="gear-sub-menu quality-levels" id="level-selector-menu" role="menu">
|
|
49
49
|
|
|
50
50
|
<li class="">
|
|
51
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto">
|
|
51
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto" aria-checked="true" role="menuitemradio">
|
|
52
52
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
53
53
|
auto
|
|
54
54
|
</a>
|
|
@@ -56,21 +56,21 @@ exports[`QualityLevels > basically > custom label > should render the selected l
|
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" id="level_selector_1080">
|
|
60
60
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
61
61
|
Full HD
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" 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" aria-disabled="false" aria-checked="false" role="menuitemradio" 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[`QualityLevels > basically > standard label > should render the selected
|
|
|
88
88
|
<ul class="gear-sub-menu quality-levels" id="level-selector-menu" role="menu">
|
|
89
89
|
|
|
90
90
|
<li class="">
|
|
91
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto">
|
|
91
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="-1" id="level_selector_auto" aria-checked="true" role="menuitemradio">
|
|
92
92
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
93
93
|
auto
|
|
94
94
|
</a>
|
|
@@ -96,21 +96,21 @@ exports[`QualityLevels > basically > standard label > should render the selected
|
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" id="level_selector_1080">
|
|
100
100
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
101
101
|
Full HD
|
|
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" aria-disabled="false" aria-checked="false" role="menuitemradio" 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" aria-disabled="false" aria-checked="false" role="menuitemradio" id="level_selector_360">
|
|
114
114
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
115
115
|
360p
|
|
116
116
|
</a>
|
|
@@ -129,21 +129,21 @@ exports[`QualityLevels > options.restrictResolution > given vertical video forma
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
<li class=" disabled">
|
|
132
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2"
|
|
132
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2" aria-disabled="true" aria-checked="false" role="menuitemradio" id="level_selector_1080">
|
|
133
133
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
134
134
|
1080p
|
|
135
135
|
</a>
|
|
136
136
|
</li>
|
|
137
137
|
|
|
138
138
|
<li class=" disabled">
|
|
139
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1"
|
|
139
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1" aria-disabled="true" aria-checked="false" role="menuitemradio" id="level_selector_720">
|
|
140
140
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
141
141
|
720p
|
|
142
142
|
</a>
|
|
143
143
|
</li>
|
|
144
144
|
|
|
145
145
|
<li class=" current">
|
|
146
|
-
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0"
|
|
146
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0" aria-disabled="false" aria-checked="true" role="menuitemradio" id="level_selector_360">
|
|
147
147
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
148
148
|
360p
|
|
149
149
|
</a>
|
|
@@ -172,21 +172,21 @@ exports[`QualityLevels > options.restrictResolution > initially > when opened >
|
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
<li class=" 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" aria-disabled="true" aria-checked="false" role="menuitemradio" 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=" 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" aria-disabled="true" aria-checked="false" role="menuitemradio" id="level_selector_720">
|
|
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" aria-disabled="false" aria-checked="true" role="menuitemradio" id="level_selector_360">
|
|
190
190
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
191
191
|
360p
|
|
192
192
|
</a>
|
|
@@ -50,14 +50,13 @@ export type MediaControlLeftElement =
|
|
|
50
50
|
| 'playstop'
|
|
51
51
|
| 'position'
|
|
52
52
|
| 'volume'
|
|
53
|
+
| 'clips'
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Media control elements that appear in main layer, spanning the entire width of the player.
|
|
56
57
|
* @beta
|
|
57
58
|
*/
|
|
58
|
-
export type MediaControlLayerElement =
|
|
59
|
-
| 'seekbar'
|
|
60
|
-
| 'seekBarContainer' // TODO rename seekbar
|
|
59
|
+
export type MediaControlLayerElement = 'seekbar' | 'seekBarContainer' // TODO rename seekbar
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
62
|
* Media control elements that appear in the right area.
|
|
@@ -96,9 +95,7 @@ export type MediaControlSettings = {
|
|
|
96
95
|
|
|
97
96
|
const DEFAULT_SETTINGS: MediaControlSettings = {
|
|
98
97
|
default: [],
|
|
99
|
-
left: [
|
|
100
|
-
'dvr'
|
|
101
|
-
],
|
|
98
|
+
left: ['dvr'],
|
|
102
99
|
right: [
|
|
103
100
|
'audiotracks',
|
|
104
101
|
'cc',
|
|
@@ -114,12 +111,9 @@ const DEFAULT_SETTINGS: MediaControlSettings = {
|
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
const INITIAL_SETTINGS: MediaControlSettings = {
|
|
117
|
-
left: [
|
|
118
|
-
],
|
|
119
|
-
|
|
120
|
-
],
|
|
121
|
-
default: [
|
|
122
|
-
],
|
|
114
|
+
left: [],
|
|
115
|
+
right: [],
|
|
116
|
+
default: [],
|
|
123
117
|
seekEnabled: false,
|
|
124
118
|
}
|
|
125
119
|
|
|
@@ -155,13 +149,13 @@ type DisabledClickable = {
|
|
|
155
149
|
* @beta
|
|
156
150
|
* @remarks
|
|
157
151
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
158
|
-
*
|
|
152
|
+
*
|
|
159
153
|
* Configuration options:
|
|
160
154
|
*
|
|
161
155
|
* - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
|
|
162
156
|
*
|
|
163
157
|
* - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
|
|
164
|
-
*
|
|
158
|
+
*
|
|
165
159
|
* - `chromeless`: boolean
|
|
166
160
|
*/
|
|
167
161
|
export class MediaControl extends UICorePlugin {
|
|
@@ -213,10 +207,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
213
207
|
|
|
214
208
|
private verticalVolume = false
|
|
215
209
|
|
|
216
|
-
private $clipText: ZeptoResult | null = null
|
|
217
|
-
|
|
218
|
-
private $clipTextContainer: ZeptoResult | null = null
|
|
219
|
-
|
|
220
210
|
private $duration: ZeptoResult | null = null
|
|
221
211
|
|
|
222
212
|
private $fullscreenToggle: ZeptoResult | null = null
|
|
@@ -499,13 +489,9 @@ export class MediaControl extends UICorePlugin {
|
|
|
499
489
|
Events.CONTAINER_LOADEDMETADATA,
|
|
500
490
|
this.onLoadedMetadata,
|
|
501
491
|
)
|
|
502
|
-
this.listenTo(
|
|
503
|
-
this.
|
|
504
|
-
|
|
505
|
-
() => {
|
|
506
|
-
this.cancelRenderTimer()
|
|
507
|
-
},
|
|
508
|
-
)
|
|
492
|
+
this.listenTo(this.core, Events.CONTAINER_DESTROYED, () => {
|
|
493
|
+
this.cancelRenderTimer()
|
|
494
|
+
})
|
|
509
495
|
}
|
|
510
496
|
|
|
511
497
|
/**
|
|
@@ -516,7 +502,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
516
502
|
this.userDisabled = true // TODO distinguish between user and system (e.g., unplayable) disabled?
|
|
517
503
|
this.hide()
|
|
518
504
|
this.unbindKeyEvents()
|
|
519
|
-
this.$el.hide()
|
|
505
|
+
this.$el.hide() // TODO why?
|
|
520
506
|
}
|
|
521
507
|
|
|
522
508
|
/**
|
|
@@ -1080,13 +1066,12 @@ export class MediaControl extends UICorePlugin {
|
|
|
1080
1066
|
)
|
|
1081
1067
|
trace(`${T} updateSettings`, { newSettings })
|
|
1082
1068
|
|
|
1083
|
-
|
|
1069
|
+
newSettings.left.push('clips') // TODO
|
|
1084
1070
|
// TODO make order controlled via CSS
|
|
1085
1071
|
newSettings.left = orderByOrderPattern(
|
|
1086
|
-
[...newSettings.left, '
|
|
1072
|
+
[...newSettings.left, 'volume', 'clips'],
|
|
1087
1073
|
LEFT_ORDER,
|
|
1088
1074
|
)
|
|
1089
|
-
|
|
1090
1075
|
if (
|
|
1091
1076
|
this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
1092
1077
|
this.core.activePlayback.dvrEnabled
|
|
@@ -1098,8 +1083,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1098
1083
|
newSettings.right = DEFAULT_SETTINGS.right // TODO get from the options
|
|
1099
1084
|
|
|
1100
1085
|
if (
|
|
1101
|
-
(!this.fullScreenOnVideoTagSupported &&
|
|
1102
|
-
!fullscreenEnabled()) ||
|
|
1086
|
+
(!this.fullScreenOnVideoTagSupported && !fullscreenEnabled()) ||
|
|
1103
1087
|
this.options.fullscreenDisable
|
|
1104
1088
|
) {
|
|
1105
1089
|
trace(`${T} updateSettings removing fullscreen`, {
|
|
@@ -1163,11 +1147,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
1163
1147
|
this.$multiCameraSelector = this.$el.find(
|
|
1164
1148
|
'.media-control-multicamera[data-multicamera]',
|
|
1165
1149
|
)
|
|
1166
|
-
this.$clipText = this.$el.find('.media-clip-text[data-clipstext]') // TODO
|
|
1167
|
-
this.$clipTextContainer = this.$el.find(
|
|
1168
|
-
'.media-clip-container[data-clipstext]',
|
|
1169
|
-
)
|
|
1170
|
-
|
|
1171
1150
|
this.resetIndicators()
|
|
1172
1151
|
this.initializeIcons()
|
|
1173
1152
|
}
|
|
@@ -1183,26 +1162,14 @@ export class MediaControl extends UICorePlugin {
|
|
|
1183
1162
|
* ```ts
|
|
1184
1163
|
* class MyPlugin extends UICorePlugin {
|
|
1185
1164
|
* override render() {
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
* clipText?.el.text('Here we go')
|
|
1165
|
+
* this.$el.html('<div data-clips>Here we go</div>')
|
|
1166
|
+
* this.core.getPlugin('media_control').mount('clips', this.$el)
|
|
1189
1167
|
* return this
|
|
1190
1168
|
* }
|
|
1191
1169
|
* }
|
|
1192
1170
|
* ```
|
|
1193
1171
|
*/
|
|
1194
|
-
|
|
1195
|
-
switch (name) {
|
|
1196
|
-
case 'audiotracks':
|
|
1197
|
-
return null
|
|
1198
|
-
case 'clipText':
|
|
1199
|
-
return this.$clipText
|
|
1200
|
-
case 'seekBarContainer':
|
|
1201
|
-
return this.$seekBarContainer
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
putElement(name: MediaControlElement, element: ZeptoResult) {
|
|
1172
|
+
mount(name: MediaControlElement, element: ZeptoResult) {
|
|
1206
1173
|
const panel = this.getElementLocation(name)
|
|
1207
1174
|
trace(`${T} putElement`, { name, panel: !!panel })
|
|
1208
1175
|
if (panel) {
|
|
@@ -1221,6 +1188,10 @@ export class MediaControl extends UICorePlugin {
|
|
|
1221
1188
|
}
|
|
1222
1189
|
}
|
|
1223
1190
|
|
|
1191
|
+
putElement(name: MediaControlElement, element: ZeptoResult) {
|
|
1192
|
+
this.mount(name, element)
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1224
1195
|
/**
|
|
1225
1196
|
* Toggle the visibility of a media control element
|
|
1226
1197
|
* @param name - The name of the media control element
|
|
@@ -1284,12 +1255,12 @@ export class MediaControl extends UICorePlugin {
|
|
|
1284
1255
|
return
|
|
1285
1256
|
}
|
|
1286
1257
|
|
|
1287
|
-
const currentTime = this.
|
|
1288
|
-
const duration = this.
|
|
1258
|
+
const currentTime = this.core.activeContainer.getCurrentTime()
|
|
1259
|
+
const duration = this.core.activeContainer.getDuration()
|
|
1289
1260
|
let position = Math.min(Math.max(currentTime + delta, 0), duration)
|
|
1290
1261
|
|
|
1291
1262
|
position = Math.min((position * 100) / duration, 100)
|
|
1292
|
-
this.
|
|
1263
|
+
this.core.activeContainer.seekPercentage(position)
|
|
1293
1264
|
}
|
|
1294
1265
|
|
|
1295
1266
|
private bindKeyAndShow(key: string, callback: () => boolean | undefined) {
|
|
@@ -1427,7 +1398,10 @@ export class MediaControl extends UICorePlugin {
|
|
|
1427
1398
|
* @internal
|
|
1428
1399
|
*/
|
|
1429
1400
|
override render() {
|
|
1430
|
-
trace(`${T} render`, {
|
|
1401
|
+
trace(`${T} render`, {
|
|
1402
|
+
needsUpdate: this.hasUpdate,
|
|
1403
|
+
metadataLoaded: this.metadataLoaded,
|
|
1404
|
+
})
|
|
1431
1405
|
if (!this.hasUpdate || !this.metadataLoaded) {
|
|
1432
1406
|
return this
|
|
1433
1407
|
}
|
|
@@ -1491,7 +1465,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1491
1465
|
|
|
1492
1466
|
this.rendered = true
|
|
1493
1467
|
this.updateVolumeUI()
|
|
1494
|
-
|
|
1468
|
+
|
|
1495
1469
|
this.hasUpdate = false
|
|
1496
1470
|
// TODO setTimeout?
|
|
1497
1471
|
this.trigger(Events.MEDIACONTROL_RENDERED)
|
|
@@ -1615,8 +1589,7 @@ MediaControl.extend = function (properties) {
|
|
|
1615
1589
|
}
|
|
1616
1590
|
|
|
1617
1591
|
function serializeSettings(s: MediaControlSettings) {
|
|
1618
|
-
return (s.left
|
|
1619
|
-
.slice() as MediaControlElement[])
|
|
1592
|
+
return (s.left.slice() as MediaControlElement[])
|
|
1620
1593
|
.sort()
|
|
1621
1594
|
.concat(s.right.slice().sort())
|
|
1622
1595
|
.concat(s.default.slice().sort())
|
|
@@ -13,7 +13,6 @@ exports[`MediaControl > putElement > audiotracks > should put the element in the
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
@@ -36,10 +35,7 @@ exports[`MediaControl > putElement > audiotracks > should put the element in the
|
|
|
36
35
|
|
|
37
36
|
</div>
|
|
38
37
|
|
|
39
|
-
<div class="media-
|
|
40
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
41
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
42
|
-
</div>
|
|
38
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
43
39
|
|
|
44
40
|
</div>
|
|
45
41
|
|
|
@@ -72,7 +68,6 @@ exports[`MediaControl > putElement > cc > should put the element in the right pa
|
|
|
72
68
|
|
|
73
69
|
|
|
74
70
|
|
|
75
|
-
|
|
76
71
|
|
|
77
72
|
|
|
78
73
|
|
|
@@ -95,10 +90,7 @@ exports[`MediaControl > putElement > cc > should put the element in the right pa
|
|
|
95
90
|
|
|
96
91
|
</div>
|
|
97
92
|
|
|
98
|
-
<div class="media-
|
|
99
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
100
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
101
|
-
</div>
|
|
93
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
102
94
|
|
|
103
95
|
</div>
|
|
104
96
|
|
|
@@ -131,7 +123,6 @@ exports[`MediaControl > putElement > gear > should put the element in the right
|
|
|
131
123
|
|
|
132
124
|
|
|
133
125
|
|
|
134
|
-
|
|
135
126
|
|
|
136
127
|
|
|
137
128
|
|
|
@@ -154,10 +145,7 @@ exports[`MediaControl > putElement > gear > should put the element in the right
|
|
|
154
145
|
|
|
155
146
|
</div>
|
|
156
147
|
|
|
157
|
-
<div class="media-
|
|
158
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
159
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
160
|
-
</div>
|
|
148
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
161
149
|
|
|
162
150
|
</div>
|
|
163
151
|
|
|
@@ -190,7 +178,6 @@ exports[`MediaControl > putElement > pip > should put the element in the right p
|
|
|
190
178
|
|
|
191
179
|
|
|
192
180
|
|
|
193
|
-
|
|
194
181
|
|
|
195
182
|
|
|
196
183
|
|
|
@@ -213,10 +200,7 @@ exports[`MediaControl > putElement > pip > should put the element in the right p
|
|
|
213
200
|
|
|
214
201
|
</div>
|
|
215
202
|
|
|
216
|
-
<div class="media-
|
|
217
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
218
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
219
|
-
</div>
|
|
203
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
220
204
|
|
|
221
205
|
</div>
|
|
222
206
|
|
|
@@ -249,7 +233,6 @@ exports[`MediaControl > rendering timing > once metadata is loaded > should wait
|
|
|
249
233
|
|
|
250
234
|
|
|
251
235
|
|
|
252
|
-
|
|
253
236
|
|
|
254
237
|
|
|
255
238
|
|
|
@@ -278,10 +261,7 @@ exports[`MediaControl > rendering timing > once metadata is loaded > should wait
|
|
|
278
261
|
|
|
279
262
|
<div class="media-control-indicator gcore-skin-text-color" data-duration="">00:00</div>
|
|
280
263
|
|
|
281
|
-
<div class="media-
|
|
282
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
283
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
284
|
-
</div>
|
|
264
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
285
265
|
|
|
286
266
|
</div>
|
|
287
267
|
|
|
@@ -329,7 +309,6 @@ exports[`MediaControl > updateSettings > dvr > when disabled > should disable DV
|
|
|
329
309
|
|
|
330
310
|
|
|
331
311
|
|
|
332
|
-
|
|
333
312
|
|
|
334
313
|
|
|
335
314
|
|
|
@@ -358,10 +337,7 @@ exports[`MediaControl > updateSettings > dvr > when disabled > should disable DV
|
|
|
358
337
|
|
|
359
338
|
<div class="media-control-indicator gcore-skin-text-color" data-duration="">00:00</div>
|
|
360
339
|
|
|
361
|
-
<div class="media-
|
|
362
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
363
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
364
|
-
</div>
|
|
340
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
365
341
|
|
|
366
342
|
</div>
|
|
367
343
|
|
|
@@ -394,7 +370,6 @@ exports[`MediaControl > updateSettings > dvr > when enabled > should enable DVR
|
|
|
394
370
|
|
|
395
371
|
|
|
396
372
|
|
|
397
|
-
|
|
398
373
|
|
|
399
374
|
|
|
400
375
|
|
|
@@ -423,10 +398,7 @@ exports[`MediaControl > updateSettings > dvr > when enabled > should enable DVR
|
|
|
423
398
|
|
|
424
399
|
<div class="media-control-indicator gcore-skin-text-color" data-duration="">00:00</div>
|
|
425
400
|
|
|
426
|
-
<div class="media-
|
|
427
|
-
<div class="media-clip-point gcore-skin-text-color" data-clipstext="">•</div>
|
|
428
|
-
<div class="media-clip-text gcore-skin-text-color" data-clipstext=""></div>
|
|
429
|
-
</div>
|
|
401
|
+
<div class="media-control-indicator gcore-skin-text-color" data-clips=""></div>
|
|
430
402
|
|
|
431
403
|
<div class="my-dvr-controls" data-dvr="">live</div></div>
|
|
432
404
|
|
package/src/plugins/utils.ts
CHANGED
|
@@ -6,7 +6,15 @@ export function getLocation(href: string) {
|
|
|
6
6
|
return l;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Parse a time string in the format "hh:mm:ss" or "mm:ss" or "ss" to seconds.
|
|
11
|
+
* @param str - The time string to parse.
|
|
12
|
+
* @returns The time in seconds.
|
|
13
|
+
* @example "01:01:00" -> 3660
|
|
14
|
+
* @example "01:00" -> 60
|
|
15
|
+
* @example "33" -> 33
|
|
16
|
+
*/
|
|
17
|
+
export function parseClipTime(str: string): number {
|
|
10
18
|
if (!str) {
|
|
11
19
|
return 0;
|
|
12
20
|
}
|
|
@@ -15,19 +23,13 @@ export function strtimeToMiliseconds(str: string): number {
|
|
|
15
23
|
|
|
16
24
|
if (arr.length >= 3) {
|
|
17
25
|
h = parseInt(arr[arr.length - 3]) * 60 * 60;
|
|
18
|
-
} else {
|
|
19
|
-
h = 0;
|
|
20
26
|
}
|
|
21
27
|
if (arr.length >= 2) {
|
|
22
28
|
m = parseInt(arr[arr.length - 2]) * 60;
|
|
23
|
-
} else {
|
|
24
|
-
m = 0;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
if (arr.length >= 1) {
|
|
28
32
|
s = parseInt(arr[arr.length - 1]);
|
|
29
|
-
} else {
|
|
30
|
-
s = 0;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
return (h + m + s);
|