@gcorevideo/player 2.20.3 → 2.20.5
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/error-screen/error_screen.ejs +3 -1
- package/dist/core.js +436 -210
- package/dist/index.css +1223 -1223
- package/dist/index.js +580 -392
- package/dist/player.d.ts +10 -0
- package/dist/plugins/index.css +754 -754
- package/dist/plugins/index.js +122 -163
- package/docs/api/player.contextmenupluginsettings.label.md +3 -0
- package/docs/api/player.contextmenupluginsettings.md +8 -3
- package/docs/api/player.contextmenupluginsettings.preventshowcontextmenu.md +3 -0
- package/docs/api/player.contextmenupluginsettings.url.md +3 -0
- package/docs/api/player.md +6 -2
- package/docs/api/player.multicamera._constructor_.md +3 -0
- package/docs/api/player.multicamera.activebyid.md +3 -0
- package/docs/api/player.multicamera.attributes.md +3 -0
- package/docs/api/player.multicamera.bindevents.md +3 -0
- package/docs/api/player.multicamera.events.md +3 -0
- package/docs/api/player.multicamera.getcameraslist.md +3 -0
- package/docs/api/player.multicamera.getcurrentcamera.md +3 -0
- package/docs/api/player.multicamera.md +28 -1
- package/docs/api/player.multicamera.name.md +3 -0
- package/docs/api/player.multicamera.render.md +3 -0
- package/docs/api/player.multicamera.supportedversion.md +3 -0
- package/docs/api/player.multicamera.template.md +3 -0
- package/docs/api/player.multicamera.unbindevents.md +3 -0
- package/docs/api/player.multicamera.version.md +3 -0
- package/docs/api/player.volumefadeevents.md +7 -0
- package/docs/api/player.zeptoresult.md +1 -0
- package/lib/Player.d.ts +5 -3
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +32 -8
- package/lib/internal.types.d.ts +7 -7
- package/lib/internal.types.d.ts.map +1 -1
- package/lib/playback/BasePlayback.d.ts +11 -0
- package/lib/playback/BasePlayback.d.ts.map +1 -0
- package/lib/playback/BasePlayback.js +33 -0
- package/lib/playback/dash-playback/DashPlayback.d.ts +3 -2
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +7 -7
- package/lib/playback/hls-playback/HlsPlayback.d.ts +2 -2
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +8 -5
- package/lib/playback/utils.d.ts +2 -0
- package/lib/playback/utils.d.ts.map +1 -0
- package/lib/playback/utils.js +1 -0
- package/lib/playback.types.d.ts +10 -3
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/playback.types.js +3 -3
- package/lib/plugins/context-menu/ContextMenu.d.ts +4 -0
- package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -1
- package/lib/plugins/context-menu/ContextMenu.js +1 -2
- package/lib/plugins/error-screen/ErrorScreen.d.ts +39 -24
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +70 -136
- package/lib/plugins/media-control/MediaControl.d.ts +1 -1
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +7 -5
- package/lib/plugins/multi-camera/MultiCamera.d.ts +1 -0
- package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -1
- package/lib/plugins/multi-camera/MultiCamera.js +5 -5
- package/lib/plugins/poster/Poster.js +1 -1
- package/lib/plugins/seek-time/SeekTime.js +1 -1
- package/lib/plugins/share/Share.js +1 -1
- package/lib/plugins/source-controller/SourceController.d.ts +2 -1
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +12 -6
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +2 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +19 -3
- package/lib/plugins/volume-fade/VolumeFade.d.ts +4 -0
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +4 -0
- package/lib/testUtils.d.ts +66 -2
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +95 -2
- package/lib/types.d.ts +9 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/types.d.ts +1 -0
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/release_notes +297 -0
- package/src/Player.ts +103 -48
- package/src/__tests__/Player.test.ts +25 -4
- package/src/internal.types.ts +86 -79
- package/src/playback/BasePlayback.ts +41 -0
- package/src/playback/dash-playback/DashPlayback.ts +11 -15
- package/src/playback/hls-playback/HlsPlayback.ts +7 -5
- package/src/playback/utils.ts +2 -0
- package/src/playback.types.ts +11 -3
- package/src/plugins/context-menu/ContextMenu.ts +5 -2
- package/src/plugins/error-screen/ErrorScreen.ts +121 -195
- package/src/plugins/error-screen/__tests__/ErrorScreen.test.ts +113 -0
- package/src/plugins/error-screen/__tests__/__snapshots__/ErrorScreen.test.ts.snap +20 -0
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +32 -57
- package/src/plugins/media-control/MediaControl.ts +8 -5
- package/src/plugins/multi-camera/MultiCamera.ts +5 -5
- package/src/plugins/poster/Poster.ts +1 -1
- package/src/plugins/seek-time/SeekTime.ts +1 -1
- package/src/plugins/share/Share.ts +1 -1
- package/src/plugins/source-controller/SourceController.ts +20 -14
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +29 -46
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +20 -3
- package/src/plugins/volume-fade/VolumeFade.ts +4 -0
- package/src/testUtils.ts +100 -3
- package/src/types.ts +11 -1
- package/src/utils/types.ts +1 -0
- package/temp/player.api.json +24 -24
- package/tsconfig.tsbuildinfo +1 -1
package/src/internal.types.ts
CHANGED
|
@@ -2,22 +2,29 @@ import type {
|
|
|
2
2
|
CorePlugin,
|
|
3
3
|
ContainerPlugin,
|
|
4
4
|
Playback as ClapprPlayback,
|
|
5
|
-
} from
|
|
5
|
+
} from '@clappr/core'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
ContainerSize,
|
|
9
|
+
PlaybackType,
|
|
10
|
+
PlayerDebugTag,
|
|
11
|
+
PlayerMediaSource,
|
|
12
|
+
type CorePluginConstructor,
|
|
13
|
+
type ContainerPluginConstructor,
|
|
14
|
+
} from './types'
|
|
15
|
+
import { PlaybackError } from './playback.types.js'
|
|
9
16
|
|
|
10
17
|
type ExternalTrack = {
|
|
11
|
-
kind?:
|
|
12
|
-
src: string
|
|
13
|
-
label: string
|
|
14
|
-
lang: string
|
|
18
|
+
kind?: 'subtitles' | 'captions'
|
|
19
|
+
src: string
|
|
20
|
+
label: string
|
|
21
|
+
lang: string
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
type MediacontrolStyles = {
|
|
18
25
|
// TODO
|
|
19
|
-
seekbar?: string
|
|
20
|
-
buttons?: string
|
|
26
|
+
seekbar?: string
|
|
27
|
+
buttons?: string
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
/**
|
|
@@ -25,11 +32,11 @@ type MediacontrolStyles = {
|
|
|
25
32
|
* @beta
|
|
26
33
|
*/
|
|
27
34
|
type HlsjsConfig = {
|
|
28
|
-
debug?: boolean
|
|
29
|
-
startLevel?: number
|
|
30
|
-
} & Record<string, unknown
|
|
35
|
+
debug?: boolean
|
|
36
|
+
startLevel?: number
|
|
37
|
+
} & Record<string, unknown>
|
|
31
38
|
|
|
32
|
-
type ShakaConfig = Record<string, unknown
|
|
39
|
+
type ShakaConfig = Record<string, unknown>
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* @see {@link https://github.com/clappr/clappr-core?tab=readme-ov-file#playback-configuration | the Clappr playback settings}
|
|
@@ -37,25 +44,25 @@ type ShakaConfig = Record<string, unknown>;
|
|
|
37
44
|
*/
|
|
38
45
|
export interface CorePlaybackConfig {
|
|
39
46
|
// audioOnly: boolean;
|
|
40
|
-
disableContextMenu?: boolean
|
|
41
|
-
controls?: boolean
|
|
42
|
-
crossOrigin?: 'anonymous' | 'use-credentials'
|
|
47
|
+
disableContextMenu?: boolean
|
|
48
|
+
controls?: boolean
|
|
49
|
+
crossOrigin?: 'anonymous' | 'use-credentials'
|
|
43
50
|
// enableAutomaticABR?: boolean;
|
|
44
|
-
externalTracks?: ExternalTrack[]
|
|
45
|
-
hlsjsConfig?: HlsjsConfig
|
|
51
|
+
externalTracks?: ExternalTrack[]
|
|
52
|
+
hlsjsConfig?: HlsjsConfig
|
|
46
53
|
// initialBandwidthEstimate?: number;
|
|
47
54
|
// maxBufferLength?: number;
|
|
48
55
|
// maxBackBufferLength?: number;
|
|
49
56
|
// minBufferLength?: number;
|
|
50
|
-
minimumDvrSize?: number
|
|
57
|
+
minimumDvrSize?: number // TODO ?
|
|
51
58
|
// maxAdaptiveBitrate?: number;
|
|
52
59
|
// maxAdaptiveVideoDimensions?: unknown; // TODO
|
|
53
|
-
mute?: boolean
|
|
54
|
-
playInline: boolean
|
|
55
|
-
preload?: 'metadata' | 'auto' | 'none'
|
|
60
|
+
mute?: boolean
|
|
61
|
+
playInline: boolean
|
|
62
|
+
preload?: 'metadata' | 'auto' | 'none'
|
|
56
63
|
// preferredAudioLanguage?: string;
|
|
57
|
-
recycleVideo?: boolean
|
|
58
|
-
shakaConfiguration?: ShakaConfig
|
|
64
|
+
recycleVideo?: boolean
|
|
65
|
+
shakaConfiguration?: ShakaConfig
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
/**
|
|
@@ -63,34 +70,34 @@ export interface CorePlaybackConfig {
|
|
|
63
70
|
*/
|
|
64
71
|
export type CorePlayerEvents = {
|
|
65
72
|
// TODO event arguments types
|
|
66
|
-
onReady?: () => void
|
|
67
|
-
onResize?: (data: ContainerSize) => void
|
|
68
|
-
onPlay?: (metadata: unknown) => void
|
|
69
|
-
onPause?: (metadata: unknown) => void
|
|
70
|
-
onStop?: (metadata: unknown) => void
|
|
71
|
-
onEnded?: () => void
|
|
72
|
-
onSeek?: (currentTime: number) => void
|
|
73
|
-
onError?: (err: PlaybackError) => void
|
|
74
|
-
onTimeUpdate?: (timeProgress: { current: number; total: number }) => void
|
|
75
|
-
onVolumeUpdate?: (value: number) => void
|
|
76
|
-
onSubtitleAvailable?: () => void
|
|
73
|
+
onReady?: () => void
|
|
74
|
+
onResize?: (data: ContainerSize) => void
|
|
75
|
+
onPlay?: (metadata: unknown) => void
|
|
76
|
+
onPause?: (metadata: unknown) => void
|
|
77
|
+
onStop?: (metadata: unknown) => void
|
|
78
|
+
onEnded?: () => void
|
|
79
|
+
onSeek?: (currentTime: number) => void
|
|
80
|
+
onError?: (err: PlaybackError) => void
|
|
81
|
+
onTimeUpdate?: (timeProgress: { current: number; total: number }) => void
|
|
82
|
+
onVolumeUpdate?: (value: number) => void
|
|
83
|
+
onSubtitleAvailable?: () => void
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
/**
|
|
80
87
|
* @internal
|
|
81
88
|
*/
|
|
82
|
-
export type PlaybackPluginFactory = typeof ClapprPlayback
|
|
89
|
+
export type PlaybackPluginFactory = typeof ClapprPlayback
|
|
83
90
|
|
|
84
91
|
/**
|
|
85
92
|
* For the plugin development
|
|
86
93
|
* @internal
|
|
87
94
|
*/
|
|
88
95
|
export type CorePluginOptions = {
|
|
89
|
-
core?:
|
|
90
|
-
container?:
|
|
91
|
-
playback?: PlaybackPluginFactory[]
|
|
92
|
-
loadExternalPluginsFirst?: boolean
|
|
93
|
-
loadExternalPlaybacksFirst?: boolean
|
|
96
|
+
core?: CorePluginConstructor[]
|
|
97
|
+
container?: ContainerPluginConstructor[]
|
|
98
|
+
playback?: PlaybackPluginFactory[]
|
|
99
|
+
loadExternalPluginsFirst?: boolean
|
|
100
|
+
loadExternalPlaybacksFirst?: boolean
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
/**
|
|
@@ -98,41 +105,41 @@ export type CorePluginOptions = {
|
|
|
98
105
|
* @internal
|
|
99
106
|
*/
|
|
100
107
|
export type CoreOptions = {
|
|
101
|
-
actualLiveTime?: boolean
|
|
102
|
-
actualLiveServerTime?: string
|
|
103
|
-
allowUserInteraction?: boolean
|
|
104
|
-
autoPlay?: boolean
|
|
105
|
-
autoSeekFromUrl?: boolean
|
|
106
|
-
chromeless?: boolean
|
|
107
|
-
debug?: PlayerDebugTag | boolean
|
|
108
|
-
disableCanAutoPlay?: boolean
|
|
109
|
-
disableKeyboardShortcuts?: boolean
|
|
110
|
-
disableVideoTagContextMenu?: boolean
|
|
111
|
-
events?: CorePlayerEvents
|
|
112
|
-
exitFullscreenOnEnd?: boolean
|
|
113
|
-
gaAccount?: string
|
|
114
|
-
gaTrackerName?: string
|
|
115
|
-
height?: number
|
|
116
|
-
hideMediaControl?: boolean
|
|
117
|
-
hideVolumeBar?: boolean
|
|
118
|
-
language?: string
|
|
119
|
-
loop?: boolean
|
|
120
|
-
maxBufferLength?: number
|
|
121
|
-
mediacontrol?: MediacontrolStyles
|
|
122
|
-
mimeType?: string
|
|
123
|
-
mute?: boolean
|
|
124
|
-
persistConfig?: boolean
|
|
125
|
-
preload?:
|
|
126
|
-
parentId?: string
|
|
127
|
-
parent?: HTMLElement
|
|
128
|
-
playback?: CorePlaybackConfig
|
|
129
|
-
playbackNotSupportedMessage?: string
|
|
130
|
-
playbackType?: PlaybackType
|
|
131
|
-
plugins?: CorePluginOptions | CorePlugin[]
|
|
132
|
-
poster?: string
|
|
133
|
-
source?: string
|
|
134
|
-
sources?: PlayerMediaSource[]
|
|
135
|
-
watermark?: string
|
|
136
|
-
watermarkLink?: string
|
|
137
|
-
width?: number
|
|
138
|
-
}
|
|
108
|
+
actualLiveTime?: boolean
|
|
109
|
+
actualLiveServerTime?: string
|
|
110
|
+
allowUserInteraction?: boolean
|
|
111
|
+
autoPlay?: boolean
|
|
112
|
+
autoSeekFromUrl?: boolean
|
|
113
|
+
chromeless?: boolean
|
|
114
|
+
debug?: PlayerDebugTag | boolean
|
|
115
|
+
disableCanAutoPlay?: boolean // custom, for reconfiguration
|
|
116
|
+
disableKeyboardShortcuts?: boolean
|
|
117
|
+
disableVideoTagContextMenu?: boolean
|
|
118
|
+
events?: CorePlayerEvents
|
|
119
|
+
exitFullscreenOnEnd?: boolean
|
|
120
|
+
gaAccount?: string
|
|
121
|
+
gaTrackerName?: string
|
|
122
|
+
height?: number
|
|
123
|
+
hideMediaControl?: boolean
|
|
124
|
+
hideVolumeBar?: boolean
|
|
125
|
+
language?: string
|
|
126
|
+
loop?: boolean
|
|
127
|
+
maxBufferLength?: number
|
|
128
|
+
mediacontrol?: MediacontrolStyles
|
|
129
|
+
mimeType?: string
|
|
130
|
+
mute?: boolean
|
|
131
|
+
persistConfig?: boolean
|
|
132
|
+
preload?: 'auto' | 'metadata' | 'none'
|
|
133
|
+
parentId?: string
|
|
134
|
+
parent?: HTMLElement
|
|
135
|
+
playback?: CorePlaybackConfig
|
|
136
|
+
playbackNotSupportedMessage?: string
|
|
137
|
+
playbackType?: PlaybackType
|
|
138
|
+
plugins?: CorePluginOptions | CorePlugin[]
|
|
139
|
+
poster?: string
|
|
140
|
+
source?: string
|
|
141
|
+
sources?: PlayerMediaSource[]
|
|
142
|
+
watermark?: string
|
|
143
|
+
watermarkLink?: string
|
|
144
|
+
width?: number
|
|
145
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ErrorOptions, Events, HTML5Video, PlayerError } from '@clappr/core'
|
|
2
|
+
|
|
3
|
+
import { PlaybackErrorCode } from '../playback.types.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This class adds common behaviors to all playback modules.
|
|
7
|
+
* @internal
|
|
8
|
+
* TODO use custom HTML5Video playback with this layer applied
|
|
9
|
+
*/
|
|
10
|
+
export class BasePlayback extends HTML5Video {
|
|
11
|
+
createError(errorData: any, options?: ErrorOptions) {
|
|
12
|
+
const i18n =
|
|
13
|
+
this.i18n ||
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
(this.core && this.core.i18n) ||
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
(this.container && this.container.i18n)
|
|
18
|
+
|
|
19
|
+
if (
|
|
20
|
+
i18n &&
|
|
21
|
+
!errorData.UI &&
|
|
22
|
+
errorData.code === PlaybackErrorCode.MediaSourceUnavailable
|
|
23
|
+
) {
|
|
24
|
+
const defaultUI = {
|
|
25
|
+
title: i18n.t('no_broadcast'),
|
|
26
|
+
message: '',
|
|
27
|
+
}
|
|
28
|
+
errorData.UI = defaultUI
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (errorData.level === PlayerError.Levels.FATAL) {
|
|
32
|
+
this.trigger(Events.PLAYBACK_MEDIACONTROL_DISABLE)
|
|
33
|
+
}
|
|
34
|
+
return super.createError(errorData, options)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override _onProgress() {
|
|
38
|
+
super._onProgress()
|
|
39
|
+
this.trigger(Events.PLAYBACK_MEDIACONTROL_ENABLE)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -2,15 +2,7 @@
|
|
|
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
|
-
import {
|
|
6
|
-
Events,
|
|
7
|
-
HTML5Video,
|
|
8
|
-
Log,
|
|
9
|
-
Playback,
|
|
10
|
-
PlayerError,
|
|
11
|
-
Utils,
|
|
12
|
-
$,
|
|
13
|
-
} from '@clappr/core'
|
|
5
|
+
import { Events, Log, Playback, PlayerError, Utils, $ } from '@clappr/core'
|
|
14
6
|
import { trace } from '@gcorevideo/utils'
|
|
15
7
|
import assert from 'assert'
|
|
16
8
|
import DASHJS, {
|
|
@@ -32,6 +24,7 @@ import {
|
|
|
32
24
|
TimeValue,
|
|
33
25
|
} from '../../playback.types.js'
|
|
34
26
|
import { isDashSource } from '../../utils/mediaSources.js'
|
|
27
|
+
import { BasePlayback } from '../BasePlayback.js'
|
|
35
28
|
|
|
36
29
|
const AUTO = -1
|
|
37
30
|
|
|
@@ -53,7 +46,7 @@ type LocalTimeCorrelation = {
|
|
|
53
46
|
const T = 'playback.dash'
|
|
54
47
|
|
|
55
48
|
// @ts-expect-error
|
|
56
|
-
export default class DashPlayback extends
|
|
49
|
+
export default class DashPlayback extends BasePlayback {
|
|
57
50
|
_levels: QualityLevel[] | null = null
|
|
58
51
|
|
|
59
52
|
_currentLevel: number | null = null
|
|
@@ -470,11 +463,14 @@ export default class DashPlayback extends HTML5Video {
|
|
|
470
463
|
error: Pick<PlaybackError, 'code' | 'message' | 'description' | 'level'>,
|
|
471
464
|
) {
|
|
472
465
|
trace(`${T} triggerError`, { error })
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
466
|
+
|
|
467
|
+
// this triggers Events.ERROR to be handled by the UI
|
|
468
|
+
this.trigger(
|
|
469
|
+
Events.PLAYBACK_ERROR,
|
|
470
|
+
this.createError(error, {
|
|
471
|
+
useCodePrefix: false,
|
|
472
|
+
}),
|
|
473
|
+
)
|
|
478
474
|
// only reset the dash player in 10ms async, so that the rest of the
|
|
479
475
|
// calling function finishes
|
|
480
476
|
setTimeout(() => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
|
-
// license that can be found
|
|
3
|
+
// license that can be found on https://github.com/clappr/hlsjs-playback/blob/main/LICENSE
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
Events,
|
|
7
|
-
HTML5Video,
|
|
8
7
|
Log,
|
|
9
8
|
Playback,
|
|
10
9
|
PlayerError,
|
|
@@ -37,10 +36,11 @@ import {
|
|
|
37
36
|
import { PlaybackType } from '../../types.js'
|
|
38
37
|
import { isHlsSource } from '../../utils/mediaSources.js'
|
|
39
38
|
import { TimerId } from '../../utils/types.js'
|
|
39
|
+
import { BasePlayback } from '../BasePlayback.js'
|
|
40
40
|
|
|
41
41
|
import { CLAPPR_VERSION } from '../../build.js'
|
|
42
42
|
|
|
43
|
-
const { now
|
|
43
|
+
const { now } = Utils
|
|
44
44
|
|
|
45
45
|
const AUTO = -1
|
|
46
46
|
const DEFAULT_RECOVER_ATTEMPTS = 16
|
|
@@ -78,7 +78,7 @@ type CustomListener = {
|
|
|
78
78
|
type ErrorInfo = Record<string, unknown>
|
|
79
79
|
|
|
80
80
|
// @ts-expect-error
|
|
81
|
-
export default class HlsPlayback extends
|
|
81
|
+
export default class HlsPlayback extends BasePlayback {
|
|
82
82
|
private _ccIsSetup = false
|
|
83
83
|
|
|
84
84
|
private _ccTracksUpdated = false
|
|
@@ -1104,7 +1104,9 @@ export default class HlsPlayback extends HTML5Video {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
private triggerError(error: PlaybackError) {
|
|
1107
|
-
this.trigger(Events.PLAYBACK_ERROR, error
|
|
1107
|
+
this.trigger(Events.PLAYBACK_ERROR, this.createError(error, {
|
|
1108
|
+
useCodePrefix: false,
|
|
1109
|
+
}))
|
|
1108
1110
|
this.stop()
|
|
1109
1111
|
}
|
|
1110
1112
|
}
|
package/src/playback.types.ts
CHANGED
|
@@ -64,15 +64,15 @@ export enum PlaybackErrorCode {
|
|
|
64
64
|
/**
|
|
65
65
|
* An unknown or uncategorised error.
|
|
66
66
|
*/
|
|
67
|
-
Generic =
|
|
67
|
+
Generic = 'GENERIC_ERROR',
|
|
68
68
|
/**
|
|
69
69
|
* The media source is not available. Typically a network error.
|
|
70
70
|
*/
|
|
71
|
-
MediaSourceUnavailable =
|
|
71
|
+
MediaSourceUnavailable = 'MEDIA_SOURCE_UNAVAILABLE',
|
|
72
72
|
/**
|
|
73
73
|
* The media source is not accessible due to some protection policy.
|
|
74
74
|
*/
|
|
75
|
-
MediaSourceAccessDenied =
|
|
75
|
+
MediaSourceAccessDenied = 'MEDIA_SOURCE_ACCESS_DENIED',
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -120,4 +120,12 @@ export interface PlaybackError {
|
|
|
120
120
|
* Component subsystem of the error origin
|
|
121
121
|
*/
|
|
122
122
|
scope: PlayerComponentType
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* UI description of the error.
|
|
126
|
+
*/
|
|
127
|
+
UI?: {
|
|
128
|
+
title: string
|
|
129
|
+
message: string
|
|
130
|
+
}
|
|
123
131
|
}
|
|
@@ -19,6 +19,10 @@ type MenuOption = {
|
|
|
19
19
|
name: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The plugin adds a context menu to the player.
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
22
26
|
export interface ContextMenuPluginSettings {
|
|
23
27
|
label?: string
|
|
24
28
|
url?: string
|
|
@@ -94,7 +98,7 @@ export class ContextMenu extends UIContainerPlugin {
|
|
|
94
98
|
this._url = this.options.contextMenu.url
|
|
95
99
|
}
|
|
96
100
|
this.render()
|
|
97
|
-
this.
|
|
101
|
+
$('body').on('click', this.hideOnBodyClick)
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
/**
|
|
@@ -107,7 +111,6 @@ export class ContextMenu extends UIContainerPlugin {
|
|
|
107
111
|
this.toggleContextMenu,
|
|
108
112
|
)
|
|
109
113
|
this.listenTo(this.container, Events.CONTAINER_CLICK, this.hide)
|
|
110
|
-
$('body').on('click', this.hideOnBodyClick)
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
/**
|