@gcorevideo/player 2.22.1 → 2.22.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/dist/core.js +1 -1
- package/dist/index.css +1427 -1427
- package/dist/index.js +111 -33
- package/dist/player.d.ts +243 -95
- package/dist/plugins/index.css +350 -350
- package/dist/plugins/index.js +111 -33
- package/docs/api/player.bottomgear.additem.md +95 -0
- package/docs/api/player.bottomgear.md +63 -19
- package/docs/api/player.bottomgear.refresh.md +5 -1
- package/docs/api/player.clapprnerdstats.md +0 -2
- package/docs/api/player.clicktopause.md +1 -1
- package/docs/api/player.closedcaptions.md +2 -2
- package/docs/api/player.closedcaptionspluginsettings.md +5 -0
- package/docs/api/player.errorscreen.md +18 -4
- package/docs/api/player.errorscreenpluginsettings.md +1 -4
- package/docs/api/player.errorscreensettings.md +15 -0
- package/docs/api/{player.mediacontrolevents.md → player.gearevents.md} +7 -7
- package/docs/api/player.levelselector.events.md +0 -1
- package/docs/api/player.levelselector.md +1 -1
- package/docs/api/player.md +33 -36
- package/docs/api/{player.bottomgear.setcontent.md → player.mediacontrol.handlecustomarea.md} +5 -9
- package/docs/api/player.mediacontrol.md +15 -1
- package/docs/api/player.mediacontrol.putelement.md +2 -2
- package/docs/api/player.mediacontrol.toggleelement.md +2 -4
- package/docs/api/player.mediacontrolelement.md +1 -1
- package/docs/api/player.playbackrate.md +22 -3
- package/docs/api/{player.gearoptionsitem.md → player.playbackrateoption.md} +6 -4
- package/docs/api/player.playbackratesettings.md +20 -0
- package/docs/api/player.sourcecontroller._constructor_.md +49 -0
- package/docs/api/player.sourcecontroller.md +70 -7
- package/docs/api/player.spinnerevents.md +1 -4
- package/docs/api/player.spinnerthreebounce._constructor_.md +0 -3
- package/docs/api/player.spinnerthreebounce.hide.md +0 -3
- package/docs/api/player.spinnerthreebounce.md +6 -9
- package/docs/api/player.spinnerthreebounce.show.md +2 -5
- 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/internal.types.d.ts +5 -0
- package/lib/internal.types.d.ts.map +1 -1
- package/lib/playback.types.d.ts +0 -5
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.d.ts +35 -13
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +35 -3
- package/lib/plugins/click-to-pause/ClickToPause.d.ts +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +3 -2
- package/lib/plugins/error-screen/ErrorScreen.d.ts +29 -4
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +17 -2
- package/lib/plugins/media-control/MediaControl.d.ts +0 -11
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +0 -12
- package/lib/plugins/source-controller/SourceController.d.ts +40 -4
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +41 -4
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +9 -6
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +11 -6
- package/lib/plugins/subtitles/ClosedCaptions.d.ts +7 -7
- package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +2 -2
- package/package.json +1 -1
- package/src/index.plugins.ts +1 -0
- package/src/internal.types.ts +6 -0
- package/src/playback.types.ts +0 -5
- package/src/plugins/bottom-gear/BottomGear.ts +35 -16
- package/src/plugins/click-to-pause/ClickToPause.ts +3 -2
- package/src/plugins/error-screen/ErrorScreen.ts +30 -4
- package/src/plugins/media-control/MediaControl.ts +0 -12
- package/src/plugins/source-controller/SourceController.ts +41 -4
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +11 -6
- package/src/plugins/subtitles/ClosedCaptions.ts +8 -9
- package/temp/player.api.json +260 -299
- package/tsconfig.tsbuildinfo +1 -1
- package/assets/bottom-gear/bottomgear copy.ejs +0 -10
- package/docs/api/player.bottomgear.getelement.md +0 -56
- package/docs/api/player.gearitemelement.md +0 -18
- package/docs/api/player.subtitlespluginsettings.md +0 -18
- package/docs/api/player.texttrackitem.id.md +0 -11
- package/docs/api/player.texttrackitem.md +0 -87
- package/docs/api/player.texttrackitem.name.md +0 -11
- package/docs/api/player.texttrackitem.track.md +0 -11
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { UICorePlugin } from '@clappr/core';
|
|
2
2
|
import '../../../assets/subtitles/style.scss';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the {@link ClosedCaptions} plugin.
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
3
7
|
export type ClosedCaptionsPluginSettings = {
|
|
4
8
|
/**
|
|
5
|
-
* Initially selected subtitles language
|
|
9
|
+
* Initially selected subtitles language.
|
|
6
10
|
*/
|
|
7
11
|
language?: string;
|
|
8
12
|
};
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use {@link ClosedCaptionsPluginSettings} instead.
|
|
11
|
-
*/
|
|
12
|
-
export type SubtitlesPluginSettings = ClosedCaptionsPluginSettings;
|
|
13
13
|
/**
|
|
14
14
|
* `PLUGIN` that provides a UI to select the subtitles when available.
|
|
15
15
|
* @beta
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
|
-
* The plugin is activated when closed captions tracks are
|
|
18
|
+
* The plugin is activated when closed captions tracks are detected in the media source.
|
|
19
19
|
* It shows a familiar "CC" button with a dropdown menu to select the subtitles language.
|
|
20
20
|
*
|
|
21
21
|
* Depends on:
|
|
@@ -32,7 +32,7 @@ export type SubtitlesPluginSettings = ClosedCaptionsPluginSettings;
|
|
|
32
32
|
* new Player({
|
|
33
33
|
* ...
|
|
34
34
|
* cc: {
|
|
35
|
-
* language: '
|
|
35
|
+
* language: 'pt-BR',
|
|
36
36
|
* },
|
|
37
37
|
* })
|
|
38
38
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClosedCaptions.d.ts","sourceRoot":"","sources":["../../../src/plugins/subtitles/ClosedCaptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAwB,MAAM,cAAc,CAAA;AAOzE,OAAO,sCAAsC,CAAA;AAe7C,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"ClosedCaptions.d.ts","sourceRoot":"","sources":["../../../src/plugins/subtitles/ClosedCaptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAwB,MAAM,cAAc,CAAA;AAOzE,OAAO,sCAAsC,CAAA;AAe7C;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,KAAK,CAA6B;IAE1C,OAAO,CAAC,MAAM,CAAsB;IAEpC,OAAO,CAAC,KAAK,CAA2B;IAExC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAE7D;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;;MAKlB;IAED,OAAO,KAAK,mBAAmB,GAE9B;IAED;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,IAAI;IAWJ;;OAEG;IACH,IAAI;IAiBJ,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACM,MAAM;IA0Bf,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,UAAU;CAKnB"}
|
|
@@ -16,7 +16,7 @@ const T = 'plugins.cc';
|
|
|
16
16
|
* @beta
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
* The plugin is activated when closed captions tracks are
|
|
19
|
+
* The plugin is activated when closed captions tracks are detected in the media source.
|
|
20
20
|
* It shows a familiar "CC" button with a dropdown menu to select the subtitles language.
|
|
21
21
|
*
|
|
22
22
|
* Depends on:
|
|
@@ -33,7 +33,7 @@ const T = 'plugins.cc';
|
|
|
33
33
|
* new Player({
|
|
34
34
|
* ...
|
|
35
35
|
* cc: {
|
|
36
|
-
* language: '
|
|
36
|
+
* language: 'pt-BR',
|
|
37
37
|
* },
|
|
38
38
|
* })
|
|
39
39
|
* ```
|
package/package.json
CHANGED
package/src/index.plugins.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./plugins/seek-time/SeekTime.js";
|
|
|
24
24
|
export * from "./plugins/share/Share.js";
|
|
25
25
|
export * from "./plugins/skip-time/SkipTime.js";
|
|
26
26
|
export * from "./plugins/spinner-three-bounce/SpinnerThreeBounce.js";
|
|
27
|
+
export { SpinnerThreeBounce as Spinner } from "./plugins/spinner-three-bounce/SpinnerThreeBounce.js";
|
|
27
28
|
export * from "./plugins/source-controller/SourceController.js";
|
|
28
29
|
export * from "./plugins/subtitles/ClosedCaptions.js";
|
|
29
30
|
export { ClosedCaptions as Subtitles } from "./plugins/subtitles/ClosedCaptions.js"; // TODO remove in future versions
|
package/src/internal.types.ts
CHANGED
package/src/playback.types.ts
CHANGED
|
@@ -10,35 +10,30 @@ import '../../../assets/bottom-gear/gear-sub-menu.scss'
|
|
|
10
10
|
import gearIcon from '../../../assets/icons/new/gear.svg'
|
|
11
11
|
import gearHdIcon from '../../../assets/icons/new/gear-hd.svg'
|
|
12
12
|
import { ZeptoResult } from '../../types.js'
|
|
13
|
-
import { MediaControlEvents } from '../media-control/MediaControl'
|
|
14
13
|
|
|
15
14
|
const VERSION = '2.19.12'
|
|
16
15
|
|
|
17
16
|
const T = 'plugins.bottom_gear'
|
|
18
17
|
|
|
19
|
-
export enum GearEvents {
|
|
20
|
-
RENDERED = 'rendered',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/**
|
|
24
|
-
*
|
|
19
|
+
* Events triggered by the plugin
|
|
25
20
|
* @beta
|
|
26
|
-
* @deprecated
|
|
27
|
-
*/
|
|
28
|
-
export type GearOptionsItem = 'quality' | 'rate' | 'nerd'
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use {@link GearOptionsItem} instead
|
|
32
21
|
*/
|
|
33
|
-
export
|
|
22
|
+
export enum GearEvents {
|
|
23
|
+
/**
|
|
24
|
+
* Use this event to accurately attach an item to the gear menu
|
|
25
|
+
*/
|
|
26
|
+
RENDERED = 'rendered',
|
|
27
|
+
}
|
|
34
28
|
|
|
35
29
|
// TODO disabled if no items added
|
|
36
30
|
|
|
37
31
|
/**
|
|
38
|
-
* `PLUGIN` that adds
|
|
32
|
+
* `PLUGIN` that adds a button to extend the media controls UI with extra options.
|
|
39
33
|
* @beta
|
|
40
34
|
* @remarks
|
|
41
|
-
* The
|
|
35
|
+
* The plugin renders small gear icon to the right of the media controls.
|
|
36
|
+
* It provides a base for attaching custom settings UI in the gear menu
|
|
42
37
|
*
|
|
43
38
|
* Depends on:
|
|
44
39
|
*
|
|
@@ -157,6 +152,28 @@ export class BottomGear extends UICorePlugin {
|
|
|
157
152
|
)
|
|
158
153
|
}
|
|
159
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Adds a custom option to the gear menu
|
|
157
|
+
* @param name - A unique name of the option
|
|
158
|
+
* @param $subMenu - The submenu to attach to the option
|
|
159
|
+
* @returns The added item placeholder to attach custom markup
|
|
160
|
+
* @remarks
|
|
161
|
+
* When called with $submenu param, a click on the added item will toggle the submenu visibility.
|
|
162
|
+
*
|
|
163
|
+
* When added without submenu, it's responsibility of the caller to handle the click event however needed.
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* class MyPlugin extends UICorePlugin {
|
|
167
|
+
* override render() {
|
|
168
|
+
* this.$el.html('<div class="my-awesome-settings">...</div>')
|
|
169
|
+
* this.core.getPlugin('bottom_gear')
|
|
170
|
+
* ?.addItem('custom', this.$el)
|
|
171
|
+
* .html($('<button>Custom settings</button>'))
|
|
172
|
+
* return this
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
160
177
|
addItem(name: string, $subMenu?: ZeptoResult): ZeptoResult {
|
|
161
178
|
const $existingItem = this.$el.find(`#gear-options li[data-${name}`)
|
|
162
179
|
if ($existingItem.length) {
|
|
@@ -228,7 +245,9 @@ export class BottomGear extends UICorePlugin {
|
|
|
228
245
|
}
|
|
229
246
|
|
|
230
247
|
/**
|
|
231
|
-
* Collapses any submenu open back to the gear menu
|
|
248
|
+
* Collapses any submenu open back to the gear menu.
|
|
249
|
+
* @remarks
|
|
250
|
+
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
232
251
|
*/
|
|
233
252
|
refresh() {
|
|
234
253
|
this.$el.find('.gear-sub-menu-wrapper').hide()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
//
|
|
1
|
+
// This work is based on the original work of the following authors:
|
|
2
|
+
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
3
|
// Use of this source code is governed by a BSD-style
|
|
3
4
|
// license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE.
|
|
4
5
|
|
|
@@ -12,7 +13,7 @@ type Timer = ReturnType<typeof setTimeout>
|
|
|
12
13
|
const T = 'plugins.click_to_pause_custom'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* `PLUGIN` that
|
|
16
|
+
* A small `PLUGIN` that toggles the playback state on click over the video container
|
|
16
17
|
* @beta
|
|
17
18
|
*/
|
|
18
19
|
export class ClickToPause extends ContainerPlugin {
|
|
@@ -16,8 +16,19 @@ type ErrorScreenDesc = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
19
|
+
* Settings for the {@link ErrorScreen} plugin.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export type ErrorScreenSettings = {
|
|
23
|
+
/**
|
|
24
|
+
* Whether to hide the reload button. The reload button triggers reload of the current source.
|
|
25
|
+
*/
|
|
26
|
+
noReload?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for the {@link ErrorScreen} plugin.
|
|
31
|
+
* @public
|
|
21
32
|
*/
|
|
22
33
|
export type ErrorScreenPluginSettings = {
|
|
23
34
|
/**
|
|
@@ -29,8 +40,23 @@ export type ErrorScreenPluginSettings = {
|
|
|
29
40
|
const T = 'plugins.error_screen'
|
|
30
41
|
|
|
31
42
|
/**
|
|
32
|
-
* `PLUGIN` that displays errors nicely in the overlay on top of the player.
|
|
33
|
-
* @
|
|
43
|
+
* `PLUGIN` that displays fatal errors nicely in the overlay on top of the player.
|
|
44
|
+
* @public
|
|
45
|
+
* @remarks
|
|
46
|
+
* A fatal error is an error that prevents the player from playing the content.
|
|
47
|
+
* It's usually a network error that persists after multiple retries.
|
|
48
|
+
*
|
|
49
|
+
* The error screen should not be confused with the content stub that is shown when no media sources are available.
|
|
50
|
+
* This can happen due to the lack of the support of the given sources type or because the sources are misconfigured (e.g., omitted).
|
|
51
|
+
*
|
|
52
|
+
* Configuration options - {@link ErrorScreenPluginSettings}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { ErrorScreen, Player } from '@gcorevideo/player'
|
|
57
|
+
*
|
|
58
|
+
* Player.registerPlugin(ErrorScreen)
|
|
59
|
+
* ```
|
|
34
60
|
*/
|
|
35
61
|
export class ErrorScreen extends UICorePlugin {
|
|
36
62
|
private err: ErrorScreenDesc | null = null
|
|
@@ -80,18 +80,6 @@ const DEFAULT_SETTINGS: MediaControlSettings = {
|
|
|
80
80
|
seekEnabled: true,
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Custom events emitted by the plugins to communicate with one another
|
|
85
|
-
* @beta
|
|
86
|
-
* @deprecated
|
|
87
|
-
*/
|
|
88
|
-
export enum MediaControlEvents {
|
|
89
|
-
/**
|
|
90
|
-
* Emitted when the gear menu is rendered
|
|
91
|
-
*/
|
|
92
|
-
MEDIACONTROL_GEAR_RENDERED = 'mediacontrol:gear:rendered',
|
|
93
|
-
}
|
|
94
|
-
|
|
95
83
|
const T = 'plugins.media_control'
|
|
96
84
|
|
|
97
85
|
const LEFT_ORDER = [
|
|
@@ -27,11 +27,47 @@ function noSync(cb: () => void) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* `PLUGIN` that is
|
|
31
|
-
* @
|
|
30
|
+
* `PLUGIN` that is managing the automatic failover between media sources.
|
|
31
|
+
* @public
|
|
32
32
|
* @remarks
|
|
33
33
|
* Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details
|
|
34
|
-
* on how sources ordering and selection works.
|
|
34
|
+
* on how sources ordering and selection works. Below is a simplified diagram:
|
|
35
|
+
*
|
|
36
|
+
* ```markdown
|
|
37
|
+
* sources_list:
|
|
38
|
+
* - a.mpd | +--------------------+
|
|
39
|
+
* - b.m3u8 |--->| init |
|
|
40
|
+
* - ... | |--------------------|
|
|
41
|
+
* | current_source = 0 |
|
|
42
|
+
* +--------------------+
|
|
43
|
+
* |
|
|
44
|
+
* | source = a.mpd
|
|
45
|
+
* | playback = dash.js
|
|
46
|
+
* v
|
|
47
|
+
* +------------------+
|
|
48
|
+
* +-->| load source |
|
|
49
|
+
* | +---------|--------+
|
|
50
|
+
* | v
|
|
51
|
+
* | +------------------+
|
|
52
|
+
* | | play |
|
|
53
|
+
* | +---------|--------+
|
|
54
|
+
* | |
|
|
55
|
+
* | v
|
|
56
|
+
* | +-----------------------+
|
|
57
|
+
* | | on playback_error |
|
|
58
|
+
* | |-----------------------|
|
|
59
|
+
* | | current_source = |
|
|
60
|
+
* | | (current_source + 1) |
|
|
61
|
+
* | | % len sources_list |
|
|
62
|
+
* | | |
|
|
63
|
+
* | | delay 1..3s |
|
|
64
|
+
* | +---------------|-------+
|
|
65
|
+
* | |
|
|
66
|
+
* | source=b.m3u8 |
|
|
67
|
+
* | playback=hls.js |
|
|
68
|
+
* +-------------------+
|
|
69
|
+
*
|
|
70
|
+
* ```
|
|
35
71
|
*
|
|
36
72
|
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
37
73
|
* It is supposed to work autonomously.
|
|
@@ -81,6 +117,7 @@ export class SourceController extends CorePlugin {
|
|
|
81
117
|
* | playback=hls.js |
|
|
82
118
|
* +-------------------+
|
|
83
119
|
*
|
|
120
|
+
* As can be seen from the diagram, the plugin will endless try to load the next sources rotating between them in round-robin manner.
|
|
84
121
|
*/
|
|
85
122
|
private sourcesList: PlayerMediaSourceDesc[] = []
|
|
86
123
|
|
|
@@ -109,7 +146,7 @@ export class SourceController extends CorePlugin {
|
|
|
109
146
|
}
|
|
110
147
|
|
|
111
148
|
/**
|
|
112
|
-
* @
|
|
149
|
+
* @param core - The Clappr core instance.
|
|
113
150
|
*/
|
|
114
151
|
constructor(core: ClapprCore) {
|
|
115
152
|
super(core)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// This work is based on the original work of Globo.com
|
|
1
2
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
3
|
// Use of this source code is governed by a BSD-style
|
|
3
4
|
// license that can be found in the LICENSE file.
|
|
5
|
+
// https://github.com/clappr/clappr-plugins/blob/ffaa9d27005fa5a8a7c243ffc47eb5655b84b371/LICENSE
|
|
4
6
|
|
|
5
7
|
import {
|
|
6
8
|
Container,
|
|
@@ -20,21 +22,22 @@ const T = 'plugins.spinner'
|
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Custom events emitted by the plugin
|
|
23
|
-
* @
|
|
25
|
+
* @public
|
|
24
26
|
*/
|
|
25
27
|
export enum SpinnerEvents {
|
|
26
28
|
/**
|
|
27
29
|
* Emitted at the end of the spinner animation cycle to facilitate smooth UI updates,
|
|
28
|
-
*
|
|
30
|
+
* for instance, {@link SourceController} listens to this event to reload the source when the spinner is hidden
|
|
29
31
|
*/
|
|
30
32
|
SYNC = 'plugins:spinner:sync',
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
* `PLUGIN` that shows a pending operation indicator when playback is buffering or in a similar state
|
|
35
|
-
* @
|
|
36
|
+
* `PLUGIN` that shows a pending operation indicator when playback is buffering or in a similar state.
|
|
37
|
+
* @public
|
|
36
38
|
* @remarks
|
|
37
|
-
*
|
|
39
|
+
* It is aliased as `Spinner` for convenience.
|
|
40
|
+
* Events emitted - {@link SpinnerEvents}
|
|
38
41
|
* Other plugins can use {@link SpinnerThreeBounce.show | show} and {@link SpinnerThreeBounce.hide | hide} methods to
|
|
39
42
|
* implement custom pending/progress indication scenarios.
|
|
40
43
|
*/
|
|
@@ -129,7 +132,9 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
129
132
|
/**
|
|
130
133
|
* Shows the spinner.
|
|
131
134
|
*
|
|
132
|
-
*
|
|
135
|
+
* The method call prevents spinner's built-in logic from automatically hiding it until {@link SpinnerThreeBounce.hide} is called
|
|
136
|
+
*
|
|
137
|
+
* @param delay - The delay in milliseconds before the spinner is shown.
|
|
133
138
|
*/
|
|
134
139
|
show(delay = 300) {
|
|
135
140
|
trace(`${T} show`)
|
|
@@ -3,7 +3,7 @@ import { reportError, trace } from '@gcorevideo/utils'
|
|
|
3
3
|
import assert from 'assert'
|
|
4
4
|
|
|
5
5
|
import { CLAPPR_VERSION } from '../../build.js'
|
|
6
|
-
import type { TextTrackItem } from '../../
|
|
6
|
+
import type { TextTrackItem } from '../../internal.types.js'
|
|
7
7
|
|
|
8
8
|
import '../../../assets/subtitles/style.scss'
|
|
9
9
|
import subtitlesOffIcon from '../../../assets/icons/new/subtitles-off.svg'
|
|
@@ -20,24 +20,23 @@ const LOCAL_STORAGE_CC_ID = 'gplayer.plugins.cc.selected'
|
|
|
20
20
|
|
|
21
21
|
const T = 'plugins.cc'
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the {@link ClosedCaptions} plugin.
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
23
27
|
export type ClosedCaptionsPluginSettings = {
|
|
24
28
|
/**
|
|
25
|
-
* Initially selected subtitles language
|
|
29
|
+
* Initially selected subtitles language.
|
|
26
30
|
*/
|
|
27
31
|
language?: string
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use {@link ClosedCaptionsPluginSettings} instead.
|
|
32
|
-
*/
|
|
33
|
-
export type SubtitlesPluginSettings = ClosedCaptionsPluginSettings;
|
|
34
|
-
|
|
35
34
|
/**
|
|
36
35
|
* `PLUGIN` that provides a UI to select the subtitles when available.
|
|
37
36
|
* @beta
|
|
38
37
|
*
|
|
39
38
|
* @remarks
|
|
40
|
-
* The plugin is activated when closed captions tracks are
|
|
39
|
+
* The plugin is activated when closed captions tracks are detected in the media source.
|
|
41
40
|
* It shows a familiar "CC" button with a dropdown menu to select the subtitles language.
|
|
42
41
|
*
|
|
43
42
|
* Depends on:
|
|
@@ -54,7 +53,7 @@ export type SubtitlesPluginSettings = ClosedCaptionsPluginSettings;
|
|
|
54
53
|
* new Player({
|
|
55
54
|
* ...
|
|
56
55
|
* cc: {
|
|
57
|
-
* language: '
|
|
56
|
+
* language: 'pt-BR',
|
|
58
57
|
* },
|
|
59
58
|
* })
|
|
60
59
|
* ```
|