@gcorevideo/player 2.25.6 → 2.25.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/audio-tracks/template.ejs +5 -4
- package/assets/bottom-gear/gear-sub-menu.scss +4 -9
- package/assets/bottom-gear/gear.scss +1 -2
- package/assets/media-control/container.scss +0 -13
- package/assets/media-control/media-control.scss +110 -8
- package/assets/media-control/width270.scss +3 -9
- package/assets/media-control/width370.scss +6 -40
- package/assets/multi-camera/style.scss +0 -5
- package/assets/picture-in-picture/style.scss +1 -2
- package/assets/subtitles/combobox.ejs +27 -6
- package/assets/subtitles/string.ejs +1 -1
- package/assets/subtitles/style.scss +16 -69
- package/dist/core.js +1 -1
- package/dist/index.css +1019 -1117
- package/dist/index.embed.js +180 -123
- package/dist/index.js +161 -107
- package/lib/plugins/audio-selector/AudioTracks.d.ts +4 -3
- package/lib/plugins/audio-selector/AudioTracks.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioTracks.js +41 -23
- package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +3 -4
- package/lib/plugins/media-control/MediaControl.d.ts +4 -0
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +8 -1
- package/lib/plugins/subtitles/ClosedCaptions.d.ts +7 -4
- package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +64 -34
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +2 -0
- package/package.json +1 -1
- package/src/plugins/audio-selector/AudioTracks.ts +53 -29
- package/src/plugins/audio-selector/__tests__/AudioTracks.test.ts +60 -45
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +24 -24
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioTracks.test.ts.snap +21 -18
- package/src/plugins/bottom-gear/BottomGear.ts +3 -4
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +1 -1
- package/src/plugins/media-control/MediaControl.ts +11 -1
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +6 -6
- package/src/plugins/subtitles/ClosedCaptions.ts +66 -35
- package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +220 -35
- package/src/plugins/subtitles/__tests__/__snapshots__/ClosedCaptions.test.ts.snap +8 -19
- package/src/testUtils.ts +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/assets/audio-tracks/style.scss +0 -111
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { Events, UICorePlugin, template } from '@clappr/core'
|
|
2
2
|
import { AudioTrack } from '@clappr/core/types/base/playback/playback.js'
|
|
3
3
|
import assert from 'assert'
|
|
4
|
+
// import { trace } from '@gcorevideo/utils'
|
|
4
5
|
|
|
5
6
|
import { CLAPPR_VERSION } from '../../build.js'
|
|
6
7
|
|
|
7
8
|
import pluginHtml from '../../../assets/audio-tracks/template.ejs'
|
|
8
|
-
import '../../../assets/audio-tracks/style.scss'
|
|
9
9
|
import audioArrow from '../../../assets/icons/old/quality-arrow.svg'
|
|
10
10
|
import { ZeptoResult } from '../../types.js'
|
|
11
11
|
import { ExtendedEvents, MediaControl } from '../media-control/MediaControl.js'
|
|
12
|
-
import { trace } from '@gcorevideo/utils'
|
|
13
12
|
|
|
14
13
|
const VERSION: string = '2.22.4'
|
|
15
14
|
|
|
16
|
-
const T = 'plugins.audiotracks'
|
|
15
|
+
// const T = 'plugins.audiotracks'
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* `PLUGIN` that makes possible to switch audio tracks via the media control UI.
|
|
@@ -28,6 +27,8 @@ const T = 'plugins.audiotracks'
|
|
|
28
27
|
export class AudioTracks extends UICorePlugin {
|
|
29
28
|
private currentTrack: AudioTrack | null = null
|
|
30
29
|
|
|
30
|
+
private open = false
|
|
31
|
+
|
|
31
32
|
private tracks: AudioTrack[] = []
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -58,7 +59,7 @@ export class AudioTracks extends UICorePlugin {
|
|
|
58
59
|
*/
|
|
59
60
|
override get attributes() {
|
|
60
61
|
return {
|
|
61
|
-
class: 'media-control-audiotracks',
|
|
62
|
+
class: 'media-control-audiotracks media-control-dd__wrap',
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -67,8 +68,8 @@ export class AudioTracks extends UICorePlugin {
|
|
|
67
68
|
*/
|
|
68
69
|
override get events() {
|
|
69
70
|
return {
|
|
70
|
-
'click [data-
|
|
71
|
-
'click #audiotracks-button': 'toggleMenu',
|
|
71
|
+
'click #gplayer-audiotracks-menu [data-item]': 'onTrackSelect',
|
|
72
|
+
'click #gplayer-audiotracks-button': 'toggleMenu',
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -87,15 +88,21 @@ export class AudioTracks extends UICorePlugin {
|
|
|
87
88
|
private onCoreReady() {
|
|
88
89
|
const mediaControl = this.core.getPlugin('media_control')
|
|
89
90
|
assert(mediaControl, 'media_control plugin is required')
|
|
91
|
+
|
|
90
92
|
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, () => {
|
|
91
|
-
|
|
93
|
+
this.mount()
|
|
92
94
|
})
|
|
95
|
+
// TODO when tracks change, re-render and re-attach
|
|
93
96
|
this.listenTo(mediaControl, Events.MEDIACONTROL_HIDE, this.hideMenu)
|
|
94
|
-
this.listenTo(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
this.listenTo(
|
|
98
|
+
mediaControl,
|
|
99
|
+
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
100
|
+
(from: string) => {
|
|
101
|
+
if (from !== this.name) {
|
|
102
|
+
this.hideMenu()
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
)
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
private onActiveContainerChanged() {
|
|
@@ -108,6 +115,7 @@ export class AudioTracks extends UICorePlugin {
|
|
|
108
115
|
tracks.find((track) => track.kind === 'main') ?? null // TODO test
|
|
109
116
|
this.tracks = tracks
|
|
110
117
|
this.render()
|
|
118
|
+
this.mount()
|
|
111
119
|
},
|
|
112
120
|
)
|
|
113
121
|
this.listenTo(
|
|
@@ -120,6 +128,10 @@ export class AudioTracks extends UICorePlugin {
|
|
|
120
128
|
this.updateText()
|
|
121
129
|
},
|
|
122
130
|
)
|
|
131
|
+
// TODO test
|
|
132
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_CLICK, () => {
|
|
133
|
+
this.hideMenu()
|
|
134
|
+
})
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
private shouldRender() {
|
|
@@ -132,18 +144,15 @@ export class AudioTracks extends UICorePlugin {
|
|
|
132
144
|
* @internal
|
|
133
145
|
*/
|
|
134
146
|
override render() {
|
|
135
|
-
if (!this.shouldRender()) {
|
|
136
|
-
return this
|
|
137
|
-
}
|
|
138
|
-
|
|
139
147
|
this.$el.html(
|
|
140
148
|
AudioTracks.template({
|
|
141
|
-
tracks: this.tracks,
|
|
149
|
+
tracks: this.tracks ?? [],
|
|
142
150
|
title: this.getTitle(),
|
|
143
151
|
icon: audioArrow,
|
|
144
152
|
current: this.currentTrack?.id,
|
|
145
153
|
}),
|
|
146
154
|
)
|
|
155
|
+
this.$el.find('#gplayer-audiotracks-menu').hide()
|
|
147
156
|
this.updateText()
|
|
148
157
|
this.highlightCurrentTrack()
|
|
149
158
|
|
|
@@ -151,7 +160,7 @@ export class AudioTracks extends UICorePlugin {
|
|
|
151
160
|
}
|
|
152
161
|
|
|
153
162
|
private onTrackSelect(event: MouseEvent) {
|
|
154
|
-
const id = (event.currentTarget as HTMLElement)?.dataset?.
|
|
163
|
+
const id = (event.currentTarget as HTMLElement)?.dataset?.item
|
|
155
164
|
if (id) {
|
|
156
165
|
this.selectAudioTrack(id)
|
|
157
166
|
}
|
|
@@ -167,31 +176,40 @@ export class AudioTracks extends UICorePlugin {
|
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
private hideMenu() {
|
|
170
|
-
|
|
171
|
-
this.$el.find('#audiotracks-
|
|
172
|
-
this.$el.find('#audiotracks-button').attr('aria-expanded', 'false')
|
|
179
|
+
this.open = false
|
|
180
|
+
this.$el.find('#gplayer-audiotracks-menu').hide()
|
|
181
|
+
this.$el.find('#gplayer-audiotracks-button').attr('aria-expanded', 'false')
|
|
173
182
|
}
|
|
174
183
|
|
|
175
184
|
private toggleMenu() {
|
|
176
|
-
this.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
185
|
+
this.open = !this.open
|
|
186
|
+
|
|
187
|
+
this.core
|
|
188
|
+
.getPlugin('media_control')
|
|
189
|
+
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name)
|
|
190
|
+
if (this.open) {
|
|
191
|
+
this.$el.find('#gplayer-audiotracks-menu').show()
|
|
192
|
+
} else {
|
|
193
|
+
this.$el.find('#gplayer-audiotracks-menu').hide()
|
|
194
|
+
}
|
|
195
|
+
this.$el
|
|
196
|
+
.find('#gplayer-audiotracks-button')
|
|
197
|
+
.attr('aria-expanded', this.open)
|
|
180
198
|
}
|
|
181
199
|
|
|
182
200
|
private buttonElement(): ZeptoResult {
|
|
183
|
-
return this.$('button')
|
|
201
|
+
return this.$('#gplayer-audiotracks-button')
|
|
184
202
|
}
|
|
185
203
|
|
|
186
204
|
private buttonElementText(): ZeptoResult {
|
|
187
|
-
return this.$('button
|
|
205
|
+
return this.$el.find('#gplayer-audiotracks-button-text')
|
|
188
206
|
}
|
|
189
207
|
|
|
190
208
|
private trackElement(id?: string): ZeptoResult {
|
|
191
209
|
return (
|
|
192
210
|
this.$(
|
|
193
|
-
'#audiotracks-
|
|
194
|
-
(id !== undefined ? `[data-
|
|
211
|
+
'#gplayer-audiotracks-menu a' +
|
|
212
|
+
(id !== undefined ? `[data-item="${id}"]` : ''),
|
|
195
213
|
) as ZeptoResult
|
|
196
214
|
).parent()
|
|
197
215
|
}
|
|
@@ -229,4 +247,10 @@ export class AudioTracks extends UICorePlugin {
|
|
|
229
247
|
.attr('aria-checked', 'true')
|
|
230
248
|
}
|
|
231
249
|
}
|
|
250
|
+
|
|
251
|
+
private mount() {
|
|
252
|
+
if (this.shouldRender()) {
|
|
253
|
+
this.core.getPlugin('media_control')?.slot('audiotracks', this.$el)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
232
256
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import { Events } from '@clappr/core'
|
|
3
|
+
|
|
3
4
|
import { ExtendedEvents } from '../../media-control/MediaControl'
|
|
4
5
|
import { AudioTracks } from '../AudioTracks'
|
|
5
6
|
|
|
@@ -29,54 +30,51 @@ describe('AudioTracks', () => {
|
|
|
29
30
|
core.emit(Events.CORE_READY)
|
|
30
31
|
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED, core.activeContainer)
|
|
31
32
|
})
|
|
32
|
-
describe('
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
describe('basically', () => {
|
|
34
|
+
it('should render button', () => {
|
|
35
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-button').length).toBe(1)
|
|
35
36
|
})
|
|
36
|
-
it('should
|
|
37
|
-
expect(
|
|
38
|
-
'audiotracks',
|
|
39
|
-
expect.anything(),
|
|
40
|
-
)
|
|
37
|
+
it('should render menu hidden', () => {
|
|
38
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-menu').css('display')).toBe('none')
|
|
41
39
|
})
|
|
42
40
|
})
|
|
43
|
-
describe('
|
|
44
|
-
|
|
45
|
-
mediaControl.
|
|
46
|
-
})
|
|
47
|
-
it('should attach to the media control', () => {
|
|
48
|
-
expect(mediaControl.slot).toHaveBeenCalledWith(
|
|
41
|
+
describe('until audio tracks are available', () => {
|
|
42
|
+
it('should not mount', () => {
|
|
43
|
+
expect(mediaControl.slot).not.toHaveBeenCalledWith(
|
|
49
44
|
'audiotracks',
|
|
50
|
-
|
|
45
|
+
expect.anything(),
|
|
51
46
|
)
|
|
52
47
|
})
|
|
53
48
|
})
|
|
54
|
-
describe('
|
|
49
|
+
describe('when audio tracks are available', () => {
|
|
55
50
|
beforeEach(() => {
|
|
56
51
|
emitTracksAvailable(core, TRACKS)
|
|
57
52
|
})
|
|
58
|
-
it('should render
|
|
59
|
-
expect(audioTracks.$el.find('#audiotracks-button').length).toBe(1)
|
|
60
|
-
})
|
|
61
|
-
it('should render menu hidden', () => {
|
|
53
|
+
it('should render menu', () => {
|
|
62
54
|
expect(audioTracks.el.innerHTML).toMatchSnapshot()
|
|
63
55
|
expect(
|
|
64
|
-
audioTracks.$el.find('#audiotracks-
|
|
65
|
-
).toBe(
|
|
66
|
-
const trackItems = audioTracks.$el.find('#audiotracks-
|
|
56
|
+
audioTracks.$el.find('#gplayer-audiotracks-menu').css('display'),
|
|
57
|
+
).toBe('none')
|
|
58
|
+
const trackItems = audioTracks.$el.find('#gplayer-audiotracks-menu li')
|
|
67
59
|
expect(trackItems.length).toBe(2)
|
|
68
60
|
expect(trackItems.eq(0).text().trim()).toBe('English')
|
|
69
61
|
expect(trackItems.eq(1).text().trim()).toBe('Spanish')
|
|
70
62
|
})
|
|
63
|
+
it('should mount', () => {
|
|
64
|
+
expect(mediaControl.slot).toHaveBeenCalledWith(
|
|
65
|
+
'audiotracks',
|
|
66
|
+
audioTracks.$el,
|
|
67
|
+
)
|
|
68
|
+
})
|
|
71
69
|
describe('when button is clicked', () => {
|
|
72
70
|
beforeEach(() => {
|
|
73
|
-
audioTracks.$el.find('#audiotracks-button').click()
|
|
71
|
+
audioTracks.$el.find('#gplayer-audiotracks-button').click()
|
|
74
72
|
})
|
|
75
73
|
it('should show menu', () => {
|
|
76
74
|
expect(audioTracks.$el.html()).toMatchSnapshot()
|
|
77
75
|
expect(
|
|
78
|
-
audioTracks.$el.find('#audiotracks-
|
|
79
|
-
).toBe(
|
|
76
|
+
audioTracks.$el.find('#gplayer-audiotracks-menu').css('display'),
|
|
77
|
+
).not.toBe('none')
|
|
80
78
|
})
|
|
81
79
|
it('should collapse all other menus', () => {
|
|
82
80
|
expect(mediaControl.trigger).toHaveBeenCalledWith(
|
|
@@ -87,7 +85,7 @@ describe('AudioTracks', () => {
|
|
|
87
85
|
describe('when audio track is selected', () => {
|
|
88
86
|
beforeEach(() => {
|
|
89
87
|
audioTracks.$el
|
|
90
|
-
.find('#audiotracks-
|
|
88
|
+
.find('#gplayer-audiotracks-menu [data-item="2"]')
|
|
91
89
|
.click()
|
|
92
90
|
})
|
|
93
91
|
it('should switch to the selected audio track', () => {
|
|
@@ -98,13 +96,13 @@ describe('AudioTracks', () => {
|
|
|
98
96
|
it('should hide the menu', () => {
|
|
99
97
|
expect(audioTracks.$el.html()).toMatchSnapshot()
|
|
100
98
|
expect(
|
|
101
|
-
audioTracks.$el.find('#audiotracks-
|
|
102
|
-
).toBe(
|
|
103
|
-
expect(audioTracks.$el.find('#audiotracks-button').attr('aria-expanded')).toBe('false')
|
|
99
|
+
audioTracks.$el.find('#gplayer-audiotracks-menu').css('display'),
|
|
100
|
+
).toBe('none')
|
|
101
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-button').attr('aria-expanded')).toBe('false')
|
|
104
102
|
})
|
|
105
103
|
it('should add changing class to the button', () => {
|
|
106
104
|
expect(
|
|
107
|
-
audioTracks.$el.find('#audiotracks-button').hasClass('changing'),
|
|
105
|
+
audioTracks.$el.find('#gplayer-audiotracks-button').hasClass('changing'),
|
|
108
106
|
).toBe(true)
|
|
109
107
|
})
|
|
110
108
|
describe('when current audio track changes', () => {
|
|
@@ -123,14 +121,14 @@ describe('AudioTracks', () => {
|
|
|
123
121
|
it('should update button class', () => {
|
|
124
122
|
expect(
|
|
125
123
|
audioTracks.$el
|
|
126
|
-
.find('#audiotracks-button')
|
|
124
|
+
.find('#gplayer-audiotracks-button')
|
|
127
125
|
.hasClass('changing'),
|
|
128
126
|
).toBe(false)
|
|
129
127
|
})
|
|
130
128
|
it('should update button label', () => {
|
|
131
129
|
expect(
|
|
132
130
|
audioTracks.$el
|
|
133
|
-
.find('#audiotracks-button')
|
|
131
|
+
.find('#gplayer-audiotracks-button')
|
|
134
132
|
.text()
|
|
135
133
|
.replace(/\/assets.*\.svg/g, '')
|
|
136
134
|
.trim(),
|
|
@@ -138,22 +136,22 @@ describe('AudioTracks', () => {
|
|
|
138
136
|
})
|
|
139
137
|
it('should highlight the selected menu item', () => {
|
|
140
138
|
const selectedItem = audioTracks.$el.find(
|
|
141
|
-
'#audiotracks-
|
|
139
|
+
'#gplayer-audiotracks-menu .current',
|
|
142
140
|
)
|
|
143
141
|
expect(selectedItem.text().trim()).toBe('Spanish')
|
|
144
142
|
expect(
|
|
145
143
|
selectedItem
|
|
146
|
-
.find('a[data-
|
|
144
|
+
.find('a[data-item]')
|
|
147
145
|
.hasClass('gcore-skin-active'),
|
|
148
146
|
).toBe(true)
|
|
149
147
|
})
|
|
150
148
|
it('should unhighlight any previously highlighted menu item', () => {
|
|
151
149
|
expect(
|
|
152
|
-
audioTracks.$el.find('#audiotracks-
|
|
150
|
+
audioTracks.$el.find('#gplayer-audiotracks-menu li.current').length,
|
|
153
151
|
).toBe(1)
|
|
154
152
|
expect(
|
|
155
153
|
audioTracks.$el.find(
|
|
156
|
-
'#audiotracks-
|
|
154
|
+
'#gplayer-audiotracks-menu a.gcore-skin-active[data-item]',
|
|
157
155
|
).length,
|
|
158
156
|
).toBe(1)
|
|
159
157
|
})
|
|
@@ -162,19 +160,36 @@ describe('AudioTracks', () => {
|
|
|
162
160
|
})
|
|
163
161
|
describe('when button is clicked twice', () => {
|
|
164
162
|
beforeEach(() => {
|
|
165
|
-
audioTracks.$el.find('#audiotracks-button').click()
|
|
166
|
-
audioTracks.$el.find('#audiotracks-button').click()
|
|
163
|
+
audioTracks.$el.find('#gplayer-audiotracks-button').click()
|
|
164
|
+
audioTracks.$el.find('#gplayer-audiotracks-button').click()
|
|
167
165
|
})
|
|
168
166
|
it('should collapse the menu', () => {
|
|
169
|
-
expect(audioTracks.$el.find('#audiotracks-
|
|
170
|
-
expect(audioTracks.$el.find('#audiotracks-button').attr('aria-expanded')).toBe('false')
|
|
167
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-menu').css('display')).toBe('none')
|
|
168
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-button').attr('aria-expanded')).toBe('false')
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
describe('when media control is rendered', () => {
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
mediaControl.slot.mockClear()
|
|
174
|
+
mediaControl.trigger(Events.MEDIACONTROL_RENDERED)
|
|
175
|
+
})
|
|
176
|
+
it('should remount', () => {
|
|
177
|
+
expect(mediaControl.slot).toHaveBeenCalledWith(
|
|
178
|
+
'audiotracks',
|
|
179
|
+
audioTracks.$el,
|
|
180
|
+
)
|
|
171
181
|
})
|
|
172
182
|
})
|
|
173
183
|
})
|
|
174
|
-
describe('when
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
describe('when container is clicked', () => {
|
|
185
|
+
beforeEach(() => {
|
|
186
|
+
emitTracksAvailable(core, TRACKS)
|
|
187
|
+
audioTracks.$el.find('#gplayer-audiotracks-button').click()
|
|
188
|
+
core.activeContainer.emit(Events.CONTAINER_CLICK)
|
|
189
|
+
})
|
|
190
|
+
it('should hide the menu', () => {
|
|
191
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-menu').css('display')).toBe('none')
|
|
192
|
+
expect(audioTracks.$el.find('#gplayer-audiotracks-button').attr('aria-expanded')).toBe('false')
|
|
178
193
|
})
|
|
179
194
|
})
|
|
180
195
|
})
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`AudioSelector > 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">
|
|
4
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
5
5
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
6
6
|
</button>
|
|
7
|
-
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
7
|
+
<ul class="gcore-skin-bg-color menu hidden" id="media-control-audiotracks-select" role="menu">
|
|
8
8
|
|
|
9
9
|
<li class="">
|
|
10
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
10
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
11
11
|
English
|
|
12
12
|
</a>
|
|
13
13
|
</li>
|
|
14
14
|
|
|
15
15
|
<li class="">
|
|
16
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
16
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
17
17
|
Spanish
|
|
18
18
|
</a>
|
|
19
19
|
</li>
|
|
@@ -23,19 +23,19 @@ exports[`AudioSelector > given that audio tracks are available > should render m
|
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
25
|
exports[`AudioSelector > 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">
|
|
26
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
27
27
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
28
28
|
</button>
|
|
29
|
-
<ul class="gcore-skin-bg-color menu" id="audiotracks-select" role="menu">
|
|
29
|
+
<ul class="gcore-skin-bg-color menu" id="media-control-audiotracks-select" role="menu">
|
|
30
30
|
|
|
31
31
|
<li class="">
|
|
32
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
32
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
33
33
|
English
|
|
34
34
|
</a>
|
|
35
35
|
</li>
|
|
36
36
|
|
|
37
37
|
<li class="">
|
|
38
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
38
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
39
39
|
Spanish
|
|
40
40
|
</a>
|
|
41
41
|
</li>
|
|
@@ -45,19 +45,19 @@ exports[`AudioSelector > given that audio tracks are available > when button is
|
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
47
|
exports[`AudioSelector > 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">
|
|
48
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color changing" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
49
49
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
50
50
|
</button>
|
|
51
|
-
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
51
|
+
<ul class="gcore-skin-bg-color menu hidden" id="media-control-audiotracks-select" role="menu">
|
|
52
52
|
|
|
53
53
|
<li class="">
|
|
54
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
54
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
55
55
|
English
|
|
56
56
|
</a>
|
|
57
57
|
</li>
|
|
58
58
|
|
|
59
59
|
<li class="">
|
|
60
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
60
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
61
61
|
Spanish
|
|
62
62
|
</a>
|
|
63
63
|
</li>
|
|
@@ -67,19 +67,19 @@ exports[`AudioSelector > given that audio tracks are available > when button is
|
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
69
|
exports[`AudioTracks > given that audio tracks are available > should render menu hidden 1`] = `
|
|
70
|
-
"<button data-audiotracks-button="" class="gcore-skin-button-color" id="audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
70
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
71
71
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
72
72
|
</button>
|
|
73
|
-
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
73
|
+
<ul class="gcore-skin-bg-color menu hidden" id="media-control-audiotracks-select" role="menu">
|
|
74
74
|
|
|
75
75
|
<li class="">
|
|
76
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
76
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
77
77
|
English
|
|
78
78
|
</a>
|
|
79
79
|
</li>
|
|
80
80
|
|
|
81
81
|
<li class="">
|
|
82
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
82
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
83
83
|
Spanish
|
|
84
84
|
</a>
|
|
85
85
|
</li>
|
|
@@ -89,19 +89,19 @@ exports[`AudioTracks > given that audio tracks are available > should render men
|
|
|
89
89
|
`;
|
|
90
90
|
|
|
91
91
|
exports[`AudioTracks > given that audio tracks are available > when button is clicked > should show menu 1`] = `
|
|
92
|
-
"<button data-audiotracks-button="" class="gcore-skin-button-color" id="audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
92
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
93
93
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
94
94
|
</button>
|
|
95
|
-
<ul class="gcore-skin-bg-color menu" id="audiotracks-select" role="menu">
|
|
95
|
+
<ul class="gcore-skin-bg-color menu" id="media-control-audiotracks-select" role="menu">
|
|
96
96
|
|
|
97
97
|
<li class="">
|
|
98
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
98
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
99
99
|
English
|
|
100
100
|
</a>
|
|
101
101
|
</li>
|
|
102
102
|
|
|
103
103
|
<li class="">
|
|
104
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
104
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
105
105
|
Spanish
|
|
106
106
|
</a>
|
|
107
107
|
</li>
|
|
@@ -111,19 +111,19 @@ exports[`AudioTracks > given that audio tracks are available > when button is cl
|
|
|
111
111
|
`;
|
|
112
112
|
|
|
113
113
|
exports[`AudioTracks > given that audio tracks are available > when button is clicked > when audio track is selected > should hide the menu 1`] = `
|
|
114
|
-
"<button data-audiotracks-button="" class="gcore-skin-button-color changing" id="audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
114
|
+
"<button data-gplayer-mc-audiotracks-button="" class="gcore-skin-button-color changing" id="gplayer-mc-audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
115
115
|
<span class="audio-text"></span> <span class="audio-arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
116
116
|
</button>
|
|
117
|
-
<ul class="gcore-skin-bg-color menu hidden" id="audiotracks-select" role="menu">
|
|
117
|
+
<ul class="gcore-skin-bg-color menu hidden" id="media-control-audiotracks-select" role="menu">
|
|
118
118
|
|
|
119
119
|
<li class="">
|
|
120
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
120
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="1" role="menuitemradio" aria-checked="false">
|
|
121
121
|
English
|
|
122
122
|
</a>
|
|
123
123
|
</li>
|
|
124
124
|
|
|
125
125
|
<li class="">
|
|
126
|
-
<a href="#" class="gcore-skin-text-color" data-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
126
|
+
<a href="#" class="gcore-skin-text-color" data-media-control-audiotracks-select="2" role="menuitemradio" aria-checked="false">
|
|
127
127
|
Spanish
|
|
128
128
|
</a>
|
|
129
129
|
</li>
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`AudioTracks >
|
|
4
|
-
"<button
|
|
5
|
-
<span class="
|
|
3
|
+
exports[`AudioTracks > when audio tracks are available > should render menu 1`] = `
|
|
4
|
+
"<button class="gcore-skin-button-color media-control-dd" id="gplayer-audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
5
|
+
<span class="media-control-dd__text" id="gplayer-audiotracks-button-text"></span>
|
|
6
|
+
<span class="media-control-dd__arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
6
7
|
</button>
|
|
7
|
-
<ul class="gcore-skin-bg-color menu
|
|
8
|
+
<ul class="gcore-skin-bg-color menu media-control-dd__popup" id="gplayer-audiotracks-menu" role="menu" style="display: none;">
|
|
8
9
|
|
|
9
10
|
<li class="">
|
|
10
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
11
|
+
<a href="#" class="gcore-skin-text-color" data-item="1" role="menuitemradio" aria-checked="false">
|
|
11
12
|
English
|
|
12
13
|
</a>
|
|
13
14
|
</li>
|
|
14
15
|
|
|
15
16
|
<li class="">
|
|
16
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
17
|
+
<a href="#" class="gcore-skin-text-color" data-item="2" role="menuitemradio" aria-checked="false">
|
|
17
18
|
Spanish
|
|
18
19
|
</a>
|
|
19
20
|
</li>
|
|
@@ -22,20 +23,21 @@ exports[`AudioTracks > given that audio tracks are available > should render men
|
|
|
22
23
|
"
|
|
23
24
|
`;
|
|
24
25
|
|
|
25
|
-
exports[`AudioTracks >
|
|
26
|
-
"<button
|
|
27
|
-
<span class="
|
|
26
|
+
exports[`AudioTracks > when audio tracks are available > when button is clicked > should show menu 1`] = `
|
|
27
|
+
"<button class="gcore-skin-button-color media-control-dd" id="gplayer-audiotracks-button" aria-haspopup="menu" aria-expanded="true">
|
|
28
|
+
<span class="media-control-dd__text" id="gplayer-audiotracks-button-text"></span>
|
|
29
|
+
<span class="media-control-dd__arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
28
30
|
</button>
|
|
29
|
-
<ul class="gcore-skin-bg-color menu" id="audiotracks-
|
|
31
|
+
<ul class="gcore-skin-bg-color menu media-control-dd__popup" id="gplayer-audiotracks-menu" role="menu">
|
|
30
32
|
|
|
31
33
|
<li class="">
|
|
32
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
34
|
+
<a href="#" class="gcore-skin-text-color" data-item="1" role="menuitemradio" aria-checked="false">
|
|
33
35
|
English
|
|
34
36
|
</a>
|
|
35
37
|
</li>
|
|
36
38
|
|
|
37
39
|
<li class="">
|
|
38
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
40
|
+
<a href="#" class="gcore-skin-text-color" data-item="2" role="menuitemradio" aria-checked="false">
|
|
39
41
|
Spanish
|
|
40
42
|
</a>
|
|
41
43
|
</li>
|
|
@@ -44,20 +46,21 @@ exports[`AudioTracks > given that audio tracks are available > when button is cl
|
|
|
44
46
|
"
|
|
45
47
|
`;
|
|
46
48
|
|
|
47
|
-
exports[`AudioTracks >
|
|
48
|
-
"<button
|
|
49
|
-
<span class="
|
|
49
|
+
exports[`AudioTracks > when audio tracks are available > when button is clicked > when audio track is selected > should hide the menu 1`] = `
|
|
50
|
+
"<button class="gcore-skin-button-color media-control-dd changing" id="gplayer-audiotracks-button" aria-haspopup="menu" aria-expanded="false">
|
|
51
|
+
<span class="media-control-dd__text" id="gplayer-audiotracks-button-text"></span>
|
|
52
|
+
<span class="media-control-dd__arrow">/assets/icons/old/quality-arrow.svg</span>
|
|
50
53
|
</button>
|
|
51
|
-
<ul class="gcore-skin-bg-color menu
|
|
54
|
+
<ul class="gcore-skin-bg-color menu media-control-dd__popup" id="gplayer-audiotracks-menu" role="menu" style="display: none;">
|
|
52
55
|
|
|
53
56
|
<li class="">
|
|
54
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
57
|
+
<a href="#" class="gcore-skin-text-color" data-item="1" role="menuitemradio" aria-checked="false">
|
|
55
58
|
English
|
|
56
59
|
</a>
|
|
57
60
|
</li>
|
|
58
61
|
|
|
59
62
|
<li class="">
|
|
60
|
-
<a href="#" class="gcore-skin-text-color" data-
|
|
63
|
+
<a href="#" class="gcore-skin-text-color" data-item="2" role="menuitemradio" aria-checked="false">
|
|
61
64
|
Spanish
|
|
62
65
|
</a>
|
|
63
66
|
</li>
|
|
@@ -198,7 +198,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
198
198
|
.appendTo(this.$el.find('#gear-options-wrapper'))
|
|
199
199
|
$item.on('click', (e: MouseEvent) => {
|
|
200
200
|
e.stopPropagation()
|
|
201
|
-
this.
|
|
201
|
+
this.clampPopup($subMenu)
|
|
202
202
|
$subMenu.show()
|
|
203
203
|
this.$el.find('#gear-options').hide()
|
|
204
204
|
})
|
|
@@ -323,10 +323,9 @@ export class BottomGear extends UICorePlugin {
|
|
|
323
323
|
mediaControl.slot('gear', this.$el)
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
private
|
|
326
|
+
private clampPopup($subMenu: ZeptoResult) {
|
|
327
327
|
const availableHeight =
|
|
328
|
-
this.core.getPlugin('media_control').
|
|
329
|
-
MENU_VMARGIN * 2
|
|
328
|
+
this.core.getPlugin('media_control').getAvailablePopupHeight()
|
|
330
329
|
$subMenu.css('max-height', `${availableHeight}px`)
|
|
331
330
|
$subMenu
|
|
332
331
|
.find('.gear-sub-menu')
|
|
@@ -110,7 +110,7 @@ describe('BottomGear', () => {
|
|
|
110
110
|
})
|
|
111
111
|
describe('when submenu is open', () => {
|
|
112
112
|
beforeEach(async () => {
|
|
113
|
-
mediaControl.
|
|
113
|
+
mediaControl.getAvailablePopupHeight.mockReturnValue(174)
|
|
114
114
|
bottomGear.$el.find('#gear-button').click()
|
|
115
115
|
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
116
116
|
bottomGear.$el.find('#more-button').click()
|