@gcorevideo/player 2.24.2 → 2.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/big-mute-button/big-mute-button.ejs +2 -2
- package/dist/core.js +1 -1
- package/dist/index.css +1382 -1382
- package/dist/index.js +121 -109
- package/dist/player.d.ts +72 -21
- 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/plugins/big-mute-button/BigMuteButton.d.ts +15 -13
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.js +68 -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/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 +5 -0
- 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 +20 -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/plugins/big-mute-button/BigMuteButton.ts +75 -110
- package/src/plugins/big-mute-button/__tests__/BigMuteButton.test.ts +38 -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/clips/Clips.ts +3 -2
- package/src/plugins/cmcd-config/CmcdConfig.ts +33 -27
- package/src/plugins/media-control/MediaControl.ts +5 -0
- package/src/plugins/poster/Poster.ts +6 -2
- package/src/plugins/source-controller/SourceController.ts +25 -9
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +28 -8
- package/src/testUtils.ts +1 -0
- package/temp/player.api.json +229 -154
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.cmcdconfig.supportedversion.md +0 -14
|
@@ -24,24 +24,42 @@ const CMCD_KEYS = [
|
|
|
24
24
|
];
|
|
25
25
|
// const T = 'plugins.cmcd'
|
|
26
26
|
/**
|
|
27
|
-
* A `PLUGIN` that configures CMCD for playback
|
|
27
|
+
* A `PLUGIN` that configures {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf | CMCD} for playback
|
|
28
28
|
* @beta
|
|
29
29
|
* @remarks
|
|
30
|
-
* Configuration options
|
|
31
|
-
*
|
|
30
|
+
* Configuration options - {@link CmcdConfigOptions}.
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { CmcdConfig } from '@gcorevideo/player'
|
|
34
|
+
* Player.registerPlugin(CmcdConfig)
|
|
35
|
+
*
|
|
36
|
+
* const player = new Player({
|
|
37
|
+
* source: 'https://example.com/video.mp4',
|
|
38
|
+
* cmcd: {
|
|
39
|
+
* sessionId: '1234567890',
|
|
40
|
+
* contentId: 'f572d396fae9206628714fb2ce00f72e94f2258f',
|
|
41
|
+
* },
|
|
42
|
+
* })
|
|
43
|
+
* ```
|
|
32
44
|
*/
|
|
33
45
|
export class CmcdConfig extends CorePlugin {
|
|
34
46
|
sid;
|
|
35
47
|
cid = '';
|
|
36
48
|
/**
|
|
37
|
-
* @
|
|
49
|
+
* @internal
|
|
38
50
|
*/
|
|
39
51
|
get name() {
|
|
40
52
|
return 'cmcd';
|
|
41
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
42
57
|
get version() {
|
|
43
58
|
return '0.1.0';
|
|
44
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
45
63
|
get supportedVersion() {
|
|
46
64
|
return CLAPPR_VERSION;
|
|
47
65
|
}
|
|
@@ -51,11 +69,16 @@ export class CmcdConfig extends CorePlugin {
|
|
|
51
69
|
this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
|
|
52
70
|
}
|
|
53
71
|
/**
|
|
54
|
-
* @
|
|
72
|
+
* @internal
|
|
55
73
|
*/
|
|
56
74
|
bindEvents() {
|
|
57
75
|
this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, () => this.updateSettings(this.core.containers[0]));
|
|
58
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns the current `sid` and `cid` values.
|
|
79
|
+
* Useful when the auto-generated values need to be known.
|
|
80
|
+
* @returns `sid` and `cid` values
|
|
81
|
+
*/
|
|
59
82
|
exportIds() {
|
|
60
83
|
return {
|
|
61
84
|
sid: this.sid,
|
|
@@ -91,19 +114,6 @@ export class CmcdConfig extends CorePlugin {
|
|
|
91
114
|
break;
|
|
92
115
|
}
|
|
93
116
|
}
|
|
94
|
-
updateHlsjsSettings(options, { cid, sid }) {
|
|
95
|
-
$.extend(true, options, {
|
|
96
|
-
playback: {
|
|
97
|
-
hlsjsConfig: {
|
|
98
|
-
cmcd: {
|
|
99
|
-
includeKeys: CMCD_KEYS,
|
|
100
|
-
sessionId: sid,
|
|
101
|
-
contentId: cid,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
117
|
generateContentId() {
|
|
108
118
|
return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
|
|
109
119
|
}
|
|
@@ -32,6 +32,10 @@ export type MediaControlSettings = {
|
|
|
32
32
|
default: MediaControlLayerElement[];
|
|
33
33
|
seekEnabled: boolean;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Extended events for the {@link MediaControl} plugin
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
35
39
|
export declare enum ExtendedEvents {
|
|
36
40
|
MEDIACONTROL_VOLUME = "mediacontrol:volume",
|
|
37
41
|
MEDIACONTROL_MENU_COLLAPSE = "mediacontrol:menu:collapse"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,kDAAkD,CAAA;AAWzD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,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IACH,IAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;MA4BlB;IAED,IAAI,cAAc,WAEjB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAInB;IAED;;OAEG;IACH,IAAI,KAAK,YAER;gBAEW,IAAI,EAAE,IAAI;IAqBtB;;OAEG;IACM,oBAAoB;
|
|
1
|
+
{"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,kDAAkD,CAAA;AAWzD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,QAAQ,GACR,OAAO,CAAA;AAEX;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,IAAI,GACJ,YAAY,GACZ,cAAc,GACd,MAAM,GACN,aAAa,GACb,KAAK,GACL,IAAI,CAAA;AAER;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,CAAA;AAY5B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,uBAAuB,EAAE,CAAA;IAC/B,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,OAAO,EAAE,wBAAwB,EAAE,CAAA;IACnC,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAmCD;;;GAGG;AACH,oBAAY,cAAc;IACxB,mBAAmB,wBAAwB;IAC3C,0BAA0B,+BAA+B;CAC1D;AAkBD;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAa,SAAQ,YAA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AAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACM,MAAM;IA0Ef,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAcvB;;OAEG;IACH,mBAAmB;IAMnB;;OAEG;IACH,qBAAqB;IAOrB,OAAO,CAAC,6BAA6B;IAQrC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,iBAAiB;CAO1B"}
|
|
@@ -58,6 +58,10 @@ const LEFT_ORDER = [
|
|
|
58
58
|
'duration',
|
|
59
59
|
'dvr',
|
|
60
60
|
];
|
|
61
|
+
/**
|
|
62
|
+
* Extended events for the {@link MediaControl} plugin
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
61
65
|
export var ExtendedEvents;
|
|
62
66
|
(function (ExtendedEvents) {
|
|
63
67
|
ExtendedEvents["MEDIACONTROL_VOLUME"] = "mediacontrol:volume";
|
|
@@ -338,6 +342,7 @@ export class MediaControl extends UICorePlugin {
|
|
|
338
342
|
onVolumeChanged() {
|
|
339
343
|
this.updateVolumeUI();
|
|
340
344
|
}
|
|
345
|
+
// TODO check if CONTAINER_SETTINGSUPDATE handler is sufficient
|
|
341
346
|
onLoadedMetadata() {
|
|
342
347
|
const video = this.core.activePlayback?.el;
|
|
343
348
|
// video.webkitSupportsFullscreen is deprecated but iOS appears to only use this
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { UIContainerPlugin } from '@clappr/core';
|
|
2
2
|
import '../../../assets/poster/poster.scss';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Config options for the {@link Poster} plugin
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface PosterPluginSettings {
|
|
4
8
|
/**
|
|
5
9
|
* Custom CSS background
|
|
6
10
|
*/
|
|
@@ -14,10 +18,10 @@ export type PosterPluginSettings = {
|
|
|
14
18
|
*/
|
|
15
19
|
url?: string;
|
|
16
20
|
/**
|
|
17
|
-
* Whether to show the poster after playback has ended
|
|
21
|
+
* Whether to show the poster after playback has ended, by default `true`
|
|
18
22
|
*/
|
|
19
23
|
showOnVideoEnd?: boolean;
|
|
20
|
-
}
|
|
24
|
+
}
|
|
21
25
|
/**
|
|
22
26
|
* `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
|
|
23
27
|
* @beta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAK3C,MAAM,
|
|
1
|
+
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAK3C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,MAAO,SAAQ,iBAAiB;IAG3C,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,WAAW,CAA2B;IAE9C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD,OAAO,KAAK,YAAY,GASvB;IAED,OAAO,KAAK,MAAM,GAEjB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAuBnB;;OAEG;IACM,MAAM;IAOf;;OAEG;IACM,OAAO;IAOhB,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACM,MAAM;IAgCf;;OAEG;IACM,OAAO;CAIjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAwC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;gBACS,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;
|
|
1
|
+
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAwC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;gBACS,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAmDnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Events as
|
|
1
|
+
import { Events as Events, CorePlugin, } from '@clappr/core';
|
|
2
2
|
import { PlaybackErrorCode } from '../../playback.types.js';
|
|
3
3
|
import { trace } from '@gcorevideo/utils';
|
|
4
4
|
import { SpinnerEvents } from '../spinner-three-bounce/SpinnerThreeBounce.js';
|
|
@@ -108,6 +108,7 @@ export class SourceController extends CorePlugin {
|
|
|
108
108
|
currentSourceIndex = 0;
|
|
109
109
|
sourcesDelay = {};
|
|
110
110
|
active = false;
|
|
111
|
+
autoPlay = false;
|
|
111
112
|
switching = false;
|
|
112
113
|
sync = noSync;
|
|
113
114
|
/**
|
|
@@ -141,8 +142,8 @@ export class SourceController extends CorePlugin {
|
|
|
141
142
|
*/
|
|
142
143
|
bindEvents() {
|
|
143
144
|
super.bindEvents();
|
|
144
|
-
this.listenTo(this.core,
|
|
145
|
-
this.listenTo(this.core,
|
|
145
|
+
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
146
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
146
147
|
}
|
|
147
148
|
onCoreReady() {
|
|
148
149
|
trace(`${T} onCoreReady`);
|
|
@@ -169,7 +170,7 @@ export class SourceController extends CorePlugin {
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
bindContainerEventListeners() {
|
|
172
|
-
this.core.activePlayback.on(
|
|
173
|
+
this.core.activePlayback.on(Events.PLAYBACK_ERROR, (error) => {
|
|
173
174
|
trace(`${T} on PLAYBACK_ERROR`, {
|
|
174
175
|
error: {
|
|
175
176
|
code: error?.code,
|
|
@@ -183,6 +184,7 @@ export class SourceController extends CorePlugin {
|
|
|
183
184
|
if (this.switching) {
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
187
|
+
this.autoPlay = !!this.core.activeContainer.actionsMetadata.playEvent?.autoPlay;
|
|
186
188
|
switch (error.code) {
|
|
187
189
|
case PlaybackErrorCode.MediaSourceUnavailable:
|
|
188
190
|
this.core.activeContainer?.getPlugin('poster')?.disable();
|
|
@@ -192,7 +194,7 @@ export class SourceController extends CorePlugin {
|
|
|
192
194
|
break;
|
|
193
195
|
}
|
|
194
196
|
});
|
|
195
|
-
this.core.activePlayback.on(
|
|
197
|
+
this.core.activePlayback.on(Events.PLAYBACK_PLAY, () => {
|
|
196
198
|
trace(`${T} on PLAYBACK_PLAY`, {
|
|
197
199
|
currentSource: this.sourcesList[this.currentSourceIndex],
|
|
198
200
|
retrying: this.active,
|
|
@@ -203,6 +205,12 @@ export class SourceController extends CorePlugin {
|
|
|
203
205
|
this.core.activeContainer?.getPlugin('spinner')?.hide();
|
|
204
206
|
}
|
|
205
207
|
});
|
|
208
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAY, (_, { autoPlay }) => {
|
|
209
|
+
trace(`${T} onContainerPlay`, {
|
|
210
|
+
autoPlay,
|
|
211
|
+
});
|
|
212
|
+
this.autoPlay = !!autoPlay;
|
|
213
|
+
});
|
|
206
214
|
}
|
|
207
215
|
reset() {
|
|
208
216
|
this.active = false;
|
|
@@ -220,17 +228,20 @@ export class SourceController extends CorePlugin {
|
|
|
220
228
|
trace(`${T} retryPlayback syncing...`, {
|
|
221
229
|
nextSource,
|
|
222
230
|
});
|
|
223
|
-
const rnd = RETRY_DELAY_BLUR * Math.random();
|
|
231
|
+
const rnd = Math.round(RETRY_DELAY_BLUR * Math.random());
|
|
224
232
|
this.sync(() => {
|
|
225
|
-
trace(`${T} retryPlayback loading...`);
|
|
226
233
|
this.switching = false;
|
|
227
234
|
this.core.load(nextSource.source, nextSource.mimeType);
|
|
228
235
|
trace(`${T} retryPlayback loaded`, {
|
|
229
236
|
nextSource,
|
|
230
237
|
});
|
|
231
238
|
setTimeout(() => {
|
|
232
|
-
|
|
233
|
-
|
|
239
|
+
trace(`${T} retryPlayback playing`, {
|
|
240
|
+
autoPlay: this.autoPlay,
|
|
241
|
+
});
|
|
242
|
+
this.core.activeContainer.play({
|
|
243
|
+
autoPlay: this.autoPlay,
|
|
244
|
+
});
|
|
234
245
|
}, rnd);
|
|
235
246
|
});
|
|
236
247
|
});
|
package/lib/testUtils.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare function createMockPlayback(name?: string, options?: Record<strin
|
|
|
66
66
|
trigger: <T extends string | symbol>(event: T, ...args: any[]) => boolean;
|
|
67
67
|
};
|
|
68
68
|
export declare function createMockContainer(options?: Record<string, unknown>, playback?: any): Events<string | symbol, any> & {
|
|
69
|
+
actionsMetadata: {};
|
|
69
70
|
el: any;
|
|
70
71
|
playback: any;
|
|
71
72
|
options: {
|
package/lib/testUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;;EAsB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtF;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAAgD
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;;EAsB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtF;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAAgD;;;;;;;;;;;;;;;;;;;;;;;;;EA8B3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAmB/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
|
package/lib/testUtils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Events, template, UICorePlugin, Utils } from '@clappr/core'
|
|
2
2
|
import { trace } from '@gcorevideo/utils'
|
|
3
|
+
import assert from 'assert'
|
|
3
4
|
|
|
4
5
|
import { CLAPPR_VERSION } from '../../build.js'
|
|
5
|
-
import { ZeptoResult } from '../../types.js'
|
|
6
6
|
|
|
7
7
|
import volumeMuteIcon from '../../../assets/icons/new/volume-off.svg'
|
|
8
|
-
import
|
|
8
|
+
import templateHtml from '../../../assets/big-mute-button/big-mute-button.ejs'
|
|
9
9
|
import '../../../assets/big-mute-button/big-mute-button.scss'
|
|
10
10
|
|
|
11
11
|
const T = 'plugins.big_mute_button'
|
|
@@ -13,19 +13,22 @@ const T = 'plugins.big_mute_button'
|
|
|
13
13
|
// TODO rewrite as a container plugin
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
17
|
-
* Once pressed, it unmutes the video.
|
|
16
|
+
* `PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
18
17
|
* @beta
|
|
18
|
+
* @remarks
|
|
19
|
+
* When pressed, it unmutes the video.
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { BigMuteButton } from '@gcorevideo/player'
|
|
23
|
+
* Player.registerPlugin(BigMuteButton)
|
|
24
|
+
* ```
|
|
19
25
|
*/
|
|
20
26
|
export class BigMuteButton extends UICorePlugin {
|
|
21
|
-
private
|
|
27
|
+
private hidden = false
|
|
22
28
|
|
|
29
|
+
// TODO get back to the ads-related logic later
|
|
23
30
|
private _adIsPlaying = false
|
|
24
31
|
|
|
25
|
-
private $bigMuteBtnContainer: ZeptoResult | null = null
|
|
26
|
-
|
|
27
|
-
private $bigMuteButton: ZeptoResult | null = null
|
|
28
|
-
|
|
29
32
|
/**
|
|
30
33
|
* @internal
|
|
31
34
|
*/
|
|
@@ -40,15 +43,14 @@ export class BigMuteButton extends UICorePlugin {
|
|
|
40
43
|
return { min: CLAPPR_VERSION }
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
private static readonly template = template(
|
|
46
|
+
private static readonly template = template(templateHtml)
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
49
|
* @internal
|
|
47
50
|
*/
|
|
48
51
|
override get events() {
|
|
49
52
|
return {
|
|
50
|
-
'click
|
|
51
|
-
'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
|
|
53
|
+
'click': 'clicked',
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -57,156 +59,119 @@ export class BigMuteButton extends UICorePlugin {
|
|
|
57
59
|
*/
|
|
58
60
|
override bindEvents() {
|
|
59
61
|
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady)
|
|
62
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged)
|
|
60
63
|
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd)
|
|
61
64
|
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd)
|
|
62
|
-
trace(`${T} bindEvents`, {
|
|
63
|
-
mediacontrol: !!this.core.mediaControl,
|
|
64
|
-
})
|
|
65
|
-
// TOOD use core.getPlugin('media_control')
|
|
66
|
-
this.listenTo(
|
|
67
|
-
this.core.mediaControl,
|
|
68
|
-
Events.MEDIACONTROL_RENDERED,
|
|
69
|
-
this.mediaControlRendered,
|
|
70
|
-
)
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
private onCoreReady() {
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onContainerChanged() {
|
|
74
72
|
this.listenTo(
|
|
75
73
|
this.core.activeContainer,
|
|
76
74
|
Events.CONTAINER_VOLUME,
|
|
77
75
|
this.onContainerVolume,
|
|
78
76
|
)
|
|
79
|
-
this.listenTo(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
77
|
+
// this.listenTo(
|
|
78
|
+
// this.core.activeContainer,
|
|
79
|
+
// Events.CONTAINER_READY,
|
|
80
|
+
// this.onContainerReady,
|
|
81
|
+
// )
|
|
84
82
|
this.listenTo(
|
|
85
83
|
this.core.activePlayback,
|
|
86
84
|
Events.PLAYBACK_ENDED,
|
|
87
85
|
this.onPlaybackEnded,
|
|
88
86
|
)
|
|
87
|
+
this.listenTo(
|
|
88
|
+
this.core.activeContainer,
|
|
89
|
+
Events.CONTAINER_PLAY,
|
|
90
|
+
this.onPlay
|
|
91
|
+
)
|
|
89
92
|
}
|
|
90
93
|
|
|
91
|
-
private
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
private onPlay(_: string, { autoPlay }: { autoPlay?: boolean}) {
|
|
95
|
+
const container = this.core.activeContainer
|
|
96
|
+
const { volume } = container
|
|
97
|
+
const { wasMuted } = this.options
|
|
98
|
+
trace(`${T} onPlay`, {
|
|
99
|
+
autoPlay,
|
|
100
|
+
wasMuted,
|
|
101
|
+
volume,
|
|
102
|
+
})
|
|
103
|
+
if (autoPlay && !wasMuted && volume === 0) {
|
|
104
|
+
this.mount()
|
|
105
|
+
} else {
|
|
106
|
+
this.destroy()
|
|
94
107
|
}
|
|
95
108
|
}
|
|
96
109
|
|
|
97
|
-
private
|
|
98
|
-
if (
|
|
99
|
-
this.
|
|
110
|
+
private onContainerVolume(value: number) {
|
|
111
|
+
if (value !== 0) {
|
|
112
|
+
this.destroy()
|
|
100
113
|
}
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
private onPlaybackEnded() {
|
|
104
|
-
this.
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private mediaControlRendered() {
|
|
108
|
-
const container = this.core.activeContainer
|
|
109
|
-
|
|
110
|
-
trace(`${T} mediaControlRendered`, {
|
|
111
|
-
container: !!container,
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
if (container) {
|
|
115
|
-
this.listenTo(container.playback, Events.PLAYBACK_PLAY, () => {
|
|
116
|
-
trace(`${T} PLAYBACK_PLAY`)
|
|
117
|
-
this.render()
|
|
118
|
-
})
|
|
119
|
-
}
|
|
117
|
+
this.hide()
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
private onStartAd() {
|
|
123
121
|
this._adIsPlaying = true
|
|
124
|
-
|
|
125
|
-
this.$bigMuteBtnContainer.addClass('hide')
|
|
126
|
-
}
|
|
122
|
+
this.hide()
|
|
127
123
|
}
|
|
128
124
|
|
|
129
125
|
private onFinishAd() {
|
|
130
126
|
this._adIsPlaying = false
|
|
131
|
-
|
|
132
|
-
this.$bigMuteBtnContainer.removeClass('hide')
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private shouldRender() {
|
|
137
|
-
const container = this.core.activeContainer
|
|
138
|
-
|
|
139
|
-
if (!container) {
|
|
140
|
-
return false
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const { autoPlay, wasMuted } = this.options
|
|
144
|
-
const volume = container.volume
|
|
145
|
-
|
|
146
|
-
trace(`${T} shouldRender`, {
|
|
147
|
-
autoPlay,
|
|
148
|
-
wasMuted,
|
|
149
|
-
volume,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
return autoPlay && !wasMuted && volume === 0
|
|
127
|
+
this.show()
|
|
153
128
|
}
|
|
154
129
|
|
|
155
130
|
/**
|
|
156
131
|
* @internal
|
|
157
132
|
*/
|
|
158
133
|
override render() {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
this.$bigMuteBtnContainer = this.$el.find(
|
|
166
|
-
'.big-mute-icon-wrapper[data-big-mute]',
|
|
167
|
-
)
|
|
168
|
-
this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide')
|
|
169
|
-
|
|
170
|
-
this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon')
|
|
171
|
-
this.$bigMuteButton.append(volumeMuteIcon)
|
|
172
|
-
|
|
173
|
-
const container = this.core.activeContainer
|
|
174
|
-
|
|
175
|
-
container.$el.append(this.$el.get(0))
|
|
176
|
-
}
|
|
134
|
+
trace(`${T} render`)
|
|
135
|
+
this.$el.html(BigMuteButton.template())
|
|
136
|
+
this.$el.find('#gplayer-big-mute-icon').append(volumeMuteIcon)
|
|
137
|
+
|
|
138
|
+
// TODO
|
|
139
|
+
// this._adIsPlaying && this.hide()
|
|
177
140
|
|
|
178
141
|
return this
|
|
179
142
|
}
|
|
180
143
|
|
|
181
|
-
private
|
|
182
|
-
this.
|
|
183
|
-
this
|
|
144
|
+
private mount() {
|
|
145
|
+
this.core.activeContainer.$el.append(this.$el)
|
|
146
|
+
this.show()
|
|
184
147
|
}
|
|
185
148
|
|
|
186
|
-
private
|
|
187
|
-
this.
|
|
188
|
-
|
|
189
|
-
this.$bigMuteBtnContainer.removeClass('hide')
|
|
190
|
-
}
|
|
149
|
+
private hide() {
|
|
150
|
+
this.hidden = true
|
|
151
|
+
this.$el.find('#gplayer-big-mute-button')?.addClass('hide')
|
|
191
152
|
}
|
|
192
153
|
|
|
193
|
-
private
|
|
194
|
-
this.
|
|
195
|
-
|
|
196
|
-
if (e && e.stopPropagation) {
|
|
197
|
-
e.stopPropagation()
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
this.destroy()
|
|
154
|
+
private show() {
|
|
155
|
+
this.hidden = false
|
|
156
|
+
this.$el.find('#gplayer-big-mute-button')?.removeClass('hide')
|
|
201
157
|
}
|
|
202
158
|
|
|
203
159
|
private clicked(e: MouseEvent) {
|
|
160
|
+
trace(`${T} clicked`)
|
|
161
|
+
const mediaControl = this.core.getPlugin('media_control')
|
|
162
|
+
// TODO delegate to media_control plugin
|
|
204
163
|
const localVolume = Utils.Config.restore('volume')
|
|
205
164
|
const volume = !isNaN(localVolume) ? localVolume : 100
|
|
165
|
+
const unmuted = volume === 0 ? 100 : volume
|
|
206
166
|
|
|
207
|
-
|
|
208
|
-
|
|
167
|
+
if (mediaControl) {
|
|
168
|
+
mediaControl.setVolume(unmuted)
|
|
169
|
+
} else {
|
|
170
|
+
this.core.activeContainer.setVolume(unmuted)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
e.stopPropagation?.()
|
|
209
174
|
|
|
210
|
-
this.
|
|
175
|
+
this.destroy()
|
|
211
176
|
}
|
|
212
177
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { beforeEach, describe, it, expect } from 'vitest'
|
|
2
|
+
import { Events } from '@clappr/core'
|
|
3
|
+
|
|
4
|
+
import { BigMuteButton } from '../BigMuteButton.js'
|
|
5
|
+
import { createMockCore } from '../../../testUtils.js'
|
|
6
|
+
|
|
7
|
+
describe('BigMuteButton', () => {
|
|
8
|
+
let core: any
|
|
9
|
+
let bmb: BigMuteButton
|
|
10
|
+
describe('basically', () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
core = createMockCore({})
|
|
13
|
+
bmb = new BigMuteButton(core)
|
|
14
|
+
// core.emit('core:ready')
|
|
15
|
+
// core.emit('core:active:container:changed')
|
|
16
|
+
})
|
|
17
|
+
it('should render', () => {
|
|
18
|
+
expect(bmb.$el.html()).toMatchSnapshot()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
describe('when container starts playing', () => {
|
|
22
|
+
describe.each([
|
|
23
|
+
['muted autoplay', 0, { autoPlay: true }, true],
|
|
24
|
+
['audible autoplay', 50, { autoPlay: true }, false],
|
|
25
|
+
['muted not autoplay', 0, { }, false],
|
|
26
|
+
['audible not autoplay', 1, {}, false],
|
|
27
|
+
])("%s", (_, volume, playMetadata, shouldMount) => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
30
|
+
core.activeContainer.volume = volume
|
|
31
|
+
core.activeContainer.emit(Events.CONTAINER_PLAY, 'Container', playMetadata)
|
|
32
|
+
})
|
|
33
|
+
it(`should ${shouldMount ? 'mount' : 'not mount'} to container`, () => {
|
|
34
|
+
expect(core.activeContainer.$el.find('#gplayer-big-mute-button').length).toBe(shouldMount ? 1 : 0)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`BigMuteButton > basically > should render 1`] = `
|
|
4
|
+
"<div class="big-mute-icon-wrapper" data-big-mute="" id="gplayer-big-mute-button">
|
|
5
|
+
<div class="big-mute-icon gcore-skin-border-color" data-big-mute-icon="" id="gplayer-big-mute-icon">/assets/icons/new/volume-off.svg</div>
|
|
6
|
+
</div>
|
|
7
|
+
"
|
|
8
|
+
`;
|
|
@@ -20,7 +20,11 @@ import { isFullscreen } from '../utils/fullscreen.js'
|
|
|
20
20
|
|
|
21
21
|
// const T = 'plugins.clappr_stats'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Config options for the {@link ClapprStats} plugin
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export interface ClapprStatsSettings {
|
|
24
28
|
/**
|
|
25
29
|
* The interval in milliseconds of periodic measurements.
|
|
26
30
|
* The plugin will emit a {@link ClapprStatsEvents.REPORT} event with the collected metrics at the specified interval.
|
|
@@ -17,7 +17,7 @@ const T = 'plugins.clips'
|
|
|
17
17
|
*/
|
|
18
18
|
export interface ClipsPluginSettings {
|
|
19
19
|
/**
|
|
20
|
-
* The compiled text of the clips description, one clip per line in format
|
|
20
|
+
* The compiled text of the clips description, one clip per line in format:
|
|
21
21
|
* `HH:MM:SS text` or `MM:SS text` or `SS text`
|
|
22
22
|
*/
|
|
23
23
|
text: string
|
|
@@ -123,7 +123,8 @@ export class Clips extends UICorePlugin {
|
|
|
123
123
|
* @returns The text of the clip at the given time
|
|
124
124
|
*/
|
|
125
125
|
getText(time: TimeValue): string | undefined {
|
|
126
|
-
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
126
|
+
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
127
|
+
?.text
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
private onCoreReady() {
|