@gcorevideo/player 2.22.21 → 2.22.23
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/clappr-nerd-stats/clappr-nerd-stats.ejs +30 -30
- package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +18 -14
- package/dist/core.js +1 -1
- package/dist/index.css +1433 -1425
- package/dist/index.js +4335 -4299
- package/dist/player.d.ts +32 -10
- package/dist/plugins/index.css +632 -624
- package/dist/plugins/index.js +5366 -5334
- package/docs/api/player.extendedevents.md +45 -0
- package/docs/api/player.md +21 -1
- package/docs/api/player.volumefade._constructor_.md +50 -0
- package/docs/api/player.volumefade.md +40 -1
- package/docs/api/player.volumefadesettings.md +18 -0
- package/lib/index.plugins.d.ts +2 -2
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -2
- package/lib/plugins/audio-selector/AudioTracks.d.ts +67 -0
- package/lib/plugins/audio-selector/AudioTracks.d.ts.map +1 -0
- package/lib/plugins/audio-selector/AudioTracks.js +176 -0
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +6 -0
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +2 -1
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +19 -3
- package/lib/plugins/clappr-nerd-stats/speedtest/index.js +1 -1
- package/lib/plugins/clappr-nerd-stats/utils.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/utils.js +14 -15
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +1 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +3 -0
- package/lib/plugins/click-to-pause/ClickToPause.js +6 -7
- package/lib/plugins/media-control/MediaControl.d.ts +2 -1
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +1 -0
- package/lib/plugins/skip-time/SkipTime.d.ts +2 -2
- package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -1
- package/lib/plugins/skip-time/SkipTime.js +6 -5
- package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +10 -3
- package/lib/plugins/volume-fade/VolumeFade.d.ts +3 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +6 -3
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -2
- package/src/plugins/audio-selector/{AudioSelector.ts → AudioTracks.ts} +6 -3
- package/src/plugins/audio-selector/__tests__/{AudioSelector.test.ts → AudioTracks.test.ts} +24 -24
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +66 -0
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioTracks.test.ts.snap +67 -0
- package/src/plugins/bottom-gear/BottomGear.ts +10 -0
- package/src/plugins/clappr-nerd-stats/NerdStats.ts +26 -7
- package/src/plugins/clappr-nerd-stats/speedtest/index.ts +1 -1
- package/src/plugins/clappr-nerd-stats/utils.ts +20 -13
- package/src/plugins/clappr-stats/ClapprStats.ts +4 -0
- package/src/plugins/click-to-pause/ClickToPause.ts +6 -6
- package/src/plugins/media-control/MediaControl.ts +1 -0
- package/src/plugins/skip-time/SkipTime.ts +45 -38
- package/src/plugins/subtitles/ClosedCaptions.ts +17 -7
- package/src/plugins/volume-fade/VolumeFade.ts +6 -3
- package/temp/player.api.json +100 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [ExtendedEvents](./player.extendedevents.md)
|
|
4
|
+
|
|
5
|
+
## ExtendedEvents enum
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export declare enum ExtendedEvents
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Enumeration Members
|
|
14
|
+
|
|
15
|
+
<table><thead><tr><th>
|
|
16
|
+
|
|
17
|
+
Member
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
</th><th>
|
|
21
|
+
|
|
22
|
+
Value
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th><th>
|
|
26
|
+
|
|
27
|
+
Description
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</th></tr></thead>
|
|
31
|
+
<tbody><tr><td>
|
|
32
|
+
|
|
33
|
+
MEDIACONTROL\_VOLUME
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
</td><td>
|
|
37
|
+
|
|
38
|
+
`"mediacontrol:volume"`
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
</td></tr>
|
|
45
|
+
</tbody></table>
|
package/docs/api/player.md
CHANGED
|
@@ -358,7 +358,7 @@ Description
|
|
|
358
358
|
|
|
359
359
|
</td><td>
|
|
360
360
|
|
|
361
|
-
**_(BETA)_** `PLUGIN` that
|
|
361
|
+
**_(BETA)_** `PLUGIN` that mutes the sound and fades it in when the mouse is over the player.
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
</td></tr>
|
|
@@ -409,6 +409,15 @@ Description
|
|
|
409
409
|
**_(BETA)_**
|
|
410
410
|
|
|
411
411
|
|
|
412
|
+
</td></tr>
|
|
413
|
+
<tr><td>
|
|
414
|
+
|
|
415
|
+
[ExtendedEvents](./player.extendedevents.md)
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
</td><td>
|
|
419
|
+
|
|
420
|
+
|
|
412
421
|
</td></tr>
|
|
413
422
|
<tr><td>
|
|
414
423
|
|
|
@@ -1116,6 +1125,17 @@ Localization strings for the player UI.
|
|
|
1116
1125
|
Preferred streaming media delivery protocol
|
|
1117
1126
|
|
|
1118
1127
|
|
|
1128
|
+
</td></tr>
|
|
1129
|
+
<tr><td>
|
|
1130
|
+
|
|
1131
|
+
[VolumeFadeSettings](./player.volumefadesettings.md)
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
</td><td>
|
|
1135
|
+
|
|
1136
|
+
**_(BETA)_**
|
|
1137
|
+
|
|
1138
|
+
|
|
1119
1139
|
</td></tr>
|
|
1120
1140
|
<tr><td>
|
|
1121
1141
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [VolumeFade](./player.volumefade.md) > [(constructor)](./player.volumefade._constructor_.md)
|
|
4
|
+
|
|
5
|
+
## VolumeFade.(constructor)
|
|
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
|
+
Constructs a new instance of the `VolumeFade` class
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
constructor(core: Core);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
<table><thead><tr><th>
|
|
21
|
+
|
|
22
|
+
Parameter
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th><th>
|
|
26
|
+
|
|
27
|
+
Type
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</th><th>
|
|
31
|
+
|
|
32
|
+
Description
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</th></tr></thead>
|
|
36
|
+
<tbody><tr><td>
|
|
37
|
+
|
|
38
|
+
core
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
Core
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</td></tr>
|
|
50
|
+
</tbody></table>
|
|
@@ -7,7 +7,7 @@
|
|
|
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
|
-
`PLUGIN` that
|
|
10
|
+
`PLUGIN` that mutes the sound and fades it in when the mouse is over the player.
|
|
11
11
|
|
|
12
12
|
**Signature:**
|
|
13
13
|
|
|
@@ -16,3 +16,42 @@ export declare class VolumeFade extends UICorePlugin
|
|
|
16
16
|
```
|
|
17
17
|
**Extends:** UICorePlugin
|
|
18
18
|
|
|
19
|
+
## Remarks
|
|
20
|
+
|
|
21
|
+
When the user moves the mouse over and away from the player, the sound is unmuted and unmuted with a fade effect.
|
|
22
|
+
|
|
23
|
+
Depends on [MediaControl](./player.mediacontrol.md) plugin. Configuration options - [VolumeFadeSettings](./player.volumefadesettings.md)
|
|
24
|
+
|
|
25
|
+
## Constructors
|
|
26
|
+
|
|
27
|
+
<table><thead><tr><th>
|
|
28
|
+
|
|
29
|
+
Constructor
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th><th>
|
|
33
|
+
|
|
34
|
+
Modifiers
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</th><th>
|
|
38
|
+
|
|
39
|
+
Description
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
</th></tr></thead>
|
|
43
|
+
<tbody><tr><td>
|
|
44
|
+
|
|
45
|
+
[(constructor)(core)](./player.volumefade._constructor_.md)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td><td>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td><td>
|
|
52
|
+
|
|
53
|
+
**_(BETA)_** Constructs a new instance of the `VolumeFade` class
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</td></tr>
|
|
57
|
+
</tbody></table>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [VolumeFadeSettings](./player.volumefadesettings.md)
|
|
4
|
+
|
|
5
|
+
## VolumeFadeSettings type
|
|
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
|
+
|
|
11
|
+
**Signature:**
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
export type VolumeFadeSettings = {
|
|
15
|
+
level?: number;
|
|
16
|
+
duration?: number;
|
|
17
|
+
};
|
|
18
|
+
```
|
package/lib/index.plugins.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../assets/style/main.scss';
|
|
2
|
-
export * from "./plugins/audio-selector/
|
|
3
|
-
export { AudioTracks as AudioSelector } from "./plugins/audio-selector/
|
|
2
|
+
export * from "./plugins/audio-selector/AudioTracks.js";
|
|
3
|
+
export { AudioTracks as AudioSelector } from "./plugins/audio-selector/AudioTracks.js";
|
|
4
4
|
export * from "./plugins/big-mute-button/BigMuteButton.js";
|
|
5
5
|
export * from "./plugins/bottom-gear/BottomGear.js";
|
|
6
6
|
export * from "./plugins/clappr-stats/ClapprStats.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.plugins.d.ts","sourceRoot":"","sources":["../src/index.plugins.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAEnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.plugins.d.ts","sourceRoot":"","sources":["../src/index.plugins.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAEnC,cAAc,yCAAyC,CAAC;AACxD,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACvF,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,0CAA0C,CAAC;AACxF,cAAc,0CAA0C,CAAC;AACzD,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AACjE,cAAc,yCAAyC,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC3F,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sDAAsD,CAAC;AACrE,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,MAAM,sDAAsD,CAAC;AACrG,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,CAAC;AACtD,OAAO,EAAE,cAAc,IAAI,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACpF,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,qCAAqC,CAAC"}
|
package/lib/index.plugins.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../assets/style/main.scss';
|
|
2
|
-
export * from "./plugins/audio-selector/
|
|
3
|
-
export { AudioTracks as AudioSelector } from "./plugins/audio-selector/
|
|
2
|
+
export * from "./plugins/audio-selector/AudioTracks.js";
|
|
3
|
+
export { AudioTracks as AudioSelector } from "./plugins/audio-selector/AudioTracks.js";
|
|
4
4
|
export * from "./plugins/big-mute-button/BigMuteButton.js";
|
|
5
5
|
export * from "./plugins/bottom-gear/BottomGear.js";
|
|
6
6
|
export * from "./plugins/clappr-stats/ClapprStats.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { UICorePlugin } from '@clappr/core';
|
|
2
|
+
import '../../../assets/audio-selector/style.scss';
|
|
3
|
+
/**
|
|
4
|
+
* `PLUGIN` that makes possible to switch audio tracks via the media control UI.
|
|
5
|
+
* @beta
|
|
6
|
+
* @remarks
|
|
7
|
+
* The plugin is activated when there are multiple audio tracks available.
|
|
8
|
+
* The plugin adds a button showing the current audio track and a dropdown to switch to another audio track.
|
|
9
|
+
* Depends on:
|
|
10
|
+
*
|
|
11
|
+
* - {@link MediaControl}
|
|
12
|
+
*/
|
|
13
|
+
export declare class AudioTracks extends UICorePlugin {
|
|
14
|
+
private currentTrack;
|
|
15
|
+
private tracks;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
get name(): string;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
get supportedVersion(): {
|
|
24
|
+
min: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
static get version(): string;
|
|
30
|
+
private static readonly template;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
get attributes(): {
|
|
35
|
+
class: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
get events(): {
|
|
41
|
+
'click [data-audiotracks-select]': string;
|
|
42
|
+
'click #audiotracks-button': string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
bindEvents(): void;
|
|
48
|
+
private onCoreReady;
|
|
49
|
+
private onActiveContainerChanged;
|
|
50
|
+
private shouldRender;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
render(): this;
|
|
55
|
+
private onTrackSelect;
|
|
56
|
+
private selectAudioTrack;
|
|
57
|
+
private hideMenu;
|
|
58
|
+
private toggleContextMenu;
|
|
59
|
+
private buttonElement;
|
|
60
|
+
private buttonElementText;
|
|
61
|
+
private trackElement;
|
|
62
|
+
private getTitle;
|
|
63
|
+
private startTrackSwitching;
|
|
64
|
+
private updateText;
|
|
65
|
+
private highlightCurrentTrack;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=AudioTracks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioTracks.d.ts","sourceRoot":"","sources":["../../../src/plugins/audio-selector/AudioTracks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAY,MAAM,cAAc,CAAA;AAO7D,OAAO,2CAA2C,CAAA;AAUlD;;;;;;;;;GASG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,YAAY,CAA0B;IAE9C,OAAO,CAAC,MAAM,CAAmB;IAEjC;;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,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;;MAKlB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACM,MAAM;IAmBf,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,qBAAqB;CAe9B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Events, UICorePlugin, template } from '@clappr/core';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
|
+
import pluginHtml from '../../../assets/audio-selector/track-selector.ejs';
|
|
5
|
+
import '../../../assets/audio-selector/style.scss';
|
|
6
|
+
import audioArrow from '../../../assets/icons/old/quality-arrow.svg';
|
|
7
|
+
import { ExtendedEvents } from '../media-control/MediaControl.js';
|
|
8
|
+
import { trace } from '@gcorevideo/utils';
|
|
9
|
+
const VERSION = '2.22.4';
|
|
10
|
+
const T = 'plugins.audiotracks';
|
|
11
|
+
/**
|
|
12
|
+
* `PLUGIN` that makes possible to switch audio tracks via the media control UI.
|
|
13
|
+
* @beta
|
|
14
|
+
* @remarks
|
|
15
|
+
* The plugin is activated when there are multiple audio tracks available.
|
|
16
|
+
* The plugin adds a button showing the current audio track and a dropdown to switch to another audio track.
|
|
17
|
+
* Depends on:
|
|
18
|
+
*
|
|
19
|
+
* - {@link MediaControl}
|
|
20
|
+
*/
|
|
21
|
+
export class AudioTracks extends UICorePlugin {
|
|
22
|
+
currentTrack = null;
|
|
23
|
+
tracks = [];
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
get name() {
|
|
28
|
+
return 'audio_selector'; // TODO rename to audiotracks
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
get supportedVersion() {
|
|
34
|
+
return { min: CLAPPR_VERSION };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
static get version() {
|
|
40
|
+
return VERSION;
|
|
41
|
+
}
|
|
42
|
+
static template = template(pluginHtml);
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
get attributes() {
|
|
47
|
+
return {
|
|
48
|
+
class: 'media-control-audiotracks',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
get events() {
|
|
55
|
+
return {
|
|
56
|
+
'click [data-audiotracks-select]': 'onTrackSelect',
|
|
57
|
+
'click #audiotracks-button': 'toggleContextMenu',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
bindEvents() {
|
|
64
|
+
this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
|
|
65
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
66
|
+
}
|
|
67
|
+
onCoreReady() {
|
|
68
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
69
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
70
|
+
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, () => {
|
|
71
|
+
mediaControl.mount('audiotracks', this.$el);
|
|
72
|
+
});
|
|
73
|
+
this.listenTo(mediaControl, Events.MEDIACONTROL_HIDE, this.hideMenu);
|
|
74
|
+
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.hideMenu);
|
|
75
|
+
}
|
|
76
|
+
onActiveContainerChanged() {
|
|
77
|
+
this.currentTrack = null;
|
|
78
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_AUDIO_AVAILABLE, (tracks) => {
|
|
79
|
+
this.currentTrack =
|
|
80
|
+
tracks.find((track) => track.kind === 'main') ?? null; // TODO test
|
|
81
|
+
this.tracks = tracks;
|
|
82
|
+
this.render();
|
|
83
|
+
});
|
|
84
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_AUDIO_CHANGED, (track) => {
|
|
85
|
+
this.currentTrack = track;
|
|
86
|
+
this.highlightCurrentTrack();
|
|
87
|
+
this.buttonElement().removeClass('changing');
|
|
88
|
+
this.updateText();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
shouldRender() {
|
|
92
|
+
// Render is called from the parent class constructor so tracks aren't available
|
|
93
|
+
// Only care if we have at least 2 to choose from
|
|
94
|
+
return this.tracks?.length > 1;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
render() {
|
|
100
|
+
if (!this.shouldRender()) {
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
this.$el.html(AudioTracks.template({
|
|
104
|
+
tracks: this.tracks,
|
|
105
|
+
title: this.getTitle(),
|
|
106
|
+
icon: audioArrow,
|
|
107
|
+
current: this.currentTrack?.id,
|
|
108
|
+
}));
|
|
109
|
+
this.updateText();
|
|
110
|
+
this.highlightCurrentTrack();
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
onTrackSelect(event) {
|
|
114
|
+
const id = event.currentTarget?.dataset?.audiotracksSelect;
|
|
115
|
+
if (id) {
|
|
116
|
+
this.selectAudioTrack(id);
|
|
117
|
+
}
|
|
118
|
+
this.hideMenu();
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
selectAudioTrack(id) {
|
|
123
|
+
this.startTrackSwitching();
|
|
124
|
+
this.core.activeContainer.switchAudioTrack(id);
|
|
125
|
+
this.updateText();
|
|
126
|
+
}
|
|
127
|
+
hideMenu() {
|
|
128
|
+
trace(`${T} hideMenu`);
|
|
129
|
+
this.$el.find('#audiotracks-select').addClass('hidden');
|
|
130
|
+
}
|
|
131
|
+
toggleContextMenu() {
|
|
132
|
+
this.core.getPlugin('media_control').trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE);
|
|
133
|
+
this.$el.find('#audiotracks-select').toggleClass('hidden'); // TODO use plain CSS display: none
|
|
134
|
+
const open = !this.$el.find('#audiotracks-select').hasClass('hidden'); // TODO hold state
|
|
135
|
+
this.$el.find('#audiotracks-button').attr('aria-expanded', open);
|
|
136
|
+
}
|
|
137
|
+
buttonElement() {
|
|
138
|
+
return this.$('button');
|
|
139
|
+
}
|
|
140
|
+
buttonElementText() {
|
|
141
|
+
return this.$('button .audio-text');
|
|
142
|
+
}
|
|
143
|
+
trackElement(id) {
|
|
144
|
+
return this.$('#audiotracks-select a' +
|
|
145
|
+
(id !== undefined ? `[data-audiotracks-select="${id}"]` : '')).parent();
|
|
146
|
+
}
|
|
147
|
+
getTitle() {
|
|
148
|
+
if (!this.currentTrack) {
|
|
149
|
+
return '';
|
|
150
|
+
}
|
|
151
|
+
return this.currentTrack.label || this.currentTrack.language;
|
|
152
|
+
}
|
|
153
|
+
startTrackSwitching() {
|
|
154
|
+
this.buttonElement().addClass('changing');
|
|
155
|
+
}
|
|
156
|
+
updateText() {
|
|
157
|
+
if (!this.currentTrack) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.buttonElementText().text(this.currentTrack.label);
|
|
161
|
+
}
|
|
162
|
+
highlightCurrentTrack() {
|
|
163
|
+
this.trackElement().removeClass('current');
|
|
164
|
+
this.trackElement()
|
|
165
|
+
.find('a')
|
|
166
|
+
.removeClass('gcore-skin-active')
|
|
167
|
+
.attr('aria-checked', 'false');
|
|
168
|
+
if (this.currentTrack) {
|
|
169
|
+
this.trackElement(this.currentTrack.id)
|
|
170
|
+
.addClass('current')
|
|
171
|
+
.find('a')
|
|
172
|
+
.addClass('gcore-skin-active')
|
|
173
|
+
.attr('aria-checked', 'true');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAOhF,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAOhF,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,QAAQ,aAAa;CACtB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CAAQ;IAEpB;;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,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IASnB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW;IAyB1D,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACM,MAAM;IAqBf;;;;OAIG;IACH,OAAO;IAKP,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,sBAAsB;CAK/B"}
|
|
@@ -7,6 +7,7 @@ import '../../../assets/bottom-gear/gear.scss';
|
|
|
7
7
|
import '../../../assets/bottom-gear/gear-sub-menu.scss';
|
|
8
8
|
import gearIcon from '../../../assets/icons/new/gear.svg';
|
|
9
9
|
import gearHdIcon from '../../../assets/icons/new/gear-hd.svg';
|
|
10
|
+
import { ExtendedEvents } from '../media-control/MediaControl.js';
|
|
10
11
|
const VERSION = '2.19.12';
|
|
11
12
|
const T = 'plugins.bottom_gear';
|
|
12
13
|
/**
|
|
@@ -222,9 +223,13 @@ export class BottomGear extends UICorePlugin {
|
|
|
222
223
|
this.$el.find('#gear-options').show();
|
|
223
224
|
}
|
|
224
225
|
toggleGearMenu() {
|
|
226
|
+
this.core
|
|
227
|
+
.getPlugin('media_control')
|
|
228
|
+
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE);
|
|
225
229
|
this.$el.find('#gear-options-wrapper').toggle();
|
|
226
230
|
}
|
|
227
231
|
hide() {
|
|
232
|
+
trace(`${T} hide`);
|
|
228
233
|
this.$el.find('#gear-options-wrapper').hide();
|
|
229
234
|
}
|
|
230
235
|
onCoreReady() {
|
|
@@ -233,6 +238,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
233
238
|
assert(mediaControl, 'media_control plugin is required');
|
|
234
239
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_RENDERED, this.onMediaControlRendered);
|
|
235
240
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.hide);
|
|
241
|
+
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.hide);
|
|
236
242
|
}
|
|
237
243
|
onMediaControlRendered() {
|
|
238
244
|
trace(`${T} onMediaControlRendered`);
|
|
@@ -10,7 +10,7 @@ import '../../../assets/clappr-nerd-stats/clappr-nerd-stats.scss';
|
|
|
10
10
|
* - {@link BottomGear} - where the button is attached
|
|
11
11
|
*
|
|
12
12
|
* - {@link ClapprStats} - to get the metrics from
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* The plugin is rendered as an item in the gear menu.
|
|
15
15
|
*
|
|
16
16
|
* When clicked, it shows an overlay window with the information about the network speed, latency, etc,
|
|
@@ -72,6 +72,7 @@ export declare class NerdStats extends UICorePlugin {
|
|
|
72
72
|
private updateResolution;
|
|
73
73
|
private estimateQuality;
|
|
74
74
|
private updateMetrics;
|
|
75
|
+
private updateCustomMetrics;
|
|
75
76
|
private updateEstimatedQuality;
|
|
76
77
|
private setStatsBoxSize;
|
|
77
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NerdStats.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-nerd-stats/NerdStats.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGZ,IAAI,EAGL,MAAM,cAAc,CAAA;AAuBrB,OAAO,0DAA0D,CAAA;AAiCjE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,SAAS,CAAyB;IAE1C,OAAO,CAAC,gBAAgB,CAIvB;IAED,OAAO,CAAC,OAAO,CAAwB;IAEvC,OAAO,CAAC,IAAI,CAAQ;IAEpB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,YAAY,CAAc;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAE7D;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;;;MAMlB;IAED,OAAO,CAAC,OAAO;IAKf,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,sBAAsB,GAEjC;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,YAAY,GAEvB;gBAEW,IAAI,EAAE,IAAI;IAgBtB;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,wBAAwB;IAiChC;;OAEG;IACM,OAAO;IAKhB,OAAO,CAAC,MAAM,CAMb;IAED,OAAO,CAAC,IAAI;IAgBZ,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,aAAa;IAmFrB,OAAO,CAAC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"NerdStats.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-nerd-stats/NerdStats.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGZ,IAAI,EAGL,MAAM,cAAc,CAAA;AAuBrB,OAAO,0DAA0D,CAAA;AAiCjE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,SAAS,CAAyB;IAE1C,OAAO,CAAC,gBAAgB,CAIvB;IAED,OAAO,CAAC,OAAO,CAAwB;IAEvC,OAAO,CAAC,IAAI,CAAQ;IAEpB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,YAAY,CAAc;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAE7D;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;;;MAMlB;IAED,OAAO,CAAC,OAAO;IAKf,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,sBAAsB,GAEjC;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,YAAY,GAEvB;gBAEW,IAAI,EAAE,IAAI;IAgBtB;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,wBAAwB;IAiChC;;OAEG;IACM,OAAO;IAKhB,OAAO,CAAC,MAAM,CAMb;IAED,OAAO,CAAC,IAAI;IAgBZ,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,aAAa;IAmFrB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACM,MAAM;IAcf,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,kBAAkB;CAU3B"}
|
|
@@ -30,7 +30,7 @@ const T = 'plugins.nerd_stats';
|
|
|
30
30
|
* - {@link BottomGear} - where the button is attached
|
|
31
31
|
*
|
|
32
32
|
* - {@link ClapprStats} - to get the metrics from
|
|
33
|
-
*
|
|
33
|
+
*
|
|
34
34
|
* The plugin is rendered as an item in the gear menu.
|
|
35
35
|
*
|
|
36
36
|
* When clicked, it shows an overlay window with the information about the network speed, latency, etc,
|
|
@@ -226,7 +226,10 @@ export class NerdStats extends UICorePlugin {
|
|
|
226
226
|
updateMetrics(metrics) {
|
|
227
227
|
trace(`${T} updateMetrics`, { custom: this.speedtestMetrics });
|
|
228
228
|
Object.assign(this.metrics, metrics);
|
|
229
|
-
this.
|
|
229
|
+
this.metrics.custom = {
|
|
230
|
+
...this.speedtestMetrics,
|
|
231
|
+
};
|
|
232
|
+
this.updateCustomMetrics();
|
|
230
233
|
this.$el
|
|
231
234
|
.find('#nerd-stats-current-time')
|
|
232
235
|
.text(Formatter.formatTime(this.metrics.extra.currentTime));
|
|
@@ -288,11 +291,22 @@ export class NerdStats extends UICorePlugin {
|
|
|
288
291
|
.text(Formatter.formatFps(this.metrics.counters.fps));
|
|
289
292
|
this.setStatsBoxSize();
|
|
290
293
|
drawSpeedTestResults();
|
|
291
|
-
|
|
294
|
+
this.updateEstimatedQuality();
|
|
292
295
|
if (!this.open) {
|
|
293
296
|
this.hide();
|
|
294
297
|
}
|
|
295
298
|
}
|
|
299
|
+
updateCustomMetrics() {
|
|
300
|
+
this.$el
|
|
301
|
+
.find('#nerd-stats-dl-text')
|
|
302
|
+
.text(this.metrics.custom.connectionSpeed.toFixed(2));
|
|
303
|
+
this.$el
|
|
304
|
+
.find('#nerd-stats-ping-text')
|
|
305
|
+
.text(this.metrics.custom.ping.toFixed(2));
|
|
306
|
+
this.$el
|
|
307
|
+
.find('#nerd-stats-jitter-text')
|
|
308
|
+
.text(this.metrics.custom.jitter.toFixed(2));
|
|
309
|
+
}
|
|
296
310
|
updateEstimatedQuality() {
|
|
297
311
|
this.estimateQuality();
|
|
298
312
|
this.$el
|
|
@@ -301,6 +315,7 @@ export class NerdStats extends UICorePlugin {
|
|
|
301
315
|
this.$el
|
|
302
316
|
.find('#nerd-stats-quality-live-text')
|
|
303
317
|
.html(this.metrics.custom.liveQuality);
|
|
318
|
+
drawSummary(this.speedtestMetrics, this.$el.find('#nerd-stats-quality-vod'), this.$el.find('#nerd-stats-quality-live'));
|
|
304
319
|
}
|
|
305
320
|
setStatsBoxSize() {
|
|
306
321
|
if (this.playerWidth >= this.statsBoxWidthThreshold) {
|
|
@@ -345,6 +360,7 @@ export class NerdStats extends UICorePlugin {
|
|
|
345
360
|
this.speedtestMetrics.ping = 0;
|
|
346
361
|
this.speedtestMetrics.jitter = 0;
|
|
347
362
|
if (clapprStats) {
|
|
363
|
+
clapprStats.clearMetrics();
|
|
348
364
|
this.updateMetrics(clapprStats.exportMetrics());
|
|
349
365
|
}
|
|
350
366
|
}
|
|
@@ -30,7 +30,7 @@ const getColor = (speedValue) => {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
export function drawSpeedTestResults() {
|
|
33
|
-
const canvas = document.getElementById('
|
|
33
|
+
const canvas = document.getElementById('nerd-stats-speed-test-canvas');
|
|
34
34
|
if (!canvas) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-nerd-stats/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAUpD,eAAO,MAAM,kBAAkB,eAAgB,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/clappr-nerd-stats/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAUpD,eAAO,MAAM,kBAAkB,eAAgB,MAAM,KAAG,MAiBvD,CAAA;AAED,eAAO,MAAM,cAAc,cAAe,MAAM,KAAG,MAiBlD,CAAA;AAED,eAAO,MAAM,mBAAmB,YAAa,MAAM,KAAG,MAerD,CAAA;AAED,eAAO,MAAM,WAAW,kBACP,gBAAgB,gBACjB,WAAW,iBACV,WAAW,SAY3B,CAAA"}
|