@gcorevideo/player 2.22.14 → 2.22.16
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/context-menu/context_menu.ejs +14 -6
- package/assets/context-menu/context_menu.scss +18 -4
- 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 +5 -23
- package/dist/index.css +424 -412
- package/dist/index.js +294 -286
- package/dist/player.d.ts +211 -144
- package/dist/plugins/index.css +1513 -1501
- package/dist/plugins/index.js +224 -227
- package/docs/api/{player.audioselector.md → player.audiotracks.md} +3 -3
- package/docs/api/player.contextmenu.md +2 -0
- package/docs/api/player.contextmenupluginsettings.md +2 -40
- package/docs/api/{player.contextmenupluginsettings.label.md → player.contextmenupluginsettings.options.md} +3 -3
- package/docs/api/player.md +78 -23
- package/docs/api/player.mediacontrol.md +8 -14
- package/docs/api/player.mediacontrolelement.md +4 -2
- package/docs/api/{player.contextmenupluginsettings.preventshowcontextmenu.md → player.mediacontrollayerelement.md} +5 -3
- 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.contextmenupluginsettings.url.md → player.menuoption.md} +10 -3
- 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.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/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +4 -1
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +0 -21
- package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
- 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/context-menu/ContextMenu.d.ts +33 -12
- package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -1
- package/lib/plugins/context-menu/ContextMenu.js +40 -37
- 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.map +1 -1
- package/lib/testUtils.js +2 -5
- package/package.json +1 -1
- package/src/Player.ts +4 -3
- package/src/playback/hls-playback/HlsPlayback.ts +0 -22
- package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
- 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/context-menu/ContextMenu.ts +72 -56
- 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__/MediaControl.test.ts +66 -30
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +7 -35
- package/src/plugins/utils.ts +9 -7
- package/src/plugins/vast-ads/loaderxml.ts +2 -2
- package/src/testUtils.ts +2 -5
- package/temp/player.api.json +332 -262
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.mediacontrol.handlecustomarea.md +0 -52
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Events,
|
|
3
|
-
template,
|
|
4
|
-
$,
|
|
5
|
-
Container,
|
|
6
|
-
UIContainerPlugin,
|
|
7
|
-
} from '@clappr/core'
|
|
1
|
+
import { Events, template, $, Container, UIContainerPlugin } from '@clappr/core'
|
|
8
2
|
|
|
9
3
|
import { CLAPPR_VERSION } from '../../build.js'
|
|
10
4
|
|
|
11
5
|
import '../../../assets/context-menu/context_menu.scss'
|
|
12
6
|
import templateHtml from '../../../assets/context-menu/context_menu.ejs'
|
|
13
|
-
import { version } from '../../version.js'
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export type MenuOption = {
|
|
12
|
+
/**
|
|
13
|
+
* Menu item label text. One of `label` or `labelKey` must be specified.
|
|
14
|
+
*/
|
|
15
|
+
label?: string
|
|
16
|
+
/**
|
|
17
|
+
* Menu item label localisation key, if specified, the `label` will be ignored
|
|
18
|
+
*/
|
|
19
|
+
labelKey?: string
|
|
20
|
+
/**
|
|
21
|
+
* Menu item name. Must be unique.
|
|
22
|
+
*/
|
|
17
23
|
name: string
|
|
24
|
+
/**
|
|
25
|
+
* Menu item handler function
|
|
26
|
+
*/
|
|
27
|
+
handler?: () => void
|
|
28
|
+
/**
|
|
29
|
+
* Menu item icon, plain HTML string
|
|
30
|
+
*/
|
|
31
|
+
icon?: string
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
/**
|
|
@@ -22,23 +36,21 @@ type MenuOption = {
|
|
|
22
36
|
* @beta
|
|
23
37
|
*/
|
|
24
38
|
export interface ContextMenuPluginSettings {
|
|
25
|
-
|
|
26
|
-
url?: string
|
|
27
|
-
preventShowContextMenu?: boolean
|
|
39
|
+
options?: MenuOption[]
|
|
28
40
|
}
|
|
29
41
|
|
|
42
|
+
const T = 'plugins.context_menu'
|
|
43
|
+
|
|
30
44
|
/**
|
|
31
45
|
* `PLUGIN` that displays a small context menu when clicked on the player container.
|
|
32
46
|
* @beta
|
|
33
47
|
* @remarks
|
|
34
48
|
* Configuration options - {@link ContextMenuPluginSettings}
|
|
49
|
+
*
|
|
50
|
+
* Should not be used together with {@link ClickToPause} plugin
|
|
35
51
|
*/
|
|
36
52
|
export class ContextMenu extends UIContainerPlugin {
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
private _url: string = ''
|
|
40
|
-
|
|
41
|
-
private menuOptions: MenuOption[] = []
|
|
53
|
+
private open = false
|
|
42
54
|
|
|
43
55
|
/**
|
|
44
56
|
* @internal
|
|
@@ -63,38 +75,17 @@ export class ContextMenu extends UIContainerPlugin {
|
|
|
63
75
|
|
|
64
76
|
private static readonly template = template(templateHtml)
|
|
65
77
|
|
|
66
|
-
private get label() {
|
|
67
|
-
return this._label || 'Gcore player ver. ' + version().gplayer
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private get url() {
|
|
71
|
-
return this._url || 'https://gcore.com/'
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private get exposeVersion() {
|
|
75
|
-
return {
|
|
76
|
-
label: this.label,
|
|
77
|
-
name: 'version',
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
78
|
/**
|
|
82
79
|
* @internal
|
|
83
80
|
*/
|
|
84
81
|
override get events() {
|
|
85
82
|
return {
|
|
86
|
-
'click [
|
|
83
|
+
'click [role="menuitem"]': 'runAction',
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
constructor(container: Container) {
|
|
91
88
|
super(container)
|
|
92
|
-
if (this.options.contextMenu && this.options.contextMenu.label) {
|
|
93
|
-
this._label = this.options.contextMenu.label
|
|
94
|
-
}
|
|
95
|
-
if (this.options.contextMenu && this.options.contextMenu.url) {
|
|
96
|
-
this._url = this.options.contextMenu.url
|
|
97
|
-
}
|
|
98
89
|
this.render()
|
|
99
90
|
$('body').on('click', this.hideOnBodyClick)
|
|
100
91
|
}
|
|
@@ -106,9 +97,9 @@ export class ContextMenu extends UIContainerPlugin {
|
|
|
106
97
|
this.listenTo(
|
|
107
98
|
this.container,
|
|
108
99
|
Events.CONTAINER_CONTEXTMENU,
|
|
109
|
-
this.
|
|
100
|
+
this.onContextMenu,
|
|
110
101
|
)
|
|
111
|
-
this.listenTo(this.container, Events.CONTAINER_CLICK, this.
|
|
102
|
+
this.listenTo(this.container, Events.CONTAINER_CLICK, this.onContainerClick)
|
|
112
103
|
}
|
|
113
104
|
|
|
114
105
|
/**
|
|
@@ -119,41 +110,66 @@ export class ContextMenu extends UIContainerPlugin {
|
|
|
119
110
|
return super.destroy()
|
|
120
111
|
}
|
|
121
112
|
|
|
122
|
-
private
|
|
113
|
+
private onContainerClick() {
|
|
114
|
+
this.hide()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private onContextMenu(event: MouseEvent) {
|
|
118
|
+
if (!this.options.contextMenu?.options?.length) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
123
121
|
event.preventDefault()
|
|
124
|
-
|
|
122
|
+
event.stopPropagation()
|
|
125
123
|
|
|
124
|
+
const offset = this.container?.$el.offset()
|
|
126
125
|
this.show(event.pageY - offset.top, event.pageX - offset.left)
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
private show(top: number, left: number) {
|
|
130
|
-
this.
|
|
131
|
-
if (
|
|
132
|
-
this.options.contextMenu &&
|
|
133
|
-
this.options.contextMenu.preventShowContextMenu
|
|
134
|
-
) {
|
|
135
|
-
return
|
|
136
|
-
}
|
|
129
|
+
this.open = true
|
|
137
130
|
this.$el.css({ top, left })
|
|
138
131
|
this.$el.show()
|
|
139
132
|
}
|
|
140
133
|
|
|
141
134
|
private hide() {
|
|
135
|
+
this.open = false
|
|
142
136
|
this.$el.hide()
|
|
143
137
|
}
|
|
144
138
|
|
|
145
|
-
private
|
|
146
|
-
|
|
139
|
+
private runAction(event: MouseEvent) {
|
|
140
|
+
event.preventDefault()
|
|
141
|
+
event.stopPropagation()
|
|
142
|
+
|
|
143
|
+
const itemName = (event.currentTarget as HTMLButtonElement).dataset.name
|
|
144
|
+
if (!itemName) {
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
const item = this.options.contextMenu?.options.find(
|
|
148
|
+
(option: MenuOption) => option.name === itemName,
|
|
149
|
+
)
|
|
150
|
+
if (item?.handler) {
|
|
151
|
+
item.handler()
|
|
152
|
+
}
|
|
153
|
+
this.hide()
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
/**
|
|
150
157
|
* @internal
|
|
151
158
|
*/
|
|
152
159
|
override render() {
|
|
153
|
-
this.
|
|
154
|
-
|
|
160
|
+
if (!this.options.contextMenu?.options?.length) {
|
|
161
|
+
return this
|
|
162
|
+
}
|
|
163
|
+
const options = this.options.contextMenu.options
|
|
164
|
+
this.$el.html(
|
|
165
|
+
ContextMenu.template({
|
|
166
|
+
options,
|
|
167
|
+
i18n: this.container.i18n,
|
|
168
|
+
iconic: options.some((option: MenuOption) => option.icon),
|
|
169
|
+
}),
|
|
170
|
+
)
|
|
155
171
|
this.container.$el.append(this.$el) // TODO append to the container, turn into a container plugin
|
|
156
|
-
this.hide()
|
|
172
|
+
this.$el.hide()
|
|
157
173
|
|
|
158
174
|
return this
|
|
159
175
|
}
|
|
@@ -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())
|