@gcorevideo/player 2.24.2 → 2.24.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/big-mute-button/big-mute-button.ejs +2 -2
- package/dist/core.js +2 -2
- package/dist/index.css +418 -418
- package/dist/index.js +135 -112
- package/dist/player.d.ts +76 -30
- package/docs/api/player.bigmutebutton.md +13 -1
- package/docs/api/player.clapprstatssettings.md +51 -4
- package/docs/api/player.clapprstatssettings.runeach.md +16 -0
- package/docs/api/player.clipspluginsettings.md +1 -1
- package/docs/api/player.clipspluginsettings.text.md +1 -1
- package/docs/api/player.cmcdconfig.exportids.md +4 -0
- package/docs/api/player.cmcdconfig.md +19 -105
- package/docs/api/{player.cmcdconfig.version.md → player.cmcdconfigoptions.contentid.md} +5 -3
- package/docs/api/player.cmcdconfigoptions.md +79 -0
- package/docs/api/{player.cmcdconfigpluginsettings.md → player.cmcdconfigoptions.sessionid.md} +4 -6
- package/docs/api/player.extendedevents.md +9 -0
- package/docs/api/player.md +37 -31
- package/docs/api/player.mediacontrol.getavailableheight.md +24 -0
- package/docs/api/player.mediacontrol.md +14 -0
- package/docs/api/{player.cmcdconfig.name.md → player.posterpluginsettings.custom.md} +4 -3
- package/docs/api/player.posterpluginsettings.md +108 -7
- package/docs/api/player.posterpluginsettings.showfornoop.md +16 -0
- package/docs/api/player.posterpluginsettings.showonvideoend.md +16 -0
- package/docs/api/{player.cmcdconfig.bindevents.md → player.posterpluginsettings.url.md} +4 -7
- package/lib/Player.js +1 -1
- package/lib/index.embed.d.ts +30 -0
- package/lib/index.embed.d.ts.map +1 -0
- package/lib/index.embed.js +29 -0
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts +18 -13
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.js +77 -83
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +6 -2
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
- package/lib/plugins/clips/Clips.d.ts +1 -1
- package/lib/plugins/clips/Clips.d.ts.map +1 -1
- package/lib/plugins/clips/Clips.js +2 -1
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts +34 -11
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts.map +1 -1
- package/lib/plugins/cmcd-config/CmcdConfig.js +28 -18
- package/lib/plugins/media-control/MediaControl.d.ts +4 -0
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +6 -1
- package/lib/plugins/poster/Poster.d.ts +7 -3
- package/lib/plugins/poster/Poster.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.d.ts +1 -0
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +22 -9
- package/lib/testUtils.d.ts +1 -0
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +1 -0
- package/package.json +1 -1
- package/src/Player.ts +1 -1
- package/src/index.embed.ts +29 -0
- package/src/plugins/big-mute-button/BigMuteButton.ts +84 -108
- package/src/plugins/big-mute-button/__tests__/BigMuteButton.test.ts +86 -0
- package/src/plugins/big-mute-button/__tests__/__snapshots__/BigMuteButton.test.ts.snap +8 -0
- package/src/plugins/clappr-stats/ClapprStats.ts +5 -1
- package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
- package/src/plugins/clips/Clips.ts +3 -2
- package/src/plugins/cmcd-config/CmcdConfig.ts +33 -27
- package/src/plugins/media-control/MediaControl.ts +6 -1
- package/src/plugins/poster/Poster.ts +6 -2
- package/src/plugins/source-controller/SourceController.ts +27 -9
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +28 -8
- package/src/testUtils.ts +5 -1
- package/temp/player.api.json +229 -154
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.cmcdconfig.supportedversion.md +0 -14
|
@@ -2,15 +2,116 @@
|
|
|
2
2
|
|
|
3
3
|
[Home](./index.md) > [@gcorevideo/player](./player.md) > [PosterPluginSettings](./player.posterpluginsettings.md)
|
|
4
4
|
|
|
5
|
-
## PosterPluginSettings
|
|
5
|
+
## PosterPluginSettings interface
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Config options for the [Poster](./player.poster.md) plugin
|
|
6
11
|
|
|
7
12
|
**Signature:**
|
|
8
13
|
|
|
9
14
|
```typescript
|
|
10
|
-
export
|
|
11
|
-
custom?: string;
|
|
12
|
-
showForNoOp?: boolean;
|
|
13
|
-
url?: string;
|
|
14
|
-
showOnVideoEnd?: boolean;
|
|
15
|
-
};
|
|
15
|
+
export interface PosterPluginSettings
|
|
16
16
|
```
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
<table><thead><tr><th>
|
|
21
|
+
|
|
22
|
+
Property
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th><th>
|
|
26
|
+
|
|
27
|
+
Modifiers
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</th><th>
|
|
31
|
+
|
|
32
|
+
Type
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</th><th>
|
|
36
|
+
|
|
37
|
+
Description
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
</th></tr></thead>
|
|
41
|
+
<tbody><tr><td>
|
|
42
|
+
|
|
43
|
+
[custom?](./player.posterpluginsettings.custom.md)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</td><td>
|
|
50
|
+
|
|
51
|
+
string
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
**_(BETA)_** _(Optional)_ Custom CSS background
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td></tr>
|
|
60
|
+
<tr><td>
|
|
61
|
+
|
|
62
|
+
[showForNoOp?](./player.posterpluginsettings.showfornoop.md)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
</td><td>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
</td><td>
|
|
69
|
+
|
|
70
|
+
boolean
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
</td><td>
|
|
74
|
+
|
|
75
|
+
**_(BETA)_** _(Optional)_ Whether to show the poster image when the playback is noop (i.e., when there is no appropriate video playback engine for current media sources set or the media sources are not set at all)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
</td></tr>
|
|
79
|
+
<tr><td>
|
|
80
|
+
|
|
81
|
+
[showOnVideoEnd?](./player.posterpluginsettings.showonvideoend.md)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
</td><td>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</td><td>
|
|
88
|
+
|
|
89
|
+
boolean
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</td><td>
|
|
93
|
+
|
|
94
|
+
**_(BETA)_** _(Optional)_ Whether to show the poster after playback has ended, by default `true`
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</td></tr>
|
|
98
|
+
<tr><td>
|
|
99
|
+
|
|
100
|
+
[url?](./player.posterpluginsettings.url.md)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
</td><td>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</td><td>
|
|
107
|
+
|
|
108
|
+
string
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</td><td>
|
|
112
|
+
|
|
113
|
+
**_(BETA)_** _(Optional)_ Poster image URL
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</td></tr>
|
|
117
|
+
</tbody></table>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [PosterPluginSettings](./player.posterpluginsettings.md) > [showForNoOp](./player.posterpluginsettings.showfornoop.md)
|
|
4
|
+
|
|
5
|
+
## PosterPluginSettings.showForNoOp property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Whether to show the poster image when the playback is noop (i.e., when there is no appropriate video playback engine for current media sources set or the media sources are not set at all)
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
showForNoOp?: boolean;
|
|
16
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [PosterPluginSettings](./player.posterpluginsettings.md) > [showOnVideoEnd](./player.posterpluginsettings.showonvideoend.md)
|
|
4
|
+
|
|
5
|
+
## PosterPluginSettings.showOnVideoEnd property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Whether to show the poster after playback has ended, by default `true`
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
showOnVideoEnd?: boolean;
|
|
16
|
+
```
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [PosterPluginSettings](./player.posterpluginsettings.md) > [url](./player.posterpluginsettings.url.md)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## PosterPluginSettings.url property
|
|
6
6
|
|
|
7
7
|
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
8
|
>
|
|
9
9
|
|
|
10
|
+
Poster image URL
|
|
10
11
|
|
|
11
12
|
**Signature:**
|
|
12
13
|
|
|
13
14
|
```typescript
|
|
14
|
-
|
|
15
|
+
url?: string;
|
|
15
16
|
```
|
|
16
|
-
**Returns:**
|
|
17
|
-
|
|
18
|
-
void
|
|
19
|
-
|
package/lib/Player.js
CHANGED
|
@@ -5,7 +5,7 @@ import EventEmitter from 'eventemitter3';
|
|
|
5
5
|
import { PlayerEvent } from './types.js';
|
|
6
6
|
import { buildMediaSourcesList, wrapSource } from './utils/mediaSources.js';
|
|
7
7
|
import { registerPlaybacks } from './playback/index.js';
|
|
8
|
-
const T = '
|
|
8
|
+
const T = 'gplayer';
|
|
9
9
|
const DEFAULT_OPTIONS = {
|
|
10
10
|
autoPlay: false,
|
|
11
11
|
debug: 'none',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video player for the Gcore streaming platform
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This package provides a video player for the Gcore streaming platform.
|
|
6
|
+
* It is built on top of the {@link https://github.com/clappr/clappr | Clappr} library and provides a framework for building custom integrations.
|
|
7
|
+
* Start with {@link Player} for more information.
|
|
8
|
+
*
|
|
9
|
+
* Various plugins (marked with `PLUGIN` keyword) are available to extend the core functionality with additional features.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Player, MediaControl, ErrorScreen } from '@gcorevideo/player'
|
|
13
|
+
*
|
|
14
|
+
* Player.registerPlugin(MediaControl)
|
|
15
|
+
* Player.registerPlugin(ErrorScreen)
|
|
16
|
+
*
|
|
17
|
+
* const player = new Player({
|
|
18
|
+
* autoPlay: true,
|
|
19
|
+
* mute: true,
|
|
20
|
+
* sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* player.attachTo(document.getElementById('container'))
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
export * from './index.core.js';
|
|
29
|
+
export * from './index.plugins.js';
|
|
30
|
+
//# sourceMappingURL=index.embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.embed.d.ts","sourceRoot":"","sources":["../src/index.embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video player for the Gcore streaming platform
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This package provides a video player for the Gcore streaming platform.
|
|
6
|
+
* It is built on top of the {@link https://github.com/clappr/clappr | Clappr} library and provides a framework for building custom integrations.
|
|
7
|
+
* Start with {@link Player} for more information.
|
|
8
|
+
*
|
|
9
|
+
* Various plugins (marked with `PLUGIN` keyword) are available to extend the core functionality with additional features.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Player, MediaControl, ErrorScreen } from '@gcorevideo/player'
|
|
13
|
+
*
|
|
14
|
+
* Player.registerPlugin(MediaControl)
|
|
15
|
+
* Player.registerPlugin(ErrorScreen)
|
|
16
|
+
*
|
|
17
|
+
* const player = new Player({
|
|
18
|
+
* autoPlay: true,
|
|
19
|
+
* mute: true,
|
|
20
|
+
* sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* player.attachTo(document.getElementById('container'))
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
export * from './index.core.js';
|
|
29
|
+
export * from './index.plugins.js';
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { UICorePlugin } from '@clappr/core';
|
|
2
2
|
import '../../../assets/big-mute-button/big-mute-button.scss';
|
|
3
3
|
/**
|
|
4
|
-
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
5
|
-
* Once pressed, it unmutes the video.
|
|
4
|
+
* `PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
6
5
|
* @beta
|
|
6
|
+
* @remarks
|
|
7
|
+
* When pressed, it unmutes the video.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { BigMuteButton } from '@gcorevideo/player'
|
|
11
|
+
* Player.registerPlugin(BigMuteButton)
|
|
12
|
+
* ```
|
|
7
13
|
*/
|
|
8
14
|
export declare class BigMuteButton extends UICorePlugin {
|
|
9
|
-
private
|
|
15
|
+
private autoPlay;
|
|
16
|
+
private hidden;
|
|
10
17
|
private _adIsPlaying;
|
|
11
|
-
private $bigMuteBtnContainer;
|
|
12
|
-
private $bigMuteButton;
|
|
13
18
|
/**
|
|
14
19
|
* @internal
|
|
15
20
|
*/
|
|
@@ -25,28 +30,28 @@ export declare class BigMuteButton extends UICorePlugin {
|
|
|
25
30
|
* @internal
|
|
26
31
|
*/
|
|
27
32
|
get events(): {
|
|
28
|
-
|
|
29
|
-
'click .big-mute-icon-wrapper': string;
|
|
33
|
+
click: string;
|
|
30
34
|
};
|
|
31
35
|
/**
|
|
32
36
|
* @internal
|
|
33
37
|
*/
|
|
34
38
|
bindEvents(): void;
|
|
35
39
|
private onCoreReady;
|
|
40
|
+
private onContainerChanged;
|
|
41
|
+
private onPlay;
|
|
42
|
+
private onStop;
|
|
43
|
+
private onPause;
|
|
36
44
|
private onContainerVolume;
|
|
37
|
-
private onContainerStart;
|
|
38
45
|
private onPlaybackEnded;
|
|
39
|
-
private mediaControlRendered;
|
|
40
46
|
private onStartAd;
|
|
41
47
|
private onFinishAd;
|
|
42
|
-
private shouldRender;
|
|
43
48
|
/**
|
|
44
49
|
* @internal
|
|
45
50
|
*/
|
|
46
51
|
render(): this;
|
|
47
|
-
private
|
|
48
|
-
private
|
|
49
|
-
private
|
|
52
|
+
private mount;
|
|
53
|
+
private hide;
|
|
54
|
+
private show;
|
|
50
55
|
private clicked;
|
|
51
56
|
}
|
|
52
57
|
//# sourceMappingURL=BigMuteButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BigMuteButton.d.ts","sourceRoot":"","sources":["../../../src/plugins/big-mute-button/BigMuteButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAS,MAAM,cAAc,CAAA;AAQpE,OAAO,sDAAsD,CAAA;AAM7D
|
|
1
|
+
{"version":3,"file":"BigMuteButton.d.ts","sourceRoot":"","sources":["../../../src/plugins/big-mute-button/BigMuteButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAS,MAAM,cAAc,CAAA;AAQpE,OAAO,sDAAsD,CAAA;AAM7D;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,MAAM,CAAQ;IAGtB,OAAO,CAAC,YAAY,CAAQ;IAE5B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAEnB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,MAAM;IAmBd,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,UAAU;IAKlB;;OAEG;IACM,MAAM;IAWf,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,OAAO;CAkBhB"}
|
|
@@ -2,20 +2,26 @@ import { Events, template, UICorePlugin, Utils } from '@clappr/core';
|
|
|
2
2
|
import { trace } from '@gcorevideo/utils';
|
|
3
3
|
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
4
|
import volumeMuteIcon from '../../../assets/icons/new/volume-off.svg';
|
|
5
|
-
import
|
|
5
|
+
import templateHtml from '../../../assets/big-mute-button/big-mute-button.ejs';
|
|
6
6
|
import '../../../assets/big-mute-button/big-mute-button.scss';
|
|
7
7
|
const T = 'plugins.big_mute_button';
|
|
8
8
|
// TODO rewrite as a container plugin
|
|
9
9
|
/**
|
|
10
|
-
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
11
|
-
* Once pressed, it unmutes the video.
|
|
10
|
+
* `PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
12
11
|
* @beta
|
|
12
|
+
* @remarks
|
|
13
|
+
* When pressed, it unmutes the video.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { BigMuteButton } from '@gcorevideo/player'
|
|
17
|
+
* Player.registerPlugin(BigMuteButton)
|
|
18
|
+
* ```
|
|
13
19
|
*/
|
|
14
20
|
export class BigMuteButton extends UICorePlugin {
|
|
15
|
-
|
|
21
|
+
autoPlay = false;
|
|
22
|
+
hidden = false;
|
|
23
|
+
// TODO get back to the ads-related logic later
|
|
16
24
|
_adIsPlaying = false;
|
|
17
|
-
$bigMuteBtnContainer = null;
|
|
18
|
-
$bigMuteButton = null;
|
|
19
25
|
/**
|
|
20
26
|
* @internal
|
|
21
27
|
*/
|
|
@@ -28,14 +34,13 @@ export class BigMuteButton extends UICorePlugin {
|
|
|
28
34
|
get supportedVersion() {
|
|
29
35
|
return { min: CLAPPR_VERSION };
|
|
30
36
|
}
|
|
31
|
-
static template = template(
|
|
37
|
+
static template = template(templateHtml);
|
|
32
38
|
/**
|
|
33
39
|
* @internal
|
|
34
40
|
*/
|
|
35
41
|
get events() {
|
|
36
42
|
return {
|
|
37
|
-
|
|
38
|
-
'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
|
|
43
|
+
click: 'clicked',
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
@@ -43,110 +48,99 @@ export class BigMuteButton extends UICorePlugin {
|
|
|
43
48
|
*/
|
|
44
49
|
bindEvents() {
|
|
45
50
|
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
51
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
|
|
46
52
|
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
47
53
|
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
48
|
-
trace(`${T} bindEvents`, {
|
|
49
|
-
mediacontrol: !!this.core.mediaControl,
|
|
50
|
-
});
|
|
51
|
-
// TOOD use core.getPlugin('media_control')
|
|
52
|
-
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.mediaControlRendered);
|
|
53
54
|
}
|
|
54
|
-
onCoreReady() {
|
|
55
|
+
onCoreReady() { }
|
|
56
|
+
onContainerChanged() {
|
|
55
57
|
this.listenTo(this.core.activeContainer, Events.CONTAINER_VOLUME, this.onContainerVolume);
|
|
56
|
-
this.listenTo(this.core.activeContainer, Events.CONTAINER_READY, this.onContainerStart);
|
|
57
58
|
this.listenTo(this.core.activePlayback, Events.PLAYBACK_ENDED, this.onPlaybackEnded);
|
|
59
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAY, this.onPlay);
|
|
60
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_STOP, this.onStop);
|
|
61
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PAUSE, this.onPause);
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
onPlay(_, { autoPlay }) {
|
|
64
|
+
const container = this.core.activeContainer;
|
|
65
|
+
const { volume } = container;
|
|
66
|
+
const { wasMuted } = this.options;
|
|
67
|
+
if (autoPlay) {
|
|
68
|
+
this.autoPlay = true;
|
|
69
|
+
}
|
|
70
|
+
trace(`${T} onPlay`, {
|
|
71
|
+
autoPlay: this.autoPlay,
|
|
72
|
+
wasMuted,
|
|
73
|
+
volume,
|
|
74
|
+
});
|
|
75
|
+
if (this.autoPlay && !wasMuted && volume === 0) {
|
|
76
|
+
this.mount();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.destroy();
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
onStop(_, { ui }) {
|
|
83
|
+
trace(`${T} onStop`, { ui });
|
|
84
|
+
if (ui) {
|
|
85
|
+
this.destroy();
|
|
67
86
|
}
|
|
68
87
|
}
|
|
69
|
-
|
|
70
|
-
this.
|
|
88
|
+
onPause() {
|
|
89
|
+
this.destroy();
|
|
71
90
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
container: !!container,
|
|
76
|
-
});
|
|
77
|
-
if (container) {
|
|
78
|
-
this.listenTo(container.playback, Events.PLAYBACK_PLAY, () => {
|
|
79
|
-
trace(`${T} PLAYBACK_PLAY`);
|
|
80
|
-
this.render();
|
|
81
|
-
});
|
|
91
|
+
onContainerVolume(value) {
|
|
92
|
+
if (value !== 0) {
|
|
93
|
+
this.destroy();
|
|
82
94
|
}
|
|
83
95
|
}
|
|
96
|
+
onPlaybackEnded() {
|
|
97
|
+
this.hide();
|
|
98
|
+
}
|
|
84
99
|
onStartAd() {
|
|
85
100
|
this._adIsPlaying = true;
|
|
86
|
-
|
|
87
|
-
this.$bigMuteBtnContainer.addClass('hide');
|
|
88
|
-
}
|
|
101
|
+
this.hide();
|
|
89
102
|
}
|
|
90
103
|
onFinishAd() {
|
|
91
104
|
this._adIsPlaying = false;
|
|
92
|
-
|
|
93
|
-
this.$bigMuteBtnContainer.removeClass('hide');
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
shouldRender() {
|
|
97
|
-
const container = this.core.activeContainer;
|
|
98
|
-
if (!container) {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
const { autoPlay, wasMuted } = this.options;
|
|
102
|
-
const volume = container.volume;
|
|
103
|
-
trace(`${T} shouldRender`, {
|
|
104
|
-
autoPlay,
|
|
105
|
-
wasMuted,
|
|
106
|
-
volume,
|
|
107
|
-
});
|
|
108
|
-
return autoPlay && !wasMuted && volume === 0;
|
|
105
|
+
this.show();
|
|
109
106
|
}
|
|
110
107
|
/**
|
|
111
108
|
* @internal
|
|
112
109
|
*/
|
|
113
110
|
render() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.$bigMuteBtnContainer = this.$el.find('.big-mute-icon-wrapper[data-big-mute]');
|
|
120
|
-
this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide');
|
|
121
|
-
this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon');
|
|
122
|
-
this.$bigMuteButton.append(volumeMuteIcon);
|
|
123
|
-
const container = this.core.activeContainer;
|
|
124
|
-
container.$el.append(this.$el.get(0));
|
|
125
|
-
}
|
|
111
|
+
trace(`${T} render`);
|
|
112
|
+
this.$el.html(BigMuteButton.template());
|
|
113
|
+
this.$el.find('#gplayer-big-mute-icon').append(volumeMuteIcon);
|
|
114
|
+
// TODO
|
|
115
|
+
// this._adIsPlaying && this.hide()
|
|
126
116
|
return this;
|
|
127
117
|
}
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
this
|
|
118
|
+
mount() {
|
|
119
|
+
this.core.activeContainer.$el.append(this.$el);
|
|
120
|
+
this.show();
|
|
131
121
|
}
|
|
132
|
-
|
|
133
|
-
this.
|
|
134
|
-
|
|
135
|
-
this.$bigMuteBtnContainer.removeClass('hide');
|
|
136
|
-
}
|
|
122
|
+
hide() {
|
|
123
|
+
this.hidden = true;
|
|
124
|
+
this.$el.find('#gplayer-big-mute-button')?.addClass('hide');
|
|
137
125
|
}
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
e.stopPropagation();
|
|
142
|
-
}
|
|
143
|
-
this.destroy();
|
|
126
|
+
show() {
|
|
127
|
+
this.hidden = false;
|
|
128
|
+
this.$el.find('#gplayer-big-mute-button')?.removeClass('hide');
|
|
144
129
|
}
|
|
145
130
|
clicked(e) {
|
|
131
|
+
trace(`${T} clicked`);
|
|
132
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
133
|
+
// TODO delegate to media_control plugin
|
|
146
134
|
const localVolume = Utils.Config.restore('volume');
|
|
147
135
|
const volume = !isNaN(localVolume) ? localVolume : 100;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
136
|
+
const unmuted = volume === 0 ? 100 : volume;
|
|
137
|
+
if (mediaControl) {
|
|
138
|
+
mediaControl.setVolume(unmuted);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
this.core.activeContainer.setVolume(unmuted);
|
|
142
|
+
}
|
|
143
|
+
e.stopPropagation?.();
|
|
144
|
+
this.destroy();
|
|
151
145
|
}
|
|
152
146
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Container, ContainerPlugin } from '@clappr/core';
|
|
2
2
|
import type { ClapprStatsMetrics } from './types.js';
|
|
3
3
|
export * from './types.js';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Config options for the {@link ClapprStats} plugin
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface ClapprStatsSettings {
|
|
5
9
|
/**
|
|
6
10
|
* The interval in milliseconds of periodic measurements.
|
|
7
11
|
* The plugin will emit a {@link ClapprStatsEvents.REPORT} event with the collected metrics at the specified interval.
|
|
8
12
|
*/
|
|
9
13
|
runEach?: number;
|
|
10
|
-
}
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* `PLUGIN` that measures data about playback, which can be useful for analyzing performance and UX.
|
|
13
17
|
* @beta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClapprStats.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-stats/ClapprStats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAwB,MAAM,cAAc,CAAA;AAU/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,cAAc,YAAY,CAAA;AAM1B,MAAM,
|
|
1
|
+
{"version":3,"file":"ClapprStats.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-stats/ClapprStats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAwB,MAAM,cAAc,CAAA;AAU/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,cAAc,YAAY,CAAA;AAM1B;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAC9C,OAAO,CAAC,OAAO,CAAuB;IAEtC,OAAO,CAAC,sBAAsB,CAAI;IAElC,OAAO,CAAC,OAAO,CAAmC;IAElD,OAAO,CAAC,MAAM,CAMb;IAED,OAAO,CAAC,OAAO,CAAQ;IAEvB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,CAAC,GAAG;IASX,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,IAAI;gBAIA,SAAS,EAAE,SAAS;IAKhC;;OAEG;IACM,UAAU;IAqDnB;;OAEG;IACM,OAAO;IAKhB;;;OAGG;IACH,aAAa;IAIb,YAAY;IAIZ,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,OAAO;IAgBf,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,QAAQ;IAgBhB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,aAAa;CA0BtB"}
|
|
@@ -62,7 +62,7 @@ export class ClickToPause extends ContainerPlugin {
|
|
|
62
62
|
togglePlay(useStop) {
|
|
63
63
|
const isPlaying = this.container && this.container.isPlaying();
|
|
64
64
|
if (isPlaying) {
|
|
65
|
-
useStop ? this.container.stop() : this.container.pause();
|
|
65
|
+
useStop ? this.container.stop({ ui: true }) : this.container.pause();
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
this.container.play();
|
|
@@ -7,7 +7,7 @@ import '../../../assets/clips/clips.scss';
|
|
|
7
7
|
*/
|
|
8
8
|
export interface ClipsPluginSettings {
|
|
9
9
|
/**
|
|
10
|
-
* The compiled text of the clips description, one clip per line in format
|
|
10
|
+
* The compiled text of the clips description, one clip per line in format:
|
|
11
11
|
* `HH:MM:SS text` or `MM:SS text` or `SS text`
|
|
12
12
|
*/
|
|
13
13
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clips.d.ts","sourceRoot":"","sources":["../../../src/plugins/clips/Clips.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAe,MAAM,cAAc,CAAA;AAI3E,OAAO,EAAgB,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,kCAAkC,CAAA;AAOzC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAKD;;;;;;;;;;;GAWG;AACH,qBAAa,KAAM,SAAQ,YAAY;IACrC,OAAO,CAAC,QAAQ,CAAgC;IAEhD,OAAO,CAAC,KAAK,CAAiB;IAE9B,OAAO,CAAC,YAAY,CAAuB;IAE3C,OAAO,CAAC,OAAO,CAA2B;IAE1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAEtD;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,IAAI,OAAO,WAEV;IAED,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACM,UAAU;IAUV,MAAM;IAUN,OAAO;IAQP,OAAO;IAQP,MAAM;IAKf;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"Clips.d.ts","sourceRoot":"","sources":["../../../src/plugins/clips/Clips.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAe,MAAM,cAAc,CAAA;AAI3E,OAAO,EAAgB,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,kCAAkC,CAAA;AAOzC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAKD;;;;;;;;;;;GAWG;AACH,qBAAa,KAAM,SAAQ,YAAY;IACrC,OAAO,CAAC,QAAQ,CAAgC;IAEhD,OAAO,CAAC,KAAK,CAAiB;IAE9B,OAAO,CAAC,YAAY,CAAuB;IAE3C,OAAO,CAAC,OAAO,CAA2B;IAE1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAEtD;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,IAAI,OAAO,WAEV;IAED,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACM,UAAU;IAUV,MAAM;IAUN,OAAO;IAQP,OAAO;IAQP,MAAM;IAKf;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;IAK5C,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,WAAW;CAOpB"}
|
|
@@ -86,7 +86,8 @@ export class Clips extends UICorePlugin {
|
|
|
86
86
|
* @returns The text of the clip at the given time
|
|
87
87
|
*/
|
|
88
88
|
getText(time) {
|
|
89
|
-
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
89
|
+
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
90
|
+
?.text;
|
|
90
91
|
}
|
|
91
92
|
onCoreReady() {
|
|
92
93
|
trace(`${T} onCoreReady`);
|