@gcorevideo/player 2.23.2 → 2.24.0
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/dist/core.js +1 -1
- package/dist/index.css +747 -747
- package/dist/index.js +149 -18
- package/dist/player.d.ts +6 -3
- package/lib/index.plugins.d.ts +1 -0
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +1 -0
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.js +3 -2
- 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 +15 -8
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts +45 -0
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts.map +1 -0
- package/lib/plugins/cmcd-config/CmcdConfig.js +114 -0
- package/lib/plugins/cmcd-config/utils.d.ts +3 -0
- package/lib/plugins/cmcd-config/utils.d.ts.map +1 -0
- package/lib/plugins/cmcd-config/utils.js +12 -0
- package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -1
- package/lib/plugins/thumbnails/Thumbnails.js +3 -6
- package/lib/testUtils.d.ts +5 -1
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +6 -2
- package/package.json +1 -1
- package/src/index.plugins.ts +1 -0
- package/src/plugins/big-mute-button/BigMuteButton.ts +3 -2
- package/src/plugins/bottom-gear/BottomGear.ts +17 -14
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +51 -14
- package/src/plugins/cmcd-config/CmcdConfig.ts +148 -0
- package/src/plugins/cmcd-config/__tests__/CmcdConfig.test.ts +162 -0
- package/src/plugins/cmcd-config/utils.ts +13 -0
- package/src/plugins/media-control/__tests__/MediaControl.test.ts +4 -3
- package/src/plugins/thumbnails/Thumbnails.ts +3 -6
- package/src/plugins/thumbnails/__tests__/Thumbnails.test.ts +20 -3
- package/src/plugins/thumbnails/__tests__/__snapshots__/Thumbnails.test.ts.snap +1 -1
- package/src/testUtils.ts +6 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -261,11 +261,9 @@ export class Thumbnails extends UICorePlugin {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
private onMouseMoveSeekbar(_: MouseEvent, pos: number) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.update()
|
|
268
|
-
}
|
|
264
|
+
this.hoverPosition = pos
|
|
265
|
+
this.showing = true
|
|
266
|
+
this.update()
|
|
269
267
|
}
|
|
270
268
|
|
|
271
269
|
private onMouseLeave() {
|
|
@@ -415,7 +413,6 @@ export class Thumbnails extends UICorePlugin {
|
|
|
415
413
|
const thumbIndex = this.getThumbIndexForTime(hoverTime)
|
|
416
414
|
const thumb = this.thumbs[thumbIndex]
|
|
417
415
|
|
|
418
|
-
// update thumbnail
|
|
419
416
|
const $spotlight = this.$el.find('#thumbnails-spotlight')
|
|
420
417
|
|
|
421
418
|
this.buildThumbImage(
|
|
@@ -8,7 +8,7 @@ import { createMockCore, createMockMediaControl } from '../../../testUtils'
|
|
|
8
8
|
import { Thumbnails } from '../Thumbnails'
|
|
9
9
|
import { loadImageDimensions } from '../utils'
|
|
10
10
|
|
|
11
|
-
import { Logger, LogTracer, setTracer } from '@gcorevideo/utils'
|
|
11
|
+
// import { Logger, LogTracer, setTracer } from '@gcorevideo/utils'
|
|
12
12
|
|
|
13
13
|
// Logger.enable('*')
|
|
14
14
|
// setTracer(new LogTracer('Thumbnails.test'))
|
|
@@ -30,11 +30,11 @@ describe('Thumbnails', () => {
|
|
|
30
30
|
vtt: `
|
|
31
31
|
1
|
|
32
32
|
00:00:00.000 --> 00:00:01.000
|
|
33
|
-
sprite.png#xywh=
|
|
33
|
+
sprite.png#xywh=0,0,100,100
|
|
34
34
|
|
|
35
35
|
2
|
|
36
36
|
00:00:01.000 --> 00:00:02.000
|
|
37
|
-
sprite.png#xywh=
|
|
37
|
+
sprite.png#xywh=100,0,100,100
|
|
38
38
|
`,
|
|
39
39
|
},
|
|
40
40
|
})
|
|
@@ -69,4 +69,21 @@ sprite.png#xywh=200,200,100,100
|
|
|
69
69
|
expect(thumbnails.$el.hasClass('hidden')).toBe(true)
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
|
+
describe('update', () => {
|
|
73
|
+
describe('when mouse pointer is over the scrubber', () => {
|
|
74
|
+
beforeEach(async () => {
|
|
75
|
+
core.emit(Events.CORE_READY)
|
|
76
|
+
await new Promise(resolve => setTimeout(resolve, 1))
|
|
77
|
+
mediaControl.container.getDuration.mockReturnValue(5)
|
|
78
|
+
vi.spyOn(thumbnails.$el, 'width').mockReturnValue(300)
|
|
79
|
+
mediaControl.trigger(Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, {}, 0.5)
|
|
80
|
+
})
|
|
81
|
+
it('should show thumbnails', () => {
|
|
82
|
+
expect(thumbnails.$el.hasClass('hidden')).toBe(false)
|
|
83
|
+
})
|
|
84
|
+
it('should show the matching spotlight thumbnail', () => {
|
|
85
|
+
expect(thumbnails.$el.find('#thumbnails-spotlight .thumbnail-container').css('background-position')).toBe('-100px 0px')
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
})
|
|
72
89
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Thumbnails > loading > should render 1`] = `
|
|
4
4
|
"<div class="thumbnails-text" id="thumbnails-text"></div>
|
|
5
5
|
<div class="backdrop" id="thumbnails-backdrop" style="height: 100px;">
|
|
6
|
-
<div class="carousel" id="thumbnails-carousel"><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position:
|
|
6
|
+
<div class="carousel" id="thumbnails-carousel"><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position: 0px 0px;"></div><div class="thumbnail-container" style="width: 100px; height: 100px; background-image: url("https://example.com/sprite.png"); background-size: 600px 900px; background-position: -100px 0px;"></div></div>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="spotlight" id="thumbnails-spotlight" style="height: 100px;"></div>
|
|
9
9
|
"
|
package/src/testUtils.ts
CHANGED
|
@@ -41,7 +41,7 @@ export function createSpinnerPlugin() {
|
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export function createMockPlayback(name = 'mock') {
|
|
44
|
+
export function createMockPlayback(name = 'mock', options: Record<string, unknown> = {}) {
|
|
45
45
|
const emitter = new Events()
|
|
46
46
|
return Object.assign(emitter, {
|
|
47
47
|
name,
|
|
@@ -51,6 +51,7 @@ export function createMockPlayback(name = 'mock') {
|
|
|
51
51
|
dvrInUse: false,
|
|
52
52
|
isAudioOnly: false,
|
|
53
53
|
levels: [],
|
|
54
|
+
options: { ...options },
|
|
54
55
|
consent: vi.fn(),
|
|
55
56
|
play: vi.fn(),
|
|
56
57
|
pause: vi.fn(),
|
|
@@ -80,7 +81,7 @@ export function createMockPlayback(name = 'mock') {
|
|
|
80
81
|
|
|
81
82
|
export function createMockContainer(
|
|
82
83
|
options: Record<string, unknown> = {},
|
|
83
|
-
playback: any = createMockPlayback(),
|
|
84
|
+
playback: any = createMockPlayback('html5_video', options),
|
|
84
85
|
) {
|
|
85
86
|
const el = playback.el
|
|
86
87
|
const emitter = new Events()
|
|
@@ -98,6 +99,7 @@ export function createMockContainer(
|
|
|
98
99
|
getDuration: vi.fn().mockReturnValue(0),
|
|
99
100
|
getPlugin: vi.fn(),
|
|
100
101
|
getPlaybackType: vi.fn(),
|
|
102
|
+
getStartTimeOffset: vi.fn().mockReturnValue(0),
|
|
101
103
|
isDvrInUse: vi.fn().mockReturnValue(false),
|
|
102
104
|
isDvrEnabled: vi.fn().mockReturnValue(false),
|
|
103
105
|
isHighDefinitionInUse: vi.fn().mockReturnValue(false),
|
|
@@ -121,6 +123,8 @@ export function createMockMediaControl(core: any) {
|
|
|
121
123
|
// @ts-ignore
|
|
122
124
|
mediaControl.mount = vi.fn()
|
|
123
125
|
// @ts-ignore
|
|
126
|
+
mediaControl.container = core.activeContainer
|
|
127
|
+
// @ts-ignore
|
|
124
128
|
mediaControl.toggleElement = vi.fn()
|
|
125
129
|
vi.spyOn(mediaControl, 'trigger')
|
|
126
130
|
core.$el.append(mediaControl.$el)
|