@gcorevideo/player 2.19.7 → 2.19.9
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 +7 -9
- package/dist/index.css +417 -417
- package/dist/index.js +94 -54
- package/dist/player.d.ts +109 -55
- package/dist/plugins/index.css +1529 -1529
- package/dist/plugins/index.js +86 -42
- package/docs/api/player.bigmutebutton.md +0 -14
- package/docs/api/player.levelselector.md +1 -1
- package/docs/api/player.md +24 -9
- package/docs/api/player.mediacontrol._constructor_.md +5 -2
- package/docs/api/player.mediacontrol.attributes.md +3 -0
- package/docs/api/player.mediacontrol.bindcontainerevents.md +3 -0
- package/docs/api/player.mediacontrol.bindevents.md +3 -0
- package/docs/api/player.mediacontrol.container.md +3 -0
- package/docs/api/player.mediacontrol.destroy.md +3 -0
- package/docs/api/player.mediacontrol.disable.md +3 -0
- package/docs/api/player.mediacontrol.disabled.md +3 -0
- package/docs/api/player.mediacontrol.disabledcontrolbutton.md +5 -0
- package/docs/api/player.mediacontrol.enable.md +3 -0
- package/docs/api/player.mediacontrol.enablecontrolbutton.md +5 -0
- package/docs/api/player.mediacontrol.events.md +3 -0
- package/docs/api/player.mediacontrol.getelement.md +11 -2
- package/docs/api/player.mediacontrol.getexternalinterface.md +3 -0
- package/docs/api/player.mediacontrol.md +53 -570
- package/docs/api/player.mediacontrol.muted.md +5 -0
- package/docs/api/player.mediacontrol.name.md +3 -0
- package/docs/api/player.mediacontrol.pause.md +5 -0
- package/docs/api/player.mediacontrol.play.md +5 -0
- package/docs/api/player.mediacontrol.playback.md +3 -0
- package/docs/api/player.mediacontrol.render.md +3 -0
- package/docs/api/player.mediacontrol.setinitialvolume.md +20 -0
- package/docs/api/player.mediacontrol.setmuted.md +3 -0
- package/docs/api/player.mediacontrol.setvolume.md +12 -1
- package/docs/api/player.mediacontrol.stop.md +5 -0
- package/docs/api/player.mediacontrol.supportedversion.md +3 -0
- package/docs/api/player.mediacontrol.volume.md +5 -0
- package/docs/api/{player.bigmutebutton.unbindevents.md → player.mediacontrolelement.md} +4 -7
- package/docs/api/player.subtitles.buttonelement.md +1 -1
- package/docs/api/player.subtitles.levelelement.md +1 -1
- package/docs/api/player.zeptoresult.md +15 -0
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +3 -5
- package/lib/index.core.d.ts +1 -0
- package/lib/index.core.d.ts.map +1 -1
- package/lib/index.core.js +1 -0
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +4 -4
- 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/clips/Clips.d.ts +3 -0
- package/lib/plugins/clips/Clips.d.ts.map +1 -1
- package/lib/plugins/clips/Clips.js +22 -2
- package/lib/plugins/kibo/index.d.ts +3 -0
- package/lib/plugins/kibo/index.d.ts.map +1 -1
- package/lib/plugins/kibo/index.js +3 -0
- package/lib/plugins/media-control/MediaControl.d.ts +95 -54
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +60 -37
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +3 -7
- package/lib/plugins/subtitles/Subtitles.d.ts +1 -1
- package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -1
- package/lib/plugins/vast-ads/roll.d.ts +1 -1
- package/lib/plugins/vast-ads/roll.d.ts.map +1 -1
- package/lib/plugins/vast-ads/rollmanager.d.ts +1 -1
- package/lib/plugins/vast-ads/rollmanager.d.ts.map +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/types.d.ts +6 -0
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Player.ts +3 -5
- package/src/index.core.ts +1 -0
- package/src/playback/hls-playback/HlsPlayback.ts +10 -5
- package/src/plugins/audio-selector/AudioSelector.ts +1 -1
- package/src/plugins/big-mute-button/BigMuteButton.ts +2 -2
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +1 -1
- package/src/plugins/clappr-nerd-stats/speedtest/Speedtest.ts +1 -1
- package/src/plugins/clappr-stats/ClapprStats.ts +1 -1
- package/src/plugins/clips/Clips.ts +29 -3
- package/src/plugins/error-screen/ErrorScreen.ts +1 -1
- package/src/plugins/favicon/Favicon.ts +1 -1
- package/src/plugins/kibo/index.ts +3 -0
- package/src/plugins/level-selector/LevelSelector.ts +1 -1
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +1 -8
- package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +33 -0
- package/src/plugins/logo/Logo.ts +1 -1
- package/src/plugins/media-control/MediaControl.ts +114 -94
- package/src/plugins/multi-camera/MultiCamera.ts +1 -1
- package/src/plugins/playback-rate/PlaybackRate.ts +1 -1
- package/src/plugins/poster/Poster.ts +1 -1
- package/src/plugins/seek-time/SeekTime.ts +1 -1
- package/src/plugins/source-controller/SourceController.ts +4 -8
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +1 -1
- package/src/plugins/subtitles/Subtitles.ts +1 -1
- package/src/plugins/thumbnails/Thumbnails.ts +1 -1
- package/src/plugins/vast-ads/VastAds.ts +1 -1
- package/src/plugins/vast-ads/roll.ts +1 -1
- package/src/plugins/vast-ads/rollmanager.ts +1 -1
- package/src/plugins/volume-fade/VolumeFade.ts +1 -1
- package/src/types.ts +0 -2
- package/src/utils/types.ts +6 -0
- package/temp/player.api.json +587 -2743
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.kibo._constructor_.md +0 -49
- package/docs/api/player.kibo.delegate.md +0 -79
- package/docs/api/player.kibo.down.md +0 -65
- package/docs/api/player.kibo.lastkey.md +0 -51
- package/docs/api/player.kibo.lastmodifiersandkey.md +0 -15
- package/docs/api/player.kibo.md +0 -137
- package/docs/api/player.kibo.off.md +0 -49
- package/docs/api/player.kibo.up.md +0 -65
- package/docs/api/player.mediacontrol.applybuttonstyle.md +0 -49
- package/docs/api/player.mediacontrol.bigplaybutton.md +0 -11
- package/docs/api/player.mediacontrol.bindkeyandshow.md +0 -63
- package/docs/api/player.mediacontrol.bindkeyevents.md +0 -15
- package/docs/api/player.mediacontrol.configure.md +0 -15
- package/docs/api/player.mediacontrol.createcachedelements.md +0 -15
- package/docs/api/player.mediacontrol.drawdurationandposition.md +0 -15
- package/docs/api/player.mediacontrol.ended.md +0 -15
- package/docs/api/player.mediacontrol.getsettings.md +0 -15
- package/docs/api/player.mediacontrol.getvolumefromuievent.md +0 -49
- package/docs/api/player.mediacontrol.hide.md +0 -51
- package/docs/api/player.mediacontrol.hidecontrollads.md +0 -15
- package/docs/api/player.mediacontrol.hidevolumebar.md +0 -51
- package/docs/api/player.mediacontrol.highdefinitionupdate.md +0 -49
- package/docs/api/player.mediacontrol.initializeicons.md +0 -15
- package/docs/api/player.mediacontrol.isseekenabledforhtml5playback.md +0 -15
- package/docs/api/player.mediacontrol.isvisible.md +0 -15
- package/docs/api/player.mediacontrol.onactivecontainerchanged.md +0 -15
- package/docs/api/player.mediacontrol.onfinishad.md +0 -15
- package/docs/api/player.mediacontrol.onstartad.md +0 -15
- package/docs/api/player.mediacontrol.ontimeupdate.md +0 -49
- package/docs/api/player.mediacontrol.parsecolors.md +0 -15
- package/docs/api/player.mediacontrol.renderseekbar.md +0 -15
- package/docs/api/player.mediacontrol.resetindicators.md +0 -15
- package/docs/api/player.mediacontrol.resetkeepvisible.md +0 -15
- package/docs/api/player.mediacontrol.resetuserkeepvisible.md +0 -15
- package/docs/api/player.mediacontrol.seek.md +0 -49
- package/docs/api/player.mediacontrol.seekrelative.md +0 -49
- package/docs/api/player.mediacontrol.setcliptext.md +0 -49
- package/docs/api/player.mediacontrol.setkeepvisible.md +0 -15
- package/docs/api/player.mediacontrol.setseekpercentage.md +0 -49
- package/docs/api/player.mediacontrol.setsvgmask.md +0 -49
- package/docs/api/player.mediacontrol.setuserkeepvisible.md +0 -15
- package/docs/api/player.mediacontrol.show.md +0 -51
- package/docs/api/player.mediacontrol.showvolumebar.md +0 -15
- package/docs/api/player.mediacontrol.startseekdrag.md +0 -49
- package/docs/api/player.mediacontrol.startvolumedrag.md +0 -49
- package/docs/api/player.mediacontrol.stopdrag.md +0 -11
- package/docs/api/player.mediacontrol.template.md +0 -11
- package/docs/api/player.mediacontrol.togglefullscreen.md +0 -15
- package/docs/api/player.mediacontrol.togglemute.md +0 -15
- package/docs/api/player.mediacontrol.toggleplaypause.md +0 -15
- package/docs/api/player.mediacontrol.toggleplaystop.md +0 -15
- package/docs/api/player.mediacontrol.unbindkeyevents.md +0 -15
- package/docs/api/player.mediacontrol.updatecursorstyle.md +0 -49
- package/docs/api/player.mediacontrol.updatedrag.md +0 -11
- package/docs/api/player.mediacontrol.updateprogressbar.md +0 -49
- package/src/plugins/types.ts +0 -7
|
@@ -138,6 +138,39 @@ exports[`LevelSelector > options.restrictResolution > given vertical video forma
|
|
|
138
138
|
<ul class="gear-sub-menu">
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
<li class="level-disabled">
|
|
142
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
143
|
+
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
144
|
+
1080p
|
|
145
|
+
</a>
|
|
146
|
+
</li>
|
|
147
|
+
|
|
148
|
+
<li class="level-disabled">
|
|
149
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="1">
|
|
150
|
+
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
151
|
+
720p
|
|
152
|
+
</a>
|
|
153
|
+
</li>
|
|
154
|
+
|
|
155
|
+
<li class="current">
|
|
156
|
+
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color gcore-skin-active" data-id="0">
|
|
157
|
+
<span class="check-icon">/assets/icons/new/check.svg</span>
|
|
158
|
+
360p
|
|
159
|
+
</a>
|
|
160
|
+
</li>
|
|
161
|
+
|
|
162
|
+
</ul>
|
|
163
|
+
"
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
exports[`LevelSelector > options.restrictResolution > given vertical video format levels > should recognize vertical orientation 2`] = `
|
|
167
|
+
"<button class="gplayer-lite-btn go-back gcore-skin-text-color">
|
|
168
|
+
<span class="arrow-left-icon">/assets/icons/new/arrow-left.svg</span>
|
|
169
|
+
Quality
|
|
170
|
+
</button>
|
|
171
|
+
<ul class="gear-sub-menu">
|
|
172
|
+
|
|
173
|
+
|
|
141
174
|
<li class="level-disabled">
|
|
142
175
|
<a href="#" class="gear-sub-menu_btn gcore-skin-text-color" data-id="2">
|
|
143
176
|
<span class="check-icon">/assets/icons/new/check.svg</span>
|
package/src/plugins/logo/Logo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { UIContainerPlugin, Events, template as t, Container } from '@clappr/cor
|
|
|
2
2
|
|
|
3
3
|
import { CLAPPR_VERSION } from '../build.js';
|
|
4
4
|
import { calculateSize } from './utils/index.js';
|
|
5
|
-
import { ZeptoResult } from '
|
|
5
|
+
import { ZeptoResult } from '../../utils/types.js';
|
|
6
6
|
|
|
7
7
|
import logoHTML from '../../../assets/logo/templates/logo.ejs';
|
|
8
8
|
import '../../../assets/logo/styles/logo.scss';
|
|
@@ -2,28 +2,24 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* The MediaControl is responsible for displaying the Player controls.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
5
|
import assert from 'assert'
|
|
10
6
|
import {
|
|
11
7
|
Events,
|
|
12
8
|
UICorePlugin,
|
|
13
9
|
Browser,
|
|
14
10
|
Playback,
|
|
15
|
-
Player as PlayerClappr,
|
|
16
11
|
Utils,
|
|
17
12
|
template,
|
|
18
13
|
$,
|
|
14
|
+
Core,
|
|
19
15
|
} from '@clappr/core'
|
|
20
|
-
import { type TimeProgress } from '../../playback.types.js'
|
|
21
16
|
import { reportError } from '@gcorevideo/utils';
|
|
17
|
+
import { type TimeProgress } from '../../playback.types.js'
|
|
22
18
|
|
|
23
19
|
import { Kibo } from '../kibo/index.js'
|
|
24
20
|
|
|
25
21
|
import { CLAPPR_VERSION } from '../build.js'
|
|
26
|
-
import {
|
|
22
|
+
import { ZeptoResult } from '../../utils/types.js'
|
|
27
23
|
import { getPageX, isFullscreen } from '../utils.js'
|
|
28
24
|
|
|
29
25
|
import '../../../assets/media-control/media-control.scss'
|
|
@@ -38,10 +34,22 @@ import volumeOffIcon from '../../../assets/icons/new/volume-off.svg'
|
|
|
38
34
|
import fullscreenOffIcon from '../../../assets/icons/new/fullscreen-off.svg'
|
|
39
35
|
import fullscreenOnIcon from '../../../assets/icons/new/fullscreen-on.svg'
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @beta
|
|
39
|
+
*/
|
|
40
|
+
export type MediaControlElement = 'clipText' | 'pip' | 'seekBarContainer'
|
|
42
41
|
|
|
43
42
|
const T = 'plugins.media_control'
|
|
44
43
|
|
|
44
|
+
const LEFT_ORDER = [
|
|
45
|
+
'playpause',
|
|
46
|
+
'playstop',
|
|
47
|
+
'live',
|
|
48
|
+
'volume',
|
|
49
|
+
'position',
|
|
50
|
+
'duration',
|
|
51
|
+
]
|
|
52
|
+
|
|
45
53
|
const { Config, Fullscreen, formatTime, extend, removeArrayItem } = Utils
|
|
46
54
|
|
|
47
55
|
function orderByOrderPattern(arr: string[], order: string[]): string[] {
|
|
@@ -58,6 +66,13 @@ type DisabledClickable = {
|
|
|
58
66
|
pointerEventValue: string
|
|
59
67
|
}
|
|
60
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The MediaControl is responsible for displaying the Player controls.
|
|
71
|
+
* @beta
|
|
72
|
+
* @remarks
|
|
73
|
+
* This plugin provides a foundation for developing a media controls UI via additional plugins.
|
|
74
|
+
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
75
|
+
*/
|
|
61
76
|
export class MediaControl extends UICorePlugin {
|
|
62
77
|
private advertisementPlaying = false
|
|
63
78
|
|
|
@@ -153,6 +168,8 @@ export class MediaControl extends UICorePlugin {
|
|
|
153
168
|
|
|
154
169
|
private $volumeIcon: ZeptoResult | null = null
|
|
155
170
|
|
|
171
|
+
private readonly template = template(mediaControlHTML)
|
|
172
|
+
|
|
156
173
|
get name() {
|
|
157
174
|
return 'media_control'
|
|
158
175
|
}
|
|
@@ -213,21 +230,23 @@ export class MediaControl extends UICorePlugin {
|
|
|
213
230
|
}
|
|
214
231
|
}
|
|
215
232
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Current volume
|
|
235
|
+
*/
|
|
220
236
|
get volume() {
|
|
221
237
|
return this.container && this.container.isReady
|
|
222
238
|
? this.container.volume
|
|
223
239
|
: this.intendedVolume
|
|
224
240
|
}
|
|
225
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Muted state
|
|
244
|
+
*/
|
|
226
245
|
get muted() {
|
|
227
246
|
return this.volume === 0
|
|
228
247
|
}
|
|
229
248
|
|
|
230
|
-
constructor(core:
|
|
249
|
+
constructor(core: Core) {
|
|
231
250
|
super(core)
|
|
232
251
|
this.persistConfig = this.options.persistConfig
|
|
233
252
|
this.setInitialVolume()
|
|
@@ -379,19 +398,31 @@ export class MediaControl extends UICorePlugin {
|
|
|
379
398
|
this.show()
|
|
380
399
|
}
|
|
381
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Start the playback
|
|
403
|
+
*/
|
|
382
404
|
play() {
|
|
383
405
|
this.container && this.container.play()
|
|
384
406
|
}
|
|
385
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Pause the playback
|
|
410
|
+
*/
|
|
386
411
|
pause() {
|
|
387
412
|
this.container && this.container.pause()
|
|
388
413
|
}
|
|
389
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Stop the playback
|
|
417
|
+
*/
|
|
390
418
|
stop() {
|
|
391
419
|
this.container && this.container.stop()
|
|
392
420
|
}
|
|
393
421
|
|
|
394
|
-
|
|
422
|
+
/**
|
|
423
|
+
* Set the initial volume, which is preserved when playback is interrupted by an advertisement
|
|
424
|
+
*/
|
|
425
|
+
setInitialVolume() {
|
|
395
426
|
const initialVolume = this.persistConfig ? Config.restore('volume') : 100
|
|
396
427
|
const options = (this.container && this.container.options) || this.options
|
|
397
428
|
|
|
@@ -549,17 +580,17 @@ export class MediaControl extends UICorePlugin {
|
|
|
549
580
|
}
|
|
550
581
|
}
|
|
551
582
|
|
|
552
|
-
togglePlayPause() {
|
|
583
|
+
private togglePlayPause() {
|
|
553
584
|
this.container.isPlaying() ? this.container.pause() : this.container.play()
|
|
554
585
|
|
|
555
586
|
return false
|
|
556
587
|
}
|
|
557
588
|
|
|
558
|
-
togglePlayStop() {
|
|
589
|
+
private togglePlayStop() {
|
|
559
590
|
this.container.isPlaying() ? this.container.stop() : this.container.play()
|
|
560
591
|
}
|
|
561
592
|
|
|
562
|
-
startSeekDrag(event: MouseEvent) {
|
|
593
|
+
private startSeekDrag(event: MouseEvent) {
|
|
563
594
|
if (!this.settings.seekEnabled) {
|
|
564
595
|
return
|
|
565
596
|
}
|
|
@@ -573,13 +604,13 @@ export class MediaControl extends UICorePlugin {
|
|
|
573
604
|
event && event.preventDefault()
|
|
574
605
|
}
|
|
575
606
|
|
|
576
|
-
startVolumeDrag(event: MouseEvent) {
|
|
607
|
+
private startVolumeDrag(event: MouseEvent) {
|
|
577
608
|
this.draggingVolumeBar = true
|
|
578
609
|
this.$el.addClass('dragging')
|
|
579
610
|
event && event.preventDefault()
|
|
580
611
|
}
|
|
581
612
|
|
|
582
|
-
stopDrag = (event: MouseEvent) => {
|
|
613
|
+
private stopDrag = (event: MouseEvent) => {
|
|
583
614
|
this.draggingSeekBar && this.seek(event)
|
|
584
615
|
this.$el.removeClass('dragging')
|
|
585
616
|
this.$seekBarLoaded?.removeClass('media-control-notransition')
|
|
@@ -589,7 +620,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
589
620
|
this.draggingVolumeBar = false
|
|
590
621
|
}
|
|
591
622
|
|
|
592
|
-
updateDrag = (event: MouseEvent | TouchEvent) => {
|
|
623
|
+
private updateDrag = (event: MouseEvent | TouchEvent) => {
|
|
593
624
|
if (this.draggingSeekBar) {
|
|
594
625
|
event.preventDefault()
|
|
595
626
|
const pageX = MediaControl.getPageX(event)
|
|
@@ -607,7 +638,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
607
638
|
}
|
|
608
639
|
}
|
|
609
640
|
|
|
610
|
-
getVolumeFromUIEvent(event: MouseEvent | TouchEvent) {
|
|
641
|
+
private getVolumeFromUIEvent(event: MouseEvent | TouchEvent) {
|
|
611
642
|
let volumeFromUI = 0
|
|
612
643
|
|
|
613
644
|
assert.ok(this.$volumeBarContainer, 'volume bar container must be present')
|
|
@@ -629,10 +660,17 @@ export class MediaControl extends UICorePlugin {
|
|
|
629
660
|
return volumeFromUI
|
|
630
661
|
}
|
|
631
662
|
|
|
632
|
-
toggleMute() {
|
|
663
|
+
private toggleMute() {
|
|
633
664
|
this.setVolume(this.muted ? 100 : 0)
|
|
634
665
|
}
|
|
635
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Set the volume
|
|
669
|
+
* @param value - The volume value
|
|
670
|
+
* @param isInitialVolume - save as the initial volume
|
|
671
|
+
* @remarks
|
|
672
|
+
* Initial volume can be restored later
|
|
673
|
+
*/
|
|
636
674
|
setVolume(value: number, isInitialVolume = false) {
|
|
637
675
|
value = Math.min(100, Math.max(value, 0))
|
|
638
676
|
// this will hold the intended volume
|
|
@@ -659,7 +697,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
659
697
|
}
|
|
660
698
|
}
|
|
661
699
|
|
|
662
|
-
toggleFullscreen() {
|
|
700
|
+
private toggleFullscreen() {
|
|
663
701
|
if (!Browser.isMobile) {
|
|
664
702
|
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name)
|
|
665
703
|
this.container.fullscreen()
|
|
@@ -668,7 +706,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
668
706
|
}
|
|
669
707
|
}
|
|
670
708
|
|
|
671
|
-
onActiveContainerChanged() {
|
|
709
|
+
private onActiveContainerChanged() {
|
|
672
710
|
this.fullScreenOnVideoTagSupported = null
|
|
673
711
|
this.bindEvents()
|
|
674
712
|
// set the new container to match the volume of the last one
|
|
@@ -702,12 +740,12 @@ export class MediaControl extends UICorePlugin {
|
|
|
702
740
|
seekTimePlugin?.$el.find('span').addClass('gcore-skin-text-color')
|
|
703
741
|
}
|
|
704
742
|
|
|
705
|
-
showVolumeBar() {
|
|
743
|
+
private showVolumeBar() {
|
|
706
744
|
this.hideVolumeId && clearTimeout(this.hideVolumeId)
|
|
707
745
|
this.$volumeBarContainer?.removeClass('volume-bar-hide')
|
|
708
746
|
}
|
|
709
747
|
|
|
710
|
-
hideVolumeBar(timeout = 400) {
|
|
748
|
+
private hideVolumeBar(timeout = 400) {
|
|
711
749
|
if (!this.$volumeBarContainer) {
|
|
712
750
|
return
|
|
713
751
|
}
|
|
@@ -722,11 +760,11 @@ export class MediaControl extends UICorePlugin {
|
|
|
722
760
|
}
|
|
723
761
|
}
|
|
724
762
|
|
|
725
|
-
ended() {
|
|
763
|
+
private ended() {
|
|
726
764
|
this.changeTogglePlay()
|
|
727
765
|
}
|
|
728
766
|
|
|
729
|
-
updateProgressBar(progress: TimeProgress) {
|
|
767
|
+
private updateProgressBar(progress: TimeProgress) {
|
|
730
768
|
const loadedStart = (progress.start / progress.total) * 100
|
|
731
769
|
const loadedEnd = (progress.current / progress.total) * 100
|
|
732
770
|
|
|
@@ -736,7 +774,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
736
774
|
})
|
|
737
775
|
}
|
|
738
776
|
|
|
739
|
-
onTimeUpdate(timeProgress: TimeProgress) {
|
|
777
|
+
private onTimeUpdate(timeProgress: TimeProgress) {
|
|
740
778
|
if (this.draggingSeekBar) {
|
|
741
779
|
return
|
|
742
780
|
}
|
|
@@ -752,7 +790,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
752
790
|
}
|
|
753
791
|
}
|
|
754
792
|
|
|
755
|
-
renderSeekBar() {
|
|
793
|
+
private renderSeekBar() {
|
|
756
794
|
// this will be triggered as soon as these become available
|
|
757
795
|
if (
|
|
758
796
|
this.currentPositionValue === null ||
|
|
@@ -777,7 +815,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
777
815
|
this.drawDurationAndPosition()
|
|
778
816
|
}
|
|
779
817
|
|
|
780
|
-
drawDurationAndPosition() {
|
|
818
|
+
private drawDurationAndPosition() {
|
|
781
819
|
const newPosition = formatTime(this.currentPositionValue)
|
|
782
820
|
const newDuration = formatTime(this.currentDurationValue)
|
|
783
821
|
|
|
@@ -791,7 +829,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
791
829
|
}
|
|
792
830
|
}
|
|
793
831
|
|
|
794
|
-
seek(event: MouseEvent) {
|
|
832
|
+
private seek(event: MouseEvent) {
|
|
795
833
|
if (!this.settings.seekEnabled) {
|
|
796
834
|
return
|
|
797
835
|
}
|
|
@@ -809,27 +847,27 @@ export class MediaControl extends UICorePlugin {
|
|
|
809
847
|
return false
|
|
810
848
|
}
|
|
811
849
|
|
|
812
|
-
setKeepVisible() {
|
|
850
|
+
private setKeepVisible() {
|
|
813
851
|
this.keepVisible = true
|
|
814
852
|
}
|
|
815
853
|
|
|
816
|
-
resetKeepVisible() {
|
|
854
|
+
private resetKeepVisible() {
|
|
817
855
|
this.keepVisible = false
|
|
818
856
|
}
|
|
819
857
|
|
|
820
|
-
setUserKeepVisible() {
|
|
858
|
+
private setUserKeepVisible() {
|
|
821
859
|
this.userKeepVisible = true
|
|
822
860
|
}
|
|
823
861
|
|
|
824
|
-
resetUserKeepVisible() {
|
|
862
|
+
private resetUserKeepVisible() {
|
|
825
863
|
this.userKeepVisible = false
|
|
826
864
|
}
|
|
827
865
|
|
|
828
|
-
isVisible() {
|
|
866
|
+
private isVisible() {
|
|
829
867
|
return !this.$el.hasClass('media-control-hide')
|
|
830
868
|
}
|
|
831
869
|
|
|
832
|
-
show(event?: MouseEvent) {
|
|
870
|
+
private show(event?: MouseEvent) {
|
|
833
871
|
if (this.disabled || this.options.disableControlPanel) {
|
|
834
872
|
return
|
|
835
873
|
}
|
|
@@ -861,7 +899,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
861
899
|
this.updateCursorStyle(showing)
|
|
862
900
|
}
|
|
863
901
|
|
|
864
|
-
hide(delay = 0) {
|
|
902
|
+
private hide(delay = 0) {
|
|
865
903
|
if (!this.isVisible()) {
|
|
866
904
|
return
|
|
867
905
|
}
|
|
@@ -896,7 +934,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
896
934
|
}
|
|
897
935
|
}
|
|
898
936
|
|
|
899
|
-
updateCursorStyle(showing: boolean) {
|
|
937
|
+
private updateCursorStyle(showing: boolean) {
|
|
900
938
|
if (showing) {
|
|
901
939
|
this.core.$el.removeClass('nocursor')
|
|
902
940
|
} else if (this.core.isFullscreen()) {
|
|
@@ -912,15 +950,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
912
950
|
right: [],
|
|
913
951
|
})
|
|
914
952
|
|
|
915
|
-
const LEFT_ORDER = [
|
|
916
|
-
'playpause',
|
|
917
|
-
'playstop',
|
|
918
|
-
'live',
|
|
919
|
-
'volume',
|
|
920
|
-
'position',
|
|
921
|
-
'duration',
|
|
922
|
-
]
|
|
923
|
-
|
|
924
953
|
newSettings.left = orderByOrderPattern(
|
|
925
954
|
[...newSettings.left, 'clipsText', 'volume'],
|
|
926
955
|
LEFT_ORDER,
|
|
@@ -964,16 +993,16 @@ export class MediaControl extends UICorePlugin {
|
|
|
964
993
|
}
|
|
965
994
|
}
|
|
966
995
|
|
|
967
|
-
getSettings() {
|
|
996
|
+
private getSettings() {
|
|
968
997
|
// TODO show live and remove duration/position if live
|
|
969
998
|
return $.extend(true, {}, this.container && this.container.settings)
|
|
970
999
|
}
|
|
971
1000
|
|
|
972
|
-
highDefinitionUpdate(isHD: boolean) {
|
|
1001
|
+
private highDefinitionUpdate(isHD: boolean) {
|
|
973
1002
|
this.isHD = isHD
|
|
974
1003
|
}
|
|
975
1004
|
|
|
976
|
-
createCachedElements() {
|
|
1005
|
+
private createCachedElements() {
|
|
977
1006
|
const $layer = this.$el.find('.media-control-layer')
|
|
978
1007
|
|
|
979
1008
|
this.$duration = $layer.find('.media-control-indicator[data-duration]')
|
|
@@ -1021,15 +1050,23 @@ export class MediaControl extends UICorePlugin {
|
|
|
1021
1050
|
this.initializeIcons()
|
|
1022
1051
|
}
|
|
1023
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* Get a media control element DOM node
|
|
1055
|
+
* @param name - The name of the media control element
|
|
1056
|
+
* @returns The DOM node to render the media control element
|
|
1057
|
+
*/
|
|
1024
1058
|
getElement(name: MediaControlElement): ZeptoResult | null {
|
|
1025
1059
|
switch (name) {
|
|
1060
|
+
case 'clipText':
|
|
1061
|
+
return this.$clipText
|
|
1026
1062
|
case 'pip':
|
|
1027
1063
|
return this.$pip
|
|
1064
|
+
case 'seekBarContainer':
|
|
1065
|
+
return this.$seekBarContainer
|
|
1028
1066
|
}
|
|
1029
|
-
return null
|
|
1030
1067
|
}
|
|
1031
1068
|
|
|
1032
|
-
resetIndicators() {
|
|
1069
|
+
private resetIndicators() {
|
|
1033
1070
|
assert.ok(
|
|
1034
1071
|
this.$duration && this.$position,
|
|
1035
1072
|
'duration and position elements must be present',
|
|
@@ -1038,7 +1075,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1038
1075
|
this.displayedDuration = (this.$duration.text as () => string)()
|
|
1039
1076
|
}
|
|
1040
1077
|
|
|
1041
|
-
initializeIcons() {
|
|
1078
|
+
private initializeIcons() {
|
|
1042
1079
|
const $layer = this.$el.find('.media-control-layer')
|
|
1043
1080
|
|
|
1044
1081
|
$layer.find('button.media-control-button[data-play]').append(playIcon)
|
|
@@ -1050,7 +1087,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1050
1087
|
this.$fullscreenToggle?.append(fullscreenOffIcon)
|
|
1051
1088
|
}
|
|
1052
1089
|
|
|
1053
|
-
setSeekPercentage(value: number) {
|
|
1090
|
+
private setSeekPercentage(value: number) {
|
|
1054
1091
|
value = Math.max(Math.min(value, 100.0), 0)
|
|
1055
1092
|
// not changed since last update
|
|
1056
1093
|
if (this.displayedSeekBarPercentage === value) {
|
|
@@ -1066,7 +1103,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1066
1103
|
this.$seekBarScrubber?.css({ left: `${value}%` })
|
|
1067
1104
|
}
|
|
1068
1105
|
|
|
1069
|
-
seekRelative(delta: number) {
|
|
1106
|
+
private seekRelative(delta: number) {
|
|
1070
1107
|
if (!this.settings.seekEnabled) {
|
|
1071
1108
|
return
|
|
1072
1109
|
}
|
|
@@ -1079,7 +1116,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1079
1116
|
this.container.seekPercentage(position)
|
|
1080
1117
|
}
|
|
1081
1118
|
|
|
1082
|
-
bindKeyAndShow(key: string, callback: () => boolean | undefined) {
|
|
1119
|
+
private bindKeyAndShow(key: string, callback: () => boolean | undefined) {
|
|
1083
1120
|
// TODO or boolean return type
|
|
1084
1121
|
this.kibo.down(key, () => {
|
|
1085
1122
|
this.show()
|
|
@@ -1088,7 +1125,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1088
1125
|
})
|
|
1089
1126
|
}
|
|
1090
1127
|
|
|
1091
|
-
bindKeyEvents() {
|
|
1128
|
+
private bindKeyEvents() {
|
|
1092
1129
|
if (Browser.isMobile || this.options.disableKeyboardShortcuts) {
|
|
1093
1130
|
return
|
|
1094
1131
|
}
|
|
@@ -1134,7 +1171,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1134
1171
|
})
|
|
1135
1172
|
}
|
|
1136
1173
|
|
|
1137
|
-
unbindKeyEvents() {
|
|
1174
|
+
private unbindKeyEvents() {
|
|
1138
1175
|
if (this.kibo) {
|
|
1139
1176
|
this.kibo.off('space')
|
|
1140
1177
|
this.kibo.off('left')
|
|
@@ -1147,7 +1184,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1147
1184
|
}
|
|
1148
1185
|
}
|
|
1149
1186
|
|
|
1150
|
-
parseColors() {
|
|
1187
|
+
private parseColors() {
|
|
1151
1188
|
const design = this.options.design || {}
|
|
1152
1189
|
|
|
1153
1190
|
let variables: string[] = []
|
|
@@ -1184,7 +1221,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1184
1221
|
this.$el.append(`<style>:root {${variables.join('\n')}}</style>`)
|
|
1185
1222
|
}
|
|
1186
1223
|
|
|
1187
|
-
applyButtonStyle(element: ZeptoResult |
|
|
1224
|
+
private applyButtonStyle(element: ZeptoResult | null) {
|
|
1188
1225
|
this.buttonsColor &&
|
|
1189
1226
|
element &&
|
|
1190
1227
|
$(element).find('svg path').css({ fill: this.buttonsColor })
|
|
@@ -1199,7 +1236,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1199
1236
|
return super.destroy()
|
|
1200
1237
|
}
|
|
1201
1238
|
|
|
1202
|
-
configure() {
|
|
1239
|
+
private configure() {
|
|
1203
1240
|
this.advertisementPlaying ? this.disable() : this.enable()
|
|
1204
1241
|
this.trigger(Events.MEDIACONTROL_OPTIONS_CHANGE)
|
|
1205
1242
|
}
|
|
@@ -1272,10 +1309,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
1272
1309
|
return this
|
|
1273
1310
|
}
|
|
1274
1311
|
|
|
1275
|
-
get bigPlayButton() {
|
|
1276
|
-
return playIcon
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
1312
|
private handleFullScreenOnBtn() {
|
|
1280
1313
|
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name)
|
|
1281
1314
|
this.container.fullscreen()
|
|
@@ -1292,24 +1325,20 @@ export class MediaControl extends UICorePlugin {
|
|
|
1292
1325
|
this.resetUserKeepVisible()
|
|
1293
1326
|
}
|
|
1294
1327
|
|
|
1295
|
-
|
|
1328
|
+
// TODO manage by the ads plugin
|
|
1329
|
+
private onStartAd() {
|
|
1296
1330
|
this.advertisementPlaying = true
|
|
1297
1331
|
this.disable()
|
|
1298
1332
|
}
|
|
1299
1333
|
|
|
1300
|
-
|
|
1334
|
+
// TODO manage by the ads plugin
|
|
1335
|
+
private onFinishAd() {
|
|
1301
1336
|
this.advertisementPlaying = false
|
|
1302
1337
|
this.enable()
|
|
1303
1338
|
}
|
|
1304
1339
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
this.$clipTextContainer?.show()
|
|
1308
|
-
this.$clipText.text(`${txt}`)
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
hideControllAds() {
|
|
1340
|
+
// TODO remove
|
|
1341
|
+
private hideControllAds() {
|
|
1313
1342
|
if (
|
|
1314
1343
|
this.container.advertisement &&
|
|
1315
1344
|
this.container.advertisement.type !== 'idle'
|
|
@@ -1318,20 +1347,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1318
1347
|
}
|
|
1319
1348
|
}
|
|
1320
1349
|
|
|
1321
|
-
|
|
1322
|
-
if (this.svgMask) {
|
|
1323
|
-
this.svgMask.remove()
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
if (this.$seekBarContainer?.get(0)) {
|
|
1327
|
-
this.$seekBarContainer.addClass('clips')
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
this.svgMask = $(svg)
|
|
1331
|
-
this.$seekBarContainer?.append(this.svgMask)
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=109212
|
|
1350
|
+
// TODO
|
|
1335
1351
|
setMuted(value: boolean) {
|
|
1336
1352
|
this.container.options.mute = value
|
|
1337
1353
|
}
|
|
@@ -1354,21 +1370,25 @@ export class MediaControl extends UICorePlugin {
|
|
|
1354
1370
|
return 0
|
|
1355
1371
|
}
|
|
1356
1372
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1373
|
+
/**
|
|
1374
|
+
* Enable the control button
|
|
1375
|
+
*/
|
|
1359
1376
|
enableControlButton() {
|
|
1360
1377
|
this.disabledClickableList.forEach((element) => {
|
|
1361
1378
|
element.el.css({ 'pointer-events': element.pointerEventValue })
|
|
1362
1379
|
})
|
|
1363
1380
|
}
|
|
1364
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Disable the control button
|
|
1384
|
+
*/
|
|
1365
1385
|
disabledControlButton() {
|
|
1366
1386
|
this.disabledClickableList.forEach((element) => {
|
|
1367
1387
|
element.el.css({ 'pointer-events': 'none' })
|
|
1368
1388
|
})
|
|
1369
1389
|
}
|
|
1370
1390
|
|
|
1371
|
-
isSeekEnabledForHtml5Playback() {
|
|
1391
|
+
private isSeekEnabledForHtml5Playback() {
|
|
1372
1392
|
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
1373
1393
|
return this.options.dvrEnabled
|
|
1374
1394
|
}
|
|
@@ -9,7 +9,7 @@ import '../../../assets/multi-camera/style.scss';
|
|
|
9
9
|
import streamsIcon from '../../../assets/icons/old/streams.svg';
|
|
10
10
|
import streamsMomentoIcon from '../../../assets/icons/old/language.svg';
|
|
11
11
|
import streamsWhiteNightsIcon from '../../../assets/icons/old/wn.svg';
|
|
12
|
-
import { ZeptoResult } from '
|
|
12
|
+
import { ZeptoResult } from '../../utils/types.js';
|
|
13
13
|
|
|
14
14
|
type MultisourcesMode = 'one_first' | 'only_live' | 'show_all';
|
|
15
15
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Events, UICorePlugin, Playback, template } from '@clappr/core';
|
|
2
2
|
|
|
3
3
|
import { CLAPPR_VERSION } from '../build.js';
|
|
4
|
-
import type { ZeptoResult } from '
|
|
4
|
+
import type { ZeptoResult } from '../../utils/types.js';
|
|
5
5
|
|
|
6
6
|
import pluginHtml from '../../../assets/playback-rate/playback-rate-selector.ejs';
|
|
7
7
|
import buttonHtml from '../../../assets/playback-rate/button.ejs';
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { trace } from '@gcorevideo/utils'
|
|
15
15
|
|
|
16
16
|
import { CLAPPR_VERSION } from '../build.js'
|
|
17
|
-
import type { ZeptoResult } from '
|
|
17
|
+
import type { ZeptoResult } from '../../utils/types.js'
|
|
18
18
|
|
|
19
19
|
import '../../../assets/poster/poster.scss'
|
|
20
20
|
import posterHTML from '../../../assets/poster/poster.ejs'
|
|
@@ -9,7 +9,7 @@ import { CLAPPR_VERSION } from '../build.js';
|
|
|
9
9
|
|
|
10
10
|
import seekTimeHTML from '../../../assets/seek-time/seek-time.html';
|
|
11
11
|
import '../../../assets/seek-time/seek-time.scss';
|
|
12
|
-
import { ZeptoResult } from '
|
|
12
|
+
import { ZeptoResult } from '../../utils/types.js';
|
|
13
13
|
|
|
14
14
|
const { formatTime } = Utils;
|
|
15
15
|
|