@gcorevideo/player 2.20.22 → 2.21.3
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-selector/style.scss +48 -82
- package/assets/audio-selector/track-selector.ejs +3 -3
- package/assets/bottom-gear/bottomgear.ejs +10 -12
- package/assets/bottom-gear/gear-sub-menu.scss +0 -15
- package/assets/bottom-gear/gear.scss +3 -32
- package/assets/media-control/media-control.ejs +5 -25
- package/assets/media-control/media-control.scss +114 -34
- package/assets/media-control/width370.scss +35 -109
- package/assets/picture-in-picture/button.ejs +1 -1
- package/assets/picture-in-picture/button.scss +5 -4
- package/assets/subtitles/combobox.ejs +7 -9
- package/assets/subtitles/style.scss +8 -15
- package/dist/core.js +151 -23
- package/dist/index.css +897 -1000
- package/dist/index.js +416 -438
- package/dist/player.d.ts +19 -16
- package/dist/plugins/index.css +1454 -1557
- package/dist/plugins/index.js +826 -23550
- package/docs/api/player.audioselector.md +4 -59
- package/docs/api/player.md +1 -1
- package/docs/api/player.mediacontrol.getelement.md +5 -0
- package/docs/api/player.mediacontrol.md +14 -0
- package/docs/api/{player.audioselector.updatecurrenttrack.md → player.mediacontrol.putelement.md} +7 -7
- package/docs/api/player.mediacontrolelement.md +1 -1
- package/docs/api/{player.audioselector.starttrackswitch.md → player.pictureinpicture.attributes.md} +5 -7
- package/docs/api/player.pictureinpicture.md +45 -0
- package/lib/playback/BasePlayback.d.ts +1 -1
- package/lib/playback/BasePlayback.d.ts.map +1 -1
- package/lib/playback/BasePlayback.js +3 -1
- package/lib/playback/HTML5Video.d.ts +4 -0
- package/lib/playback/HTML5Video.d.ts.map +1 -1
- package/lib/playback/HTML5Video.js +53 -4
- package/lib/playback/dash-playback/DashPlayback.d.ts +5 -0
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +48 -4
- package/lib/playback/hls-playback/HlsPlayback.d.ts +31 -25
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +47 -14
- package/lib/playback.types.d.ts +5 -0
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioSelector.d.ts +12 -11
- package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioSelector.js +65 -185
- package/lib/plugins/bottom-gear/BottomGear.d.ts +2 -2
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +12 -10
- package/lib/plugins/level-selector/LevelSelector.js +1 -1
- package/lib/plugins/media-control/MediaControl.d.ts +3 -4
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +23 -13
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +3 -0
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -1
- package/lib/plugins/picture-in-picture/PictureInPicture.js +6 -1
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +1 -0
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +1 -0
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +0 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +0 -2
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +1 -18
- package/lib/plugins/subtitles/Subtitles.d.ts +21 -19
- package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -1
- package/lib/plugins/subtitles/Subtitles.js +121 -151
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +2 -0
- package/package.json +1 -1
- package/src/playback/BasePlayback.ts +4 -1
- package/src/playback/HTML5Video.ts +57 -4
- package/src/playback/dash-playback/DashPlayback.ts +64 -6
- package/src/playback/hls-playback/HlsPlayback.ts +82 -40
- package/src/playback.types.ts +6 -0
- package/src/plugins/audio-selector/AudioSelector.ts +84 -278
- package/src/plugins/bottom-gear/BottomGear.ts +14 -11
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +1 -3
- package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +14 -37
- package/src/plugins/level-selector/LevelSelector.ts +1 -1
- package/src/plugins/media-control/MediaControl.ts +54 -32
- package/src/plugins/picture-in-picture/PictureInPicture.ts +7 -1
- package/src/plugins/playback-rate/PlaybackRate.ts +1 -0
- package/src/plugins/source-controller/SourceController.ts +0 -1
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +1 -20
- package/src/plugins/subtitles/Subtitles.ts +144 -179
- package/src/testUtils.ts +2 -0
- package/src/typings/globals.d.ts +19 -0
- package/temp/player.api.json +102 -143
- package/tsconfig.tsbuildinfo +1 -1
- package/assets/media-control/plugins.scss +0 -94
- package/docs/api/player.audioselector.highlightcurrenttrack.md +0 -18
|
@@ -27,7 +27,6 @@ import { ZeptoResult } from '../../types.js'
|
|
|
27
27
|
import { getPageX, isFullscreen } from '../utils.js'
|
|
28
28
|
|
|
29
29
|
import '../../../assets/media-control/media-control.scss'
|
|
30
|
-
import '../../../assets/media-control/plugins.scss'
|
|
31
30
|
|
|
32
31
|
import mediaControlHTML from '../../../assets/media-control/media-control.ejs'
|
|
33
32
|
import playIcon from '../../../assets/icons/new/play.svg'
|
|
@@ -44,7 +43,6 @@ import fullscreenOnIcon from '../../../assets/icons/new/fullscreen-on.svg'
|
|
|
44
43
|
*/
|
|
45
44
|
export type MediaControlElement =
|
|
46
45
|
| 'audioTracksSelector'
|
|
47
|
-
| 'bottomGear' // an alias of gear
|
|
48
46
|
| 'clipText'
|
|
49
47
|
| 'gear'
|
|
50
48
|
| 'pip'
|
|
@@ -143,8 +141,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
143
141
|
|
|
144
142
|
private $audioTracksSelector: ZeptoResult | null = null
|
|
145
143
|
|
|
146
|
-
private $bottomGear: ZeptoResult | null = null
|
|
147
|
-
|
|
148
144
|
private $clipText: ZeptoResult | null = null
|
|
149
145
|
|
|
150
146
|
private $clipTextContainer: ZeptoResult | null = null
|
|
@@ -175,8 +171,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
175
171
|
|
|
176
172
|
private $seekBarScrubber: ZeptoResult | null = null
|
|
177
173
|
|
|
178
|
-
private $subtitlesSelector: ZeptoResult | null = null
|
|
179
|
-
|
|
180
174
|
private $volumeBarContainer: ZeptoResult | null = null
|
|
181
175
|
|
|
182
176
|
private $volumeBarBackground: ZeptoResult | null = null
|
|
@@ -207,7 +201,8 @@ export class MediaControl extends UICorePlugin {
|
|
|
207
201
|
|
|
208
202
|
private get disabled() {
|
|
209
203
|
const playbackIsNOOP =
|
|
210
|
-
this.core.activeContainer &&
|
|
204
|
+
this.core.activeContainer &&
|
|
205
|
+
this.core.activeContainer.getPlaybackType() === Playback.NO_OP
|
|
211
206
|
|
|
212
207
|
return this.userDisabled || playbackIsNOOP
|
|
213
208
|
}
|
|
@@ -300,9 +295,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
300
295
|
this.bindKeyEvents()
|
|
301
296
|
|
|
302
297
|
this.userDisabled = false
|
|
303
|
-
if (
|
|
304
|
-
this.options.chromeless
|
|
305
|
-
) {
|
|
298
|
+
if (this.options.chromeless) {
|
|
306
299
|
this.disable()
|
|
307
300
|
}
|
|
308
301
|
|
|
@@ -368,9 +361,21 @@ export class MediaControl extends UICorePlugin {
|
|
|
368
361
|
}
|
|
369
362
|
|
|
370
363
|
private bindContainerEvents() {
|
|
371
|
-
this.listenTo(
|
|
372
|
-
|
|
373
|
-
|
|
364
|
+
this.listenTo(
|
|
365
|
+
this.core.activeContainer,
|
|
366
|
+
Events.CONTAINER_PLAY,
|
|
367
|
+
this.changeTogglePlay,
|
|
368
|
+
)
|
|
369
|
+
this.listenTo(
|
|
370
|
+
this.core.activeContainer,
|
|
371
|
+
Events.CONTAINER_PAUSE,
|
|
372
|
+
this.changeTogglePlay,
|
|
373
|
+
)
|
|
374
|
+
this.listenTo(
|
|
375
|
+
this.core.activeContainer,
|
|
376
|
+
Events.CONTAINER_STOP,
|
|
377
|
+
this.changeTogglePlay,
|
|
378
|
+
)
|
|
374
379
|
this.listenTo(
|
|
375
380
|
this.core.activeContainer,
|
|
376
381
|
Events.CONTAINER_DBLCLICK,
|
|
@@ -412,7 +417,11 @@ export class MediaControl extends UICorePlugin {
|
|
|
412
417
|
this.enable,
|
|
413
418
|
)
|
|
414
419
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_ENDED, this.ended)
|
|
415
|
-
this.listenTo(
|
|
420
|
+
this.listenTo(
|
|
421
|
+
this.core.activeContainer,
|
|
422
|
+
Events.CONTAINER_VOLUME,
|
|
423
|
+
this.onVolumeChanged,
|
|
424
|
+
)
|
|
416
425
|
this.listenTo(
|
|
417
426
|
this.core.activeContainer,
|
|
418
427
|
Events.CONTAINER_OPTIONS_CHANGE,
|
|
@@ -981,11 +990,15 @@ export class MediaControl extends UICorePlugin {
|
|
|
981
990
|
}
|
|
982
991
|
|
|
983
992
|
private settingsUpdate() {
|
|
984
|
-
const newSettings = $.extend(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
993
|
+
const newSettings = $.extend(
|
|
994
|
+
true,
|
|
995
|
+
{
|
|
996
|
+
left: [],
|
|
997
|
+
default: [],
|
|
998
|
+
right: [],
|
|
999
|
+
},
|
|
1000
|
+
this.core.activeContainer?.settings,
|
|
1001
|
+
)
|
|
989
1002
|
|
|
990
1003
|
newSettings.left = orderByOrderPattern(
|
|
991
1004
|
[...newSettings.left, 'clipsText', 'volume'],
|
|
@@ -1059,14 +1072,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
1059
1072
|
this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]')
|
|
1060
1073
|
this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]')
|
|
1061
1074
|
this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]')
|
|
1062
|
-
this.$bottomGear = this.$el.find('.media-control-bottomgear')
|
|
1063
|
-
this.$pip = this.$el.find('.media-control-pip')
|
|
1064
|
-
this.$audioTracksSelector = this.$el.find(
|
|
1065
|
-
'.media-control-audio-tracks[data-audiotracks]',
|
|
1066
|
-
)
|
|
1067
|
-
this.$subtitlesSelector = this.$el.find(
|
|
1068
|
-
'.media-control-subtitles[data-subtitles]',
|
|
1069
|
-
)
|
|
1070
1075
|
this.$playbackRate = this.$el.find(
|
|
1071
1076
|
'.media-control-playbackrate[data-playbackrate]',
|
|
1072
1077
|
)
|
|
@@ -1086,6 +1091,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
1086
1091
|
* Get a media control element DOM node
|
|
1087
1092
|
* @param name - The name of the media control element
|
|
1088
1093
|
* @returns The DOM node to render to or extend
|
|
1094
|
+
* @deprecated Use {@link MediaControl.putElement} instead
|
|
1089
1095
|
* @remarks
|
|
1090
1096
|
* Use this method to render custom media control UI in a plugin
|
|
1091
1097
|
* @example
|
|
@@ -1103,20 +1109,36 @@ export class MediaControl extends UICorePlugin {
|
|
|
1103
1109
|
getElement(name: MediaControlElement): ZeptoResult | null {
|
|
1104
1110
|
switch (name) {
|
|
1105
1111
|
case 'audioTracksSelector':
|
|
1106
|
-
return
|
|
1112
|
+
return null
|
|
1107
1113
|
case 'clipText':
|
|
1108
1114
|
return this.$clipText
|
|
1109
|
-
case 'bottomGear':
|
|
1110
1115
|
case 'gear':
|
|
1111
|
-
return
|
|
1116
|
+
return null
|
|
1112
1117
|
case 'pip':
|
|
1113
|
-
return
|
|
1118
|
+
return null
|
|
1114
1119
|
case 'playbackRate':
|
|
1115
1120
|
return this.$playbackRate
|
|
1116
1121
|
case 'seekBarContainer':
|
|
1117
1122
|
return this.$seekBarContainer
|
|
1118
1123
|
case 'subtitlesSelector':
|
|
1119
|
-
return
|
|
1124
|
+
return null
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
putElement(name: MediaControlElement, element: ZeptoResult) {
|
|
1129
|
+
switch (name) {
|
|
1130
|
+
case 'audioTracksSelector':
|
|
1131
|
+
this.getRightPanel().append(element)
|
|
1132
|
+
break
|
|
1133
|
+
case 'gear':
|
|
1134
|
+
this.getRightPanel().append(element)
|
|
1135
|
+
break
|
|
1136
|
+
case 'pip':
|
|
1137
|
+
this.getRightPanel().append(element)
|
|
1138
|
+
break
|
|
1139
|
+
case 'subtitlesSelector':
|
|
1140
|
+
this.getRightPanel().append(element)
|
|
1141
|
+
break
|
|
1120
1142
|
}
|
|
1121
1143
|
}
|
|
1122
1144
|
|
|
@@ -52,6 +52,12 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
override get attributes() {
|
|
56
|
+
return {
|
|
57
|
+
'class': 'media-control-pip',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
55
61
|
private get videoElement() {
|
|
56
62
|
return this.core.activePlayback.el;
|
|
57
63
|
}
|
|
@@ -86,7 +92,7 @@ export class PictureInPicture extends UICorePlugin {
|
|
|
86
92
|
|
|
87
93
|
const mediaControl = this.core.getPlugin('media_control');
|
|
88
94
|
if (mediaControl) {
|
|
89
|
-
mediaControl.
|
|
95
|
+
mediaControl.putElement('pip', this.el);
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
return this;
|
|
@@ -46,6 +46,7 @@ const T = 'plugins.playback_rate';
|
|
|
46
46
|
* - {@link BottomGear | bottom_gear}
|
|
47
47
|
*
|
|
48
48
|
* It renders a button in the gear menu, which opens a dropdown with the options to change the playback rate.
|
|
49
|
+
* Note that the playback rate change is supported only for VOD or DVR enabled live streams.
|
|
49
50
|
*/
|
|
50
51
|
export class PlaybackRate extends UICorePlugin {
|
|
51
52
|
private playbackRates: PlaybackRateOption[] = DEFAULT_PLAYBACK_RATES;
|
|
@@ -139,7 +139,6 @@ export class SourceController extends CorePlugin {
|
|
|
139
139
|
private onCoreReady() {
|
|
140
140
|
trace(`${T} onCoreReady`)
|
|
141
141
|
this.core.getPlugin('error_screen')?.disable() // TODO test
|
|
142
|
-
// this.core.getPlugin('spinner')?.showOnError()
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
private onActiveContainerChanged() {
|
|
@@ -73,8 +73,6 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
73
73
|
|
|
74
74
|
private hasBuffering = false
|
|
75
75
|
|
|
76
|
-
private _showOnError = false
|
|
77
|
-
|
|
78
76
|
constructor(container: Container) {
|
|
79
77
|
super(container)
|
|
80
78
|
this.listenTo(
|
|
@@ -94,10 +92,6 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
94
92
|
this.listenTo(this.container, ClapprEvents.CONTAINER_READY, this.render)
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
public showOnError() {
|
|
98
|
-
this._showOnError = true
|
|
99
|
-
}
|
|
100
|
-
|
|
101
95
|
private onBuffering() {
|
|
102
96
|
this.hasBuffering = true
|
|
103
97
|
this._show()
|
|
@@ -117,12 +111,8 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
117
111
|
|
|
118
112
|
private onStop() {
|
|
119
113
|
trace(`${T} onStop`, {
|
|
120
|
-
showOnError: this._showOnError,
|
|
121
114
|
hasFatalError: this.hasFatalError,
|
|
122
115
|
})
|
|
123
|
-
// if (!(this.hasFatalError && this._showOnError)) {
|
|
124
|
-
// this._hide()
|
|
125
|
-
// }
|
|
126
116
|
this._hide()
|
|
127
117
|
}
|
|
128
118
|
|
|
@@ -130,15 +120,9 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
130
120
|
this.hasFatalError = e.code === PlaybackErrorCode.MediaSourceUnavailable
|
|
131
121
|
trace(`${T} onError`, {
|
|
132
122
|
e,
|
|
133
|
-
showOnError: this._showOnError,
|
|
134
123
|
hasFatalError: this.hasFatalError,
|
|
135
124
|
error: e.code,
|
|
136
125
|
})
|
|
137
|
-
// if (this._showOnError) {
|
|
138
|
-
// this._show()
|
|
139
|
-
// } else {
|
|
140
|
-
// this._hide()
|
|
141
|
-
// }
|
|
142
126
|
this._hide()
|
|
143
127
|
}
|
|
144
128
|
|
|
@@ -189,18 +173,15 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
189
173
|
* @internal
|
|
190
174
|
*/
|
|
191
175
|
override render() {
|
|
192
|
-
// TODO control via sourcecontroller instead
|
|
193
|
-
const showOnStart = this.options.spinner?.showOnStart
|
|
194
176
|
trace(`${T} render`, {
|
|
195
177
|
buffering: this.container.buffering,
|
|
196
|
-
showOnStart,
|
|
197
178
|
})
|
|
198
179
|
this.$el.html(this.template())
|
|
199
180
|
this.el.firstElementChild?.addEventListener('animationiteration', () => {
|
|
200
181
|
this.trigger(SpinnerEvents.SYNC)
|
|
201
182
|
})
|
|
202
183
|
this.container.$el.append(this.$el[0])
|
|
203
|
-
if (
|
|
184
|
+
if (this.container.buffering) {
|
|
204
185
|
this._show()
|
|
205
186
|
} else {
|
|
206
187
|
this._hide()
|