@gcorevideo/player 2.19.12 → 2.19.14
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 +16 -11
- package/dist/index.css +1405 -1405
- package/dist/index.js +1239 -1088
- package/dist/player.d.ts +209 -45
- package/dist/plugins/index.css +1461 -1461
- package/dist/plugins/index.js +4005 -3858
- package/docs/api/player.bottomgear.md +3 -289
- package/docs/api/player.dvrcontrols._constructor_.md +3 -0
- package/docs/api/player.dvrcontrols.md +10 -201
- package/docs/api/player.levelselector.md +8 -140
- package/docs/api/player.md +9 -5
- package/docs/api/player.mediacontrol.disable.md +2 -0
- package/docs/api/player.mediacontrol.disabledcontrolbutton.md +1 -1
- package/docs/api/player.mediacontrol.enable.md +2 -0
- package/docs/api/player.mediacontrol.enablecontrolbutton.md +1 -1
- package/docs/api/player.mediacontrol.getelement.md +19 -1
- package/docs/api/player.mediacontrol.md +17 -281
- package/docs/api/player.mediacontrol.volume.md +2 -2
- package/docs/api/player.mediacontrolelement.md +2 -1
- package/docs/api/player.poster.disable.md +5 -0
- package/docs/api/player.poster.enable.md +5 -0
- package/docs/api/player.poster.md +25 -183
- package/lib/Player.d.ts +1 -0
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +15 -10
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/plugins/audio-selector/AudioSelector.js +2 -2
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.js +2 -1
- package/lib/plugins/bottom-gear/BottomGear.d.ts +38 -7
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +53 -33
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +20 -24
- package/lib/plugins/clappr-stats/ClapprStats.js +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
- package/lib/plugins/clips/Clips.js +2 -2
- package/lib/plugins/context-menu/ContextMenu.js +1 -1
- package/lib/plugins/disable-controls/DisableControls.js +1 -1
- package/lib/plugins/dvr-controls/DvrControls.d.ts +30 -4
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +39 -11
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +2 -1
- package/lib/plugins/favicon/Favicon.js +1 -1
- package/lib/plugins/google-analytics/GoogleAnalytics.js +1 -1
- package/lib/plugins/level-selector/LevelSelector.d.ts +25 -6
- package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
- package/lib/plugins/level-selector/LevelSelector.js +33 -12
- package/lib/plugins/logo/Logo.js +1 -1
- package/lib/plugins/media-control/MediaControl.d.ts +66 -22
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +72 -35
- package/lib/plugins/multi-camera/MultiCamera.js +3 -3
- package/lib/plugins/picture-in-picture/PictureInPicture.js +3 -3
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +3 -3
- package/lib/plugins/poster/Poster.d.ts +57 -3
- package/lib/plugins/poster/Poster.d.ts.map +1 -1
- package/lib/plugins/poster/Poster.js +57 -9
- package/lib/plugins/seek-time/SeekTime.js +2 -2
- package/lib/plugins/share/Share.js +2 -2
- package/lib/plugins/skip-time/SkipTime.js +1 -1
- package/lib/plugins/source-controller/SourceController.js +1 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +1 -1
- package/lib/plugins/statistics/Statistics.js +1 -1
- package/lib/plugins/subtitles/Subtitles.js +3 -3
- package/lib/plugins/thumbnails/Thumbnails.js +3 -3
- package/lib/plugins/types.d.ts +1 -7
- package/lib/plugins/types.d.ts.map +1 -1
- package/lib/plugins/vast-ads/VastAds.d.ts +1 -0
- package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -1
- package/lib/plugins/vast-ads/VastAds.js +6 -3
- package/package.json +2 -1
- package/src/Player.ts +15 -9
- package/src/__tests__/Player.test.ts +15 -76
- package/src/index.ts +1 -0
- package/src/plugins/audio-selector/AudioSelector.ts +2 -2
- package/src/plugins/big-mute-button/BigMuteButton.ts +2 -1
- package/src/plugins/bottom-gear/BottomGear.ts +67 -42
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +21 -26
- package/src/plugins/clappr-stats/ClapprStats.ts +1 -1
- package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
- package/src/plugins/clips/Clips.ts +2 -2
- package/src/plugins/context-menu/ContextMenu.ts +1 -1
- package/src/plugins/disable-controls/DisableControls.ts +1 -1
- package/src/plugins/dvr-controls/DvrControls.ts +42 -14
- package/src/plugins/error-screen/ErrorScreen.ts +2 -1
- package/src/plugins/favicon/Favicon.ts +1 -1
- package/src/plugins/google-analytics/GoogleAnalytics.ts +1 -1
- package/src/plugins/level-selector/LevelSelector.ts +34 -14
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +22 -2
- package/src/plugins/logo/Logo.ts +1 -1
- package/src/plugins/media-control/MediaControl.ts +83 -44
- package/src/plugins/multi-camera/MultiCamera.ts +3 -3
- package/src/plugins/picture-in-picture/PictureInPicture.ts +3 -3
- package/src/plugins/playback-rate/PlaybackRate.ts +3 -4
- package/src/plugins/poster/Poster.ts +59 -12
- package/src/plugins/seek-time/SeekTime.ts +2 -2
- package/src/plugins/share/Share.ts +2 -2
- package/src/plugins/skip-time/SkipTime.ts +1 -1
- package/src/plugins/source-controller/SourceController.ts +1 -1
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +5 -0
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +1 -1
- package/src/plugins/statistics/Statistics.ts +1 -1
- package/src/plugins/subtitles/Subtitles.ts +3 -3
- package/src/plugins/thumbnails/Thumbnails.ts +3 -3
- package/src/plugins/types.ts +1 -0
- package/src/plugins/vast-ads/VastAds.ts +6 -6
- package/temp/player.api.json +3301 -5030
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.bottomgear.attributes.md +0 -17
- package/docs/api/player.bottomgear.bindevents.md +0 -18
- package/docs/api/player.bottomgear.container.md +0 -14
- package/docs/api/player.bottomgear.events.md +0 -16
- package/docs/api/player.bottomgear.hide.md +0 -18
- package/docs/api/player.bottomgear.name.md +0 -14
- package/docs/api/player.bottomgear.refresh.md +0 -18
- package/docs/api/player.bottomgear.reload.md +0 -18
- package/docs/api/player.bottomgear.render.md +0 -18
- package/docs/api/player.bottomgear.supportedversion.md +0 -16
- package/docs/api/player.bottomgear.template.md +0 -14
- package/docs/api/player.bottomgear.togglegearmenu.md +0 -18
- package/docs/api/player.bottomgear.unbindevents.md +0 -18
- package/docs/api/player.bottomgear.version.md +0 -14
- package/docs/api/player.dvrcontrols.attributes.md +0 -14
- package/docs/api/player.dvrcontrols.bindevents.md +0 -15
- package/docs/api/player.dvrcontrols.click.md +0 -15
- package/docs/api/player.dvrcontrols.events.md +0 -13
- package/docs/api/player.dvrcontrols.name.md +0 -11
- package/docs/api/player.dvrcontrols.render.md +0 -15
- package/docs/api/player.dvrcontrols.settingsupdate.md +0 -15
- package/docs/api/player.dvrcontrols.shouldrender.md +0 -15
- package/docs/api/player.dvrcontrols.supportedversion.md +0 -13
- package/docs/api/player.dvrcontrols.template.md +0 -11
- package/docs/api/player.levelselector.attributes.md +0 -17
- package/docs/api/player.levelselector.bindevents.md +0 -18
- package/docs/api/player.levelselector.name.md +0 -14
- package/docs/api/player.levelselector.render.md +0 -18
- package/docs/api/player.levelselector.supportedversion.md +0 -16
- package/docs/api/player.levelselector.version.md +0 -14
- package/docs/api/player.mediacontrol.attributes.md +0 -17
- package/docs/api/player.mediacontrol.bindcontainerevents.md +0 -18
- package/docs/api/player.mediacontrol.bindevents.md +0 -18
- package/docs/api/player.mediacontrol.container.md +0 -14
- package/docs/api/player.mediacontrol.destroy.md +0 -18
- package/docs/api/player.mediacontrol.disabled.md +0 -14
- package/docs/api/player.mediacontrol.events.md +0 -40
- package/docs/api/player.mediacontrol.getexternalinterface.md +0 -21
- package/docs/api/player.mediacontrol.name.md +0 -14
- package/docs/api/player.mediacontrol.pause.md +0 -20
- package/docs/api/player.mediacontrol.play.md +0 -20
- package/docs/api/player.mediacontrol.playback.md +0 -14
- package/docs/api/player.mediacontrol.render.md +0 -18
- package/docs/api/player.mediacontrol.setmuted.md +0 -52
- package/docs/api/player.mediacontrol.stop.md +0 -20
- package/docs/api/player.mediacontrol.supportedversion.md +0 -16
- package/docs/api/player.poster.attributes.md +0 -14
- package/docs/api/player.poster.bindevents.md +0 -15
- package/docs/api/player.poster.destroy.md +0 -15
- package/docs/api/player.poster.events.md +0 -13
- package/docs/api/player.poster.name.md +0 -11
- package/docs/api/player.poster.render.md +0 -15
- package/docs/api/player.poster.shouldrender.md +0 -11
- package/docs/api/player.poster.showonvideoend.md +0 -11
- package/docs/api/player.poster.supportedversion.md +0 -13
- package/docs/api/player.poster.template.md +0 -11
- package/src/plugins/build.ts +0 -1
|
@@ -1,38 +1,65 @@
|
|
|
1
|
-
import { UICorePlugin, template, Events } from '@clappr/core';
|
|
1
|
+
import { UICorePlugin, template, Events as ClapprEvents } from '@clappr/core';
|
|
2
2
|
import { trace } from '@gcorevideo/utils';
|
|
3
|
+
import assert from 'assert';
|
|
3
4
|
|
|
4
|
-
import { CLAPPR_VERSION } from '
|
|
5
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
5
6
|
|
|
6
7
|
import pluginHtml from '../../../assets/bottom-gear/bottomgear.ejs';
|
|
7
8
|
import '../../../assets/bottom-gear/gear.scss';
|
|
8
9
|
import '../../../assets/bottom-gear/gear-sub-menu.scss';
|
|
9
10
|
import gearIcon from '../../../assets/icons/new/gear.svg';
|
|
10
11
|
import gearHdIcon from '../../../assets/icons/new/gear-hd.svg';
|
|
12
|
+
import { ZeptoResult } from '../../utils/types.js';
|
|
11
13
|
|
|
12
|
-
const VERSION = '
|
|
14
|
+
const VERSION = '2.19.12';
|
|
15
|
+
|
|
16
|
+
const T = 'plugins.media_control_gear';
|
|
17
|
+
|
|
18
|
+
export enum Events {
|
|
19
|
+
MEDIACONTROL_GEAR_RENDERED = 'mediacontrol:gear:rendered',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An element inside the gear menu
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
export type GearItemElement = 'quality' | 'rate' | 'nerd';
|
|
13
27
|
|
|
14
28
|
/**
|
|
29
|
+
* Adds the gear button that triggers extra options menu on the right side of the {@link MediaControl | media control} UI
|
|
15
30
|
* @beta
|
|
31
|
+
* @remarks
|
|
32
|
+
* The plugins provides a base for attaching custom settings UI in the gear menu
|
|
16
33
|
*/
|
|
17
34
|
export class BottomGear extends UICorePlugin {
|
|
18
35
|
private isHd = false;
|
|
19
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
20
40
|
get name() {
|
|
21
|
-
return '
|
|
41
|
+
return 'media_control_gear';
|
|
22
42
|
}
|
|
23
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
24
47
|
get supportedVersion() {
|
|
25
48
|
return { min: CLAPPR_VERSION };
|
|
26
49
|
}
|
|
27
50
|
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
28
54
|
static get version() {
|
|
29
55
|
return VERSION;
|
|
30
56
|
}
|
|
31
57
|
|
|
32
|
-
|
|
33
|
-
return template(pluginHtml);
|
|
34
|
-
}
|
|
58
|
+
private static readonly template = template(pluginHtml)
|
|
35
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
36
63
|
override get attributes() {
|
|
37
64
|
return {
|
|
38
65
|
'class': this.name,
|
|
@@ -40,47 +67,40 @@ export class BottomGear extends UICorePlugin {
|
|
|
40
67
|
};
|
|
41
68
|
}
|
|
42
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
43
73
|
override get events() {
|
|
44
74
|
return {
|
|
45
75
|
'click .button-gear': 'toggleGearMenu',
|
|
46
76
|
};
|
|
47
77
|
}
|
|
48
78
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
53
82
|
override bindEvents() {
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.listenTo(this.core
|
|
58
|
-
this.listenTo(this.core
|
|
59
|
-
this.
|
|
83
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
84
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
85
|
+
|
|
86
|
+
this.listenTo(this.core, ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
87
|
+
this.listenTo(this.core, 'gear:refresh', this.refresh); // TODO use direct plugin method call
|
|
88
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_RENDERED, this.render);
|
|
89
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.hide); // TODO mediacontrol show as well
|
|
60
90
|
}
|
|
61
91
|
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
65
|
-
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
66
|
-
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hide);
|
|
92
|
+
getElement(name: GearItemElement): ZeptoResult | null {
|
|
93
|
+
return this.core.getPlugin('media_control')?.getElement('gear')?.find(`.gear-options-list [data-${name}]`);
|
|
67
94
|
}
|
|
68
95
|
|
|
69
96
|
private onActiveContainerChanged() {
|
|
70
|
-
|
|
97
|
+
trace(`${T} onActiveContainerChanged`);
|
|
71
98
|
this.bindContainerEvents();
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
private bindContainerEvents() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
reload() {
|
|
82
|
-
this.unBindEvents();
|
|
83
|
-
this.bindEvents();
|
|
102
|
+
trace(`${T} bindContainerEvents`);
|
|
103
|
+
this.listenTo(this.core.activeContainer, ClapprEvents.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
|
|
84
104
|
}
|
|
85
105
|
|
|
86
106
|
private highDefinitionUpdate(isHd: boolean) {
|
|
@@ -93,33 +113,38 @@ export class BottomGear extends UICorePlugin {
|
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
96
119
|
override render() {
|
|
97
|
-
const
|
|
120
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
121
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
122
|
+
|
|
123
|
+
// TODO use options.mediaControl.gear.items
|
|
124
|
+
const items: GearItemElement[] = [
|
|
98
125
|
'quality',
|
|
99
126
|
'rate',
|
|
100
127
|
'nerd',
|
|
101
128
|
];
|
|
102
|
-
|
|
103
129
|
const icon = this.isHd ? gearHdIcon : gearIcon;
|
|
130
|
+
this.$el.html(BottomGear.template({ icon, items }));
|
|
104
131
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.core.trigger('gear:rendered');
|
|
109
|
-
|
|
132
|
+
mediaControl.getElement('gear')?.html(this.el);
|
|
133
|
+
this.core.trigger('gear:rendered'); // @deprecated
|
|
134
|
+
mediaControl.trigger(Events.MEDIACONTROL_GEAR_RENDERED);
|
|
110
135
|
return this;
|
|
111
136
|
}
|
|
112
137
|
|
|
113
|
-
refresh() {
|
|
138
|
+
private refresh() {
|
|
114
139
|
this.render();
|
|
115
140
|
this.$el.find('.gear-wrapper').show();
|
|
116
141
|
}
|
|
117
142
|
|
|
118
|
-
toggleGearMenu() {
|
|
143
|
+
private toggleGearMenu() {
|
|
119
144
|
this.$el.find('.gear-wrapper').toggle();
|
|
120
145
|
}
|
|
121
146
|
|
|
122
|
-
hide() {
|
|
147
|
+
private hide() {
|
|
123
148
|
this.$el.find('.gear-wrapper').hide();
|
|
124
149
|
}
|
|
125
150
|
}
|
|
@@ -2,7 +2,7 @@ import { UICorePlugin, Events, template, Core, Container } from '@clappr/core';
|
|
|
2
2
|
import { reportError } from '@gcorevideo/utils';
|
|
3
3
|
import Mousetrap from 'mousetrap';
|
|
4
4
|
|
|
5
|
-
import { CLAPPR_VERSION } from '
|
|
5
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
6
6
|
import { ClapprStatsEvents, Metrics as BaseMetrics } from '../clappr-stats/types.js';
|
|
7
7
|
import { newMetrics as newBaseMetrics } from '../clappr-stats/utils.js';
|
|
8
8
|
import Formatter from './formatter.js';
|
|
@@ -21,6 +21,9 @@ import '../../../assets/clappr-nerd-stats/clappr-nerd-stats.scss';
|
|
|
21
21
|
import pluginHtml from '../../../assets/clappr-nerd-stats/clappr-nerd-stats.ejs';
|
|
22
22
|
import buttonHtml from '../../../assets/clappr-nerd-stats/button.ejs';
|
|
23
23
|
import statsIcon from '../../../assets/icons/new/stats.svg';
|
|
24
|
+
import { BottomGear, Events as BottomGearEvents } from '../bottom-gear/BottomGear.js';
|
|
25
|
+
import { MediaControl } from '../media-control/MediaControl.js';
|
|
26
|
+
import assert from 'assert';
|
|
24
27
|
|
|
25
28
|
const qualityClasses = [
|
|
26
29
|
'speedtest-quality-value-1',
|
|
@@ -125,7 +128,7 @@ export class ClapprNerdStats extends UICorePlugin {
|
|
|
125
128
|
private iconPosition: IconPosition;
|
|
126
129
|
|
|
127
130
|
get name() {
|
|
128
|
-
return '
|
|
131
|
+
return 'media_control_nerd_stats';
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
get supportedVersion() {
|
|
@@ -180,8 +183,10 @@ export class ClapprNerdStats extends UICorePlugin {
|
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
override bindEvents() {
|
|
186
|
+
const mediaControl = this.core.getPlugin('media_control') as MediaControl;
|
|
187
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
183
188
|
this.listenToOnce(this.core, Events.CORE_READY, this.init);
|
|
184
|
-
this.listenTo(
|
|
189
|
+
this.listenTo(mediaControl, BottomGearEvents.MEDIACONTROL_GEAR_RENDERED, this.addToBottomGear);
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
private init() {
|
|
@@ -196,33 +201,27 @@ export class ClapprNerdStats extends UICorePlugin {
|
|
|
196
201
|
'For more info, visit: https://github.com/clappr/clappr-stats.');
|
|
197
202
|
this.disable();
|
|
198
203
|
} else {
|
|
199
|
-
Mousetrap.bind(this.shortcut, () => this.
|
|
204
|
+
Mousetrap.bind(this.shortcut, () => this.toggle());
|
|
200
205
|
this.listenTo(this.core, Events.CORE_RESIZE, this.onPlayerResize);
|
|
201
206
|
// TODO: fix
|
|
202
207
|
this.listenTo(clapprStats, ClapprStatsEvents.REPORT_EVENT, this.updateMetrics);
|
|
203
208
|
clapprStats.setUpdateMetrics(this.updateMetrics.bind(this));
|
|
204
209
|
this.updateMetrics(clapprStats.exportMetrics());
|
|
205
210
|
this.render();
|
|
206
|
-
// this.$el.find('.speed-test-button').on('click', this.onSpeedTestClick.bind(this));
|
|
207
|
-
// this.$el.find('.close-speed-test').on('click', this.closeSpeedTest.bind(this));
|
|
208
|
-
// this.$el.find('.speed-test').hide();
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
private
|
|
214
|
+
private toggle() {
|
|
213
215
|
if (this.showing) {
|
|
214
|
-
this.hide(
|
|
216
|
+
this.hide();
|
|
215
217
|
} else {
|
|
216
|
-
this.show(
|
|
218
|
+
this.show();
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
220
|
-
private show(
|
|
222
|
+
private show() {
|
|
221
223
|
this.core.$el.find(this.statsBoxElem).show();
|
|
222
224
|
this.showing = true;
|
|
223
|
-
if (event) {
|
|
224
|
-
event.stopPropagation();
|
|
225
|
-
}
|
|
226
225
|
|
|
227
226
|
this.refreshSpeedTest();
|
|
228
227
|
initSpeedTest(this.customMetrics).then(() => {
|
|
@@ -233,13 +232,9 @@ export class ClapprNerdStats extends UICorePlugin {
|
|
|
233
232
|
})
|
|
234
233
|
}
|
|
235
234
|
|
|
236
|
-
private hide(
|
|
235
|
+
private hide() {
|
|
237
236
|
this.core.$el.find(this.statsBoxElem).hide();
|
|
238
237
|
this.showing = false;
|
|
239
|
-
if (event) {
|
|
240
|
-
event.stopPropagation();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
238
|
stopSpeedtest();
|
|
244
239
|
}
|
|
245
240
|
|
|
@@ -321,16 +316,16 @@ export class ClapprNerdStats extends UICorePlugin {
|
|
|
321
316
|
}
|
|
322
317
|
|
|
323
318
|
private addToBottomGear() {
|
|
324
|
-
this.core.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const $button =
|
|
319
|
+
const gear = this.core.getPlugin('media_control_gear') as BottomGear;
|
|
320
|
+
const $el = gear.getElement('nerd')
|
|
321
|
+
$el.html(buttonHtml)
|
|
322
|
+
const $button = $el.find('.nerd-button');
|
|
328
323
|
|
|
329
324
|
$button.find('.stats-icon').html(statsIcon);
|
|
330
325
|
|
|
331
|
-
$button.on('click', () => {
|
|
332
|
-
|
|
333
|
-
this.
|
|
326
|
+
$button.on('click', (e: MouseEvent) => {
|
|
327
|
+
e.stopPropagation();
|
|
328
|
+
this.toggle();
|
|
334
329
|
});
|
|
335
330
|
}
|
|
336
331
|
|
|
@@ -2,7 +2,7 @@ import { Container, ContainerPlugin, Events as CoreEvents, Log } from '@clappr/c
|
|
|
2
2
|
import type { QualityLevel, TimePosition, TimeProgress } from '../../playback.types.js';
|
|
3
3
|
import assert from 'assert';
|
|
4
4
|
|
|
5
|
-
import { CLAPPR_VERSION } from '
|
|
5
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
6
6
|
import { TimerId } from '../../utils/types.js';
|
|
7
7
|
import type { Metrics, MetricsUpdateFn } from './types.js';
|
|
8
8
|
import { ClapprStatsEvents } from './types.js';
|
|
@@ -29,7 +29,7 @@ export class ClipsPlugin extends UICorePlugin {
|
|
|
29
29
|
private svgMask: ZeptoResult | null = null;
|
|
30
30
|
|
|
31
31
|
get name() {
|
|
32
|
-
return '
|
|
32
|
+
return 'media_control_clips';
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
override get attributes() {
|
|
@@ -154,7 +154,7 @@ export class ClipsPlugin extends UICorePlugin {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
private setSVGMask(svg: string) {
|
|
157
|
-
this.core.mediaControl.setSVGMask(svg);
|
|
157
|
+
// this.core.mediaControl.setSVGMask(svg);
|
|
158
158
|
if (this.svgMask) {
|
|
159
159
|
this.svgMask.remove()
|
|
160
160
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UICorePlugin, Events, template, $, Core, Container } from '@clappr/core';
|
|
2
2
|
|
|
3
|
-
import { CLAPPR_VERSION } from '
|
|
3
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
4
|
|
|
5
5
|
import '../../../assets/context-menu/context_menu.scss';
|
|
6
6
|
import templateHtml from '../../../assets/context-menu/context_menu.ejs';
|
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
import { Core, Events, Playback, UICorePlugin, template } from '@clappr/core';
|
|
2
|
+
import assert from 'assert';
|
|
2
3
|
|
|
3
|
-
import { CLAPPR_VERSION } from '
|
|
4
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
5
|
|
|
5
6
|
import dvrHTML from '../../../assets/dvr-controls/index.ejs';
|
|
6
7
|
import '../../../assets/dvr-controls/dvr_controls.scss';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Adds the DVR controls to the media control UI
|
|
11
|
+
* @beta
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* The plugin is rendered in the {@link MediaControl | media control} UI.
|
|
15
|
+
* It renders the live stream indicator and the DVR seek bar if DVR is enabled.
|
|
16
|
+
*/
|
|
8
17
|
export class DvrControls extends UICorePlugin {
|
|
9
|
-
|
|
10
|
-
return template(dvrHTML);
|
|
11
|
-
}
|
|
18
|
+
private static readonly template = template(dvrHTML);
|
|
12
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
13
23
|
get name() {
|
|
14
|
-
return '
|
|
24
|
+
return 'media_control_dvr';
|
|
15
25
|
}
|
|
16
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
17
30
|
get supportedVersion() {
|
|
18
31
|
return { min: CLAPPR_VERSION };
|
|
19
32
|
}
|
|
20
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
21
37
|
override get events() {
|
|
22
38
|
return {
|
|
23
39
|
'click .live-button': 'click'
|
|
24
40
|
};
|
|
25
41
|
}
|
|
26
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
27
46
|
override get attributes() {
|
|
28
47
|
return {
|
|
29
48
|
'class': 'dvr-controls',
|
|
@@ -36,6 +55,9 @@ export class DvrControls extends UICorePlugin {
|
|
|
36
55
|
this.settingsUpdate();
|
|
37
56
|
}
|
|
38
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
39
61
|
override bindEvents() {
|
|
40
62
|
this.bindCoreEvents();
|
|
41
63
|
this.bindContainerEvents();
|
|
@@ -86,9 +108,9 @@ export class DvrControls extends UICorePlugin {
|
|
|
86
108
|
}
|
|
87
109
|
}
|
|
88
110
|
|
|
89
|
-
click() {
|
|
90
|
-
const mediaControl = this.core.
|
|
91
|
-
const container =
|
|
111
|
+
private click() {
|
|
112
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
113
|
+
const container = this.core.activeContainer;
|
|
92
114
|
|
|
93
115
|
if (!container.isPlaying()) {
|
|
94
116
|
container.play();
|
|
@@ -99,9 +121,9 @@ export class DvrControls extends UICorePlugin {
|
|
|
99
121
|
}
|
|
100
122
|
}
|
|
101
123
|
|
|
102
|
-
settingsUpdate() {
|
|
124
|
+
private settingsUpdate() {
|
|
103
125
|
// @ts-ignore
|
|
104
|
-
this.stopListening();
|
|
126
|
+
this.stopListening(); // TODO sort out
|
|
105
127
|
this.core.mediaControl.$el.removeClass('live');
|
|
106
128
|
if (this.shouldRender()) {
|
|
107
129
|
this.render();
|
|
@@ -110,20 +132,26 @@ export class DvrControls extends UICorePlugin {
|
|
|
110
132
|
this.bindEvents();
|
|
111
133
|
}
|
|
112
134
|
|
|
113
|
-
shouldRender() {
|
|
135
|
+
private shouldRender() {
|
|
114
136
|
const useDvrControls = this.core.options.useDvrControls === undefined || !!this.core.options.useDvrControls;
|
|
115
137
|
|
|
116
138
|
return useDvrControls && this.core.getPlaybackType() === Playback.LIVE;
|
|
117
139
|
}
|
|
118
140
|
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
119
144
|
override render() {
|
|
120
|
-
this.$el.html(
|
|
145
|
+
this.$el.html(DvrControls.template({
|
|
121
146
|
live: this.core.i18n.t('live'),
|
|
122
147
|
backToLive: this.core.i18n.t('back_to_live')
|
|
123
148
|
}));
|
|
124
149
|
if (this.shouldRender()) {
|
|
125
|
-
this.core.mediaControl
|
|
126
|
-
|
|
150
|
+
const mediaControl = this.core.mediaControl;
|
|
151
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
152
|
+
// TODO don't tap into the $el directly
|
|
153
|
+
mediaControl.$el.addClass('live');
|
|
154
|
+
mediaControl.$('.media-control-left-panel[data-media-control]').append(this.$el);
|
|
127
155
|
}
|
|
128
156
|
|
|
129
157
|
return this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UICorePlugin, Events, template, PlayerError } from '@clappr/core';
|
|
2
2
|
import { trace } from '@gcorevideo/utils';
|
|
3
3
|
|
|
4
|
-
import { CLAPPR_VERSION } from '
|
|
4
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
5
5
|
import type { TimerId, ZeptoResult } from '../../utils/types.js';
|
|
6
6
|
|
|
7
7
|
import reloadIcon from '../../../assets/icons/old/reload.svg';
|
|
@@ -217,6 +217,7 @@ export class ErrorScreen extends UICorePlugin {
|
|
|
217
217
|
if (err) {
|
|
218
218
|
this.err = err;
|
|
219
219
|
}
|
|
220
|
+
// TODO use container.disableMediaControl() instead
|
|
220
221
|
this.core.mediaControl.disable();
|
|
221
222
|
this.render();
|
|
222
223
|
this.$el.show();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CorePlugin, Events, $, Core, Container } from '@clappr/core';
|
|
2
2
|
|
|
3
|
-
import { CLAPPR_VERSION } from '
|
|
3
|
+
import { CLAPPR_VERSION } from '../../build.js';
|
|
4
4
|
import { ZeptoResult } from '../../utils/types.js';
|
|
5
5
|
|
|
6
6
|
import playIcon from '../../../assets/icons/new/play.svg';
|
|
@@ -2,8 +2,9 @@ import { Events, template, UICorePlugin } from '@clappr/core'
|
|
|
2
2
|
import { reportError, trace } from '@gcorevideo/utils'
|
|
3
3
|
|
|
4
4
|
import { type QualityLevel } from '../../playback.types.js'
|
|
5
|
-
import { CLAPPR_VERSION } from '
|
|
5
|
+
import { CLAPPR_VERSION } from '../../build.js'
|
|
6
6
|
import { ZeptoResult } from '../../utils/types.js'
|
|
7
|
+
import { TemplateFunction } from '../types.js'
|
|
7
8
|
|
|
8
9
|
import buttonHtml from '../../../assets/level-selector/button.ejs'
|
|
9
10
|
import listHtml from '../../../assets/level-selector/list.ejs'
|
|
@@ -14,32 +15,31 @@ import checkIcon from '../../../assets/icons/new/check.svg'
|
|
|
14
15
|
import '../../../assets/level-selector/style.scss'
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
const T = 'plugins.
|
|
18
|
+
const T = 'plugins.media_control_level_selector'
|
|
18
19
|
const VERSION = '2.19.4'
|
|
19
20
|
|
|
20
|
-
type TemplateFunction = (data: Record<string, unknown>) => string
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
|
-
*
|
|
22
|
+
* A {@link MediaControl | media control} plugin that provides a UI to control the quality level of the playback.
|
|
24
23
|
* @beta
|
|
25
24
|
*
|
|
26
25
|
* @remarks
|
|
27
|
-
* The plugin is rendered as a button in the gear menu.
|
|
26
|
+
* The plugin is rendered as a button in the {@link BottomGear | gear menu}.
|
|
28
27
|
* When clicked, it shows a list of quality levels to choose from.
|
|
29
28
|
*
|
|
30
29
|
* Configuration options:
|
|
31
30
|
*
|
|
32
|
-
* - `labels`: The labels to show in the level selector. [
|
|
31
|
+
* - `labels`: The labels to show in the level selector. [video resolution]: string
|
|
32
|
+
*
|
|
33
33
|
* - `restrictResolution`: The maximum resolution to allow in the level selector.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
37
|
-
* {
|
|
37
|
+
* new Player({
|
|
38
38
|
* levelSelector: {
|
|
39
39
|
* restrictResolution: 360,
|
|
40
|
-
* labels: { 360: '
|
|
40
|
+
* labels: { 360: 'SD', 720: 'HD' },
|
|
41
41
|
* },
|
|
42
|
-
* }
|
|
42
|
+
* })
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export class LevelSelector extends UICorePlugin {
|
|
@@ -57,18 +57,30 @@ export class LevelSelector extends UICorePlugin {
|
|
|
57
57
|
|
|
58
58
|
private listTemplate: TemplateFunction | null = null
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
60
63
|
get name() {
|
|
61
|
-
return '
|
|
64
|
+
return 'media_control_level_selector'
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
64
70
|
get supportedVersion() {
|
|
65
71
|
return { min: CLAPPR_VERSION }
|
|
66
72
|
}
|
|
67
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
68
77
|
static get version() {
|
|
69
78
|
return VERSION
|
|
70
79
|
}
|
|
71
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
72
84
|
override get attributes() {
|
|
73
85
|
return {
|
|
74
86
|
class: this.name,
|
|
@@ -88,6 +100,9 @@ export class LevelSelector extends UICorePlugin {
|
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
91
106
|
override bindEvents() {
|
|
92
107
|
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, () => this.bindPlaybackEvents())
|
|
93
108
|
this.listenTo(this.core, 'gear:rendered', this.render)
|
|
@@ -164,6 +179,9 @@ export class LevelSelector extends UICorePlugin {
|
|
|
164
179
|
return !!(this.levels && this.levels.length > 1)
|
|
165
180
|
}
|
|
166
181
|
|
|
182
|
+
/**
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
167
185
|
override render() {
|
|
168
186
|
if (!this.shouldRender()) {
|
|
169
187
|
return this
|
|
@@ -186,9 +204,10 @@ export class LevelSelector extends UICorePlugin {
|
|
|
186
204
|
hdIcon,
|
|
187
205
|
})
|
|
188
206
|
this.$el.html(html)
|
|
189
|
-
this.core.
|
|
207
|
+
const mediaControl = this.core.getPlugin('media_control')
|
|
208
|
+
mediaControl.getElement('bottomGear')
|
|
190
209
|
?.find('.gear-options-list [data-quality]')
|
|
191
|
-
|
|
210
|
+
?.html(this.el)
|
|
192
211
|
}
|
|
193
212
|
}
|
|
194
213
|
|
|
@@ -205,7 +224,8 @@ export class LevelSelector extends UICorePlugin {
|
|
|
205
224
|
removeAuto: this.removeAuto,
|
|
206
225
|
})
|
|
207
226
|
this.$el.html(html)
|
|
208
|
-
this.core.
|
|
227
|
+
const mediaControl = this.core.getPlugin('media_control')
|
|
228
|
+
mediaControl.getElement('bottomGear')?.find('.gear-wrapper').html(this.el)
|
|
209
229
|
}
|
|
210
230
|
|
|
211
231
|
private get maxLevel() {
|