@gcorevideo/player 2.22.18 → 2.22.21
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/audio-selector/track-selector.ejs +3 -3
- package/assets/bottom-gear/bottomgear.ejs +3 -3
- package/assets/dvr-controls/dvr_controls.scss +0 -12
- package/assets/level-selector/button.ejs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.css +664 -671
- package/dist/index.js +285 -260
- package/dist/player.d.ts +144 -123
- package/dist/plugins/index.css +758 -765
- package/dist/plugins/index.js +194 -172
- package/docs/api/player.clapprstats.exportmetrics.md +2 -2
- package/docs/api/player.clapprstats.md +0 -4
- package/docs/api/player.clapprstatsbitratetrack.md +20 -0
- package/docs/api/player.clapprstatschronograph.md +115 -0
- package/docs/api/player.clapprstatscounter.md +211 -0
- package/docs/api/player.clapprstatsevents.md +51 -0
- package/docs/api/player.clapprstatsmetrics.md +52 -0
- package/docs/api/player.clipspluginsettings.md +1 -1
- package/docs/api/player.gearevents.md +1 -1
- package/docs/api/player.md +57 -2
- package/docs/api/player.mediacontrol.mount.md +0 -5
- package/docs/api/player.mediacontrol.putelement.md +5 -0
- package/docs/api/player.mediacontrol.toggleelement.md +1 -1
- package/docs/api/player.nerdstats.md +3 -3
- package/docs/api/player.playerconfig.md +1 -1
- package/docs/api/player.playerconfig.playbacktype.md +6 -1
- package/docs/api/player.timeupdate.md +6 -3
- package/lib/plugins/audio-selector/AudioSelector.d.ts +1 -1
- package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioSelector.js +15 -8
- package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +2 -2
- package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +4 -4
- package/lib/plugins/clappr-nerd-stats/NerdStats.js +4 -4
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +5 -2
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/ClapprStats.js +31 -33
- package/lib/plugins/clappr-stats/types.d.ts +21 -21
- package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
- package/lib/plugins/clappr-stats/types.js +22 -22
- package/lib/plugins/clappr-stats/utils.d.ts +2 -2
- package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
- package/lib/plugins/clips/Clips.d.ts +1 -1
- package/lib/plugins/dvr-controls/DvrControls.d.ts +6 -2
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +39 -27
- package/lib/plugins/media-control/MediaControl.d.ts +9 -2
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +26 -10
- package/lib/plugins/picture-in-picture/PictureInPicture.js +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +1 -1
- package/lib/plugins/vast-ads/VastAds.js +1 -1
- package/lib/plugins/vast-ads/rollmanager.js +1 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts +25 -10
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +62 -60
- package/lib/testUtils.d.ts.map +1 -1
- package/lib/testUtils.js +7 -4
- package/lib/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/playback/__tests__/HTML5Video.test.ts +2 -2
- package/src/plugins/audio-selector/AudioSelector.ts +14 -7
- package/src/plugins/audio-selector/__tests__/AudioSelector.test.ts +8 -8
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +15 -15
- package/src/plugins/bottom-gear/BottomGear.ts +2 -2
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +8 -5
- package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +3 -3
- package/src/plugins/clappr-nerd-stats/NerdStats.ts +5 -5
- package/src/plugins/clappr-stats/ClapprStats.ts +41 -40
- package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +12 -12
- package/src/plugins/clappr-stats/types.ts +21 -21
- package/src/plugins/clappr-stats/utils.ts +2 -2
- package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
- package/src/plugins/clips/Clips.ts +1 -1
- package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
- package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +1 -1
- package/src/plugins/dvr-controls/DvrControls.ts +51 -37
- package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +84 -26
- package/src/plugins/dvr-controls/__tests__/__snapshots__/DvrControls.test.ts.snap +0 -12
- package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +1 -1
- package/src/plugins/media-control/MediaControl.ts +27 -10
- package/src/plugins/media-control/__tests__/MediaControl.test.ts +8 -5
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +20 -20
- package/src/plugins/picture-in-picture/PictureInPicture.ts +1 -1
- package/src/plugins/subtitles/ClosedCaptions.ts +1 -1
- package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -1
- package/src/plugins/vast-ads/VastAds.ts +1 -1
- package/src/plugins/vast-ads/rollmanager.ts +1 -1
- package/src/plugins/volume-fade/VolumeFade.ts +92 -75
- package/src/testUtils.ts +11 -5
- package/src/types.ts +1 -1
- package/temp/player.api.json +634 -16
- package/tsconfig.tsbuildinfo +1 -1
package/dist/plugins/index.js
CHANGED
|
@@ -9767,10 +9767,11 @@ function ifError(err) {
|
|
|
9767
9767
|
// export const CLAPPR_VERSION: string = process.env.CLAPPR_VERSION || '0.11.3';
|
|
9768
9768
|
const CLAPPR_VERSION$1 = '0.11.3';
|
|
9769
9769
|
|
|
9770
|
-
const pluginHtml$7 = "<button data-audiotracks-button class='gcore-skin-button-color' id=\"audiotracks-button\">\n <span class='audio-text'><%= title %></span> <span class=\"audio-arrow\"><%= icon %></span>\n</button>\n<ul class='gcore-skin-bg-color menu hidden' id=\"audiotracks-select\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-audiotracks-select=\"<%= track.id %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
|
|
9770
|
+
const pluginHtml$7 = "<button data-audiotracks-button class='gcore-skin-button-color' id=\"audiotracks-button\" aria-haspopup=\"menu\" aria-expanded=\"false\">\n <span class='audio-text'><%= title %></span> <span class=\"audio-arrow\"><%= icon %></span>\n</button>\n<ul class='gcore-skin-bg-color menu hidden' id=\"audiotracks-select\" role=\"menu\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-audiotracks-select=\"<%= track.id %>\" role=\"menuitemradio\" aria-checked=\"<%= track.id === current %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
|
|
9771
9771
|
|
|
9772
9772
|
const audioArrow = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"9px\" height=\"6px\" viewBox=\"0 0 9 6\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n <title>quality-arrow</title>\n <desc>Created with Sketch.</desc>\n <defs></defs>\n <g id=\"quality-arrow\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"M5.07079194,5.78553848 C4.91457318,5.94277844 4.70551573,6.00941824 4.50028717,5.99893557 C4.2950586,6.00941824 4.08676693,5.94277844 3.92978239,5.78553848 L0.221118462,1.2997069 C-0.0737061539,1.00469478 -0.0737061539,0.526236029 0.221118462,0.231972666 C0.515177299,-0.0630394586 1.23500883,0.00734414472 1.64852907,0.00734414472 L7.77475484,0.00734414472 C8.21201421,0.00734414472 8.48539703,-0.0630394586 8.77945587,0.231972666 C9.07351471,0.526236029 9.07351471,1.00469478 8.77945587,1.2997069 L5.07079194,5.78553848 Z\"\n fill=\"#FFFFFE\"></path>\n </g>\n</svg>\n";
|
|
9773
9773
|
|
|
9774
|
+
// import { trace } from '@gcorevideo/utils'
|
|
9774
9775
|
const VERSION$7 = '2.22.4';
|
|
9775
9776
|
// const T = 'plugins.audiotracks'
|
|
9776
9777
|
/**
|
|
@@ -9833,7 +9834,7 @@ class AudioTracks extends UICorePlugin {
|
|
|
9833
9834
|
const mediaControl = this.core.getPlugin('media_control');
|
|
9834
9835
|
assert(mediaControl, 'media_control plugin is required');
|
|
9835
9836
|
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, () => {
|
|
9836
|
-
mediaControl.
|
|
9837
|
+
mediaControl.mount('audiotracks', this.$el);
|
|
9837
9838
|
});
|
|
9838
9839
|
this.listenTo(mediaControl, Events.MEDIACONTROL_HIDE, this.hideMenu);
|
|
9839
9840
|
}
|
|
@@ -9864,18 +9865,18 @@ class AudioTracks extends UICorePlugin {
|
|
|
9864
9865
|
if (!this.shouldRender()) {
|
|
9865
9866
|
return this;
|
|
9866
9867
|
}
|
|
9867
|
-
this.core.getPlugin('media_control');
|
|
9868
9868
|
this.$el.html(AudioTracks.template({
|
|
9869
9869
|
tracks: this.tracks,
|
|
9870
9870
|
title: this.getTitle(),
|
|
9871
9871
|
icon: audioArrow,
|
|
9872
|
+
current: this.currentTrack?.id,
|
|
9872
9873
|
}));
|
|
9873
9874
|
this.updateText();
|
|
9874
9875
|
this.highlightCurrentTrack();
|
|
9875
9876
|
return this;
|
|
9876
9877
|
}
|
|
9877
9878
|
onTrackSelect(event) {
|
|
9878
|
-
const id = event.
|
|
9879
|
+
const id = event.currentTarget?.dataset?.audiotracksSelect;
|
|
9879
9880
|
if (id) {
|
|
9880
9881
|
this.selectAudioTrack(id);
|
|
9881
9882
|
}
|
|
@@ -9884,7 +9885,7 @@ class AudioTracks extends UICorePlugin {
|
|
|
9884
9885
|
return false;
|
|
9885
9886
|
}
|
|
9886
9887
|
selectAudioTrack(id) {
|
|
9887
|
-
this.
|
|
9888
|
+
this.startTrackSwitching();
|
|
9888
9889
|
this.core.activeContainer.switchAudioTrack(id);
|
|
9889
9890
|
this.updateText();
|
|
9890
9891
|
}
|
|
@@ -9892,7 +9893,9 @@ class AudioTracks extends UICorePlugin {
|
|
|
9892
9893
|
this.$el.find('#audiotracks-select').addClass('hidden');
|
|
9893
9894
|
}
|
|
9894
9895
|
toggleContextMenu() {
|
|
9895
|
-
this.$el.find('#audiotracks-select').toggleClass('hidden');
|
|
9896
|
+
this.$el.find('#audiotracks-select').toggleClass('hidden'); // TODO use plain CSS display: none
|
|
9897
|
+
const open = !this.$el.find('#audiotracks-select').hasClass('hidden'); // TODO hold state
|
|
9898
|
+
this.$el.find('#audiotracks-button').attr('aria-expanded', open);
|
|
9896
9899
|
}
|
|
9897
9900
|
buttonElement() {
|
|
9898
9901
|
return this.$('button');
|
|
@@ -9910,7 +9913,7 @@ class AudioTracks extends UICorePlugin {
|
|
|
9910
9913
|
}
|
|
9911
9914
|
return this.currentTrack.label || this.currentTrack.language;
|
|
9912
9915
|
}
|
|
9913
|
-
|
|
9916
|
+
startTrackSwitching() {
|
|
9914
9917
|
this.buttonElement().addClass('changing');
|
|
9915
9918
|
}
|
|
9916
9919
|
updateText() {
|
|
@@ -9921,12 +9924,16 @@ class AudioTracks extends UICorePlugin {
|
|
|
9921
9924
|
}
|
|
9922
9925
|
highlightCurrentTrack() {
|
|
9923
9926
|
this.trackElement().removeClass('current');
|
|
9924
|
-
this.trackElement()
|
|
9927
|
+
this.trackElement()
|
|
9928
|
+
.find('a')
|
|
9929
|
+
.removeClass('gcore-skin-active')
|
|
9930
|
+
.attr('aria-checked', 'false');
|
|
9925
9931
|
if (this.currentTrack) {
|
|
9926
9932
|
this.trackElement(this.currentTrack.id)
|
|
9927
9933
|
.addClass('current')
|
|
9928
9934
|
.find('a')
|
|
9929
|
-
.addClass('gcore-skin-active')
|
|
9935
|
+
.addClass('gcore-skin-active')
|
|
9936
|
+
.attr('aria-checked', 'true');
|
|
9930
9937
|
}
|
|
9931
9938
|
}
|
|
9932
9939
|
}
|
|
@@ -9943,7 +9950,7 @@ const volumeOffIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fil
|
|
|
9943
9950
|
|
|
9944
9951
|
const pluginHtml$6 = "<div class=\"big-mute-icon-wrapper\" data-big-mute>\n <div class=\"big-mute-icon gcore-skin-border-color\" data-big-mute-icon></div>\n</div>\n";
|
|
9945
9952
|
|
|
9946
|
-
const T$
|
|
9953
|
+
const T$d = 'plugins.big_mute_button';
|
|
9947
9954
|
// TODO rewrite as a container plugin
|
|
9948
9955
|
/**
|
|
9949
9956
|
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
@@ -9984,7 +9991,7 @@ class BigMuteButton extends UICorePlugin {
|
|
|
9984
9991
|
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
9985
9992
|
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
9986
9993
|
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
9987
|
-
trace(`${T$
|
|
9994
|
+
trace(`${T$d} bindEvents`, {
|
|
9988
9995
|
mediacontrol: !!this.core.mediaControl,
|
|
9989
9996
|
});
|
|
9990
9997
|
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.mediaControlRendered);
|
|
@@ -10041,7 +10048,7 @@ class BigMuteButton extends UICorePlugin {
|
|
|
10041
10048
|
*/
|
|
10042
10049
|
render() {
|
|
10043
10050
|
if (this.shouldRender()) {
|
|
10044
|
-
trace(`${T$
|
|
10051
|
+
trace(`${T$d} render`, {
|
|
10045
10052
|
el: !!this.$el,
|
|
10046
10053
|
});
|
|
10047
10054
|
this.$el.html(BigMuteButton.template());
|
|
@@ -10080,7 +10087,7 @@ class BigMuteButton extends UICorePlugin {
|
|
|
10080
10087
|
}
|
|
10081
10088
|
}
|
|
10082
10089
|
|
|
10083
|
-
const pluginHtml$5 = "<button
|
|
10090
|
+
const pluginHtml$5 = "<button class=\"media-control-button gplayer-lite-btn gcore-skin-button-color gear-icon\" id=\"gear-button\">\n <%= icon %>\n</button>\n<div class=\"gear-wrapper gcore-skin-bg-color\" id=\"gear-options-wrapper\" style=\"display:none\">\n <ul class=\"gear-options-list\" id=\"gear-options\" role=\"menu\"></ul>\n</div>\n";
|
|
10084
10091
|
|
|
10085
10092
|
const gearIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_660_1503)\">\n <path\n d=\"M19.14 12.94C19.18 12.64 19.2 12.33 19.2 12C19.2 11.68 19.18 11.36 19.13 11.06L21.16 9.47999C21.34 9.33999 21.39 9.06999 21.28 8.86999L19.36 5.54999C19.24 5.32999 18.99 5.25999 18.77 5.32999L16.38 6.28999C15.88 5.90999 15.35 5.58999 14.76 5.34999L14.4 2.80999C14.36 2.56999 14.16 2.39999 13.92 2.39999H10.08C9.83999 2.39999 9.64999 2.56999 9.60999 2.80999L9.24999 5.34999C8.65999 5.58999 8.11999 5.91999 7.62999 6.28999L5.23999 5.32999C5.01999 5.24999 4.76999 5.32999 4.64999 5.54999L2.73999 8.86999C2.61999 9.07999 2.65999 9.33999 2.85999 9.47999L4.88999 11.06C4.83999 11.36 4.79999 11.69 4.79999 12C4.79999 12.31 4.81999 12.64 4.86999 12.94L2.83999 14.52C2.65999 14.66 2.60999 14.93 2.71999 15.13L4.63999 18.45C4.75999 18.67 5.00999 18.74 5.22999 18.67L7.61999 17.71C8.11999 18.09 8.64999 18.41 9.23999 18.65L9.59999 21.19C9.64999 21.43 9.83999 21.6 10.08 21.6H13.92C14.16 21.6 14.36 21.43 14.39 21.19L14.75 18.65C15.34 18.41 15.88 18.09 16.37 17.71L18.76 18.67C18.98 18.75 19.23 18.67 19.35 18.45L21.27 15.13C21.39 14.91 21.34 14.66 21.15 14.52L19.14 12.94ZM12 15.6C10.02 15.6 8.39999 13.98 8.39999 12C8.39999 10.02 10.02 8.39999 12 8.39999C13.98 8.39999 15.6 10.02 15.6 12C15.6 13.98 13.98 15.6 12 15.6Z\"\n fill=\"#C9C9C9\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_660_1503\">\n <rect width=\"24\" height=\"24\" fill=\"white\"/>\n </clipPath>\n </defs>\n</svg>\n";
|
|
10086
10093
|
|
|
@@ -10094,7 +10101,7 @@ const VERSION$6 = '2.19.12';
|
|
|
10094
10101
|
var GearEvents;
|
|
10095
10102
|
(function (GearEvents) {
|
|
10096
10103
|
/**
|
|
10097
|
-
*
|
|
10104
|
+
* Subscribe to this event to accurately attach an item to the gear menu
|
|
10098
10105
|
*/
|
|
10099
10106
|
GearEvents["RENDERED"] = "rendered";
|
|
10100
10107
|
})(GearEvents || (GearEvents = {}));
|
|
@@ -10306,39 +10313,39 @@ class BottomGear extends UICorePlugin {
|
|
|
10306
10313
|
}
|
|
10307
10314
|
onMediaControlRendered() {
|
|
10308
10315
|
const mediaControl = this.core.getPlugin('media_control');
|
|
10309
|
-
mediaControl.
|
|
10316
|
+
mediaControl.mount('gear', this.$el);
|
|
10310
10317
|
}
|
|
10311
10318
|
}
|
|
10312
10319
|
|
|
10313
10320
|
/**
|
|
10314
10321
|
* @beta
|
|
10315
10322
|
*/
|
|
10316
|
-
var
|
|
10317
|
-
(function (
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
+
var ClapprStatsChronograph;
|
|
10324
|
+
(function (ClapprStatsChronograph) {
|
|
10325
|
+
ClapprStatsChronograph["Startup"] = "startup";
|
|
10326
|
+
ClapprStatsChronograph["Watch"] = "watch";
|
|
10327
|
+
ClapprStatsChronograph["Pause"] = "pause";
|
|
10328
|
+
ClapprStatsChronograph["Buffering"] = "buffering";
|
|
10329
|
+
ClapprStatsChronograph["Session"] = "session";
|
|
10323
10330
|
// Latency = 'latency',
|
|
10324
|
-
})(
|
|
10331
|
+
})(ClapprStatsChronograph || (ClapprStatsChronograph = {}));
|
|
10325
10332
|
/**
|
|
10326
10333
|
* @beta
|
|
10327
10334
|
*/
|
|
10328
|
-
var
|
|
10329
|
-
(function (
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
})(
|
|
10335
|
+
var ClapprStatsCounter;
|
|
10336
|
+
(function (ClapprStatsCounter) {
|
|
10337
|
+
ClapprStatsCounter["Play"] = "play";
|
|
10338
|
+
ClapprStatsCounter["Pause"] = "pause";
|
|
10339
|
+
ClapprStatsCounter["Error"] = "error";
|
|
10340
|
+
ClapprStatsCounter["Buffering"] = "buffering";
|
|
10341
|
+
ClapprStatsCounter["DecodedFrames"] = "decodedFrames";
|
|
10342
|
+
ClapprStatsCounter["DroppedFrames"] = "droppedFrames";
|
|
10343
|
+
ClapprStatsCounter["Fps"] = "fps";
|
|
10344
|
+
ClapprStatsCounter["ChangeLevel"] = "changeLevel";
|
|
10345
|
+
ClapprStatsCounter["Seek"] = "seek";
|
|
10346
|
+
ClapprStatsCounter["Fullscreen"] = "fullscreen";
|
|
10347
|
+
ClapprStatsCounter["DvrUsage"] = "dvrUsage";
|
|
10348
|
+
})(ClapprStatsCounter || (ClapprStatsCounter = {}));
|
|
10342
10349
|
/**
|
|
10343
10350
|
* @beta
|
|
10344
10351
|
*/
|
|
@@ -10399,6 +10406,8 @@ function newMetrics$1() {
|
|
|
10399
10406
|
* @remarks
|
|
10400
10407
|
* This plugin does not render anything and is supposed to be extended or used together with other plugins that actually render something.
|
|
10401
10408
|
*
|
|
10409
|
+
* @see {@link NerdStats} - a plugin that visualises the playback metrics
|
|
10410
|
+
*
|
|
10402
10411
|
* Configuration options - {@link ClapprStatsSettings}
|
|
10403
10412
|
*
|
|
10404
10413
|
* Events - {@link ClapprStatsEvents}
|
|
@@ -10408,11 +10417,11 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10408
10417
|
lastDecodedFramesCount = 0;
|
|
10409
10418
|
metrics = newMetrics$1();
|
|
10410
10419
|
timers = {
|
|
10411
|
-
[
|
|
10412
|
-
[
|
|
10413
|
-
[
|
|
10414
|
-
[
|
|
10415
|
-
[
|
|
10420
|
+
[ClapprStatsChronograph.Startup]: 0,
|
|
10421
|
+
[ClapprStatsChronograph.Watch]: 0,
|
|
10422
|
+
[ClapprStatsChronograph.Pause]: 0,
|
|
10423
|
+
[ClapprStatsChronograph.Buffering]: 0,
|
|
10424
|
+
[ClapprStatsChronograph.Session]: 0,
|
|
10416
10425
|
};
|
|
10417
10426
|
runEach;
|
|
10418
10427
|
/**
|
|
@@ -10442,15 +10451,10 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10442
10451
|
inc(counter) {
|
|
10443
10452
|
this.metrics.counters[counter] += 1;
|
|
10444
10453
|
}
|
|
10445
|
-
// _timerHasStarted(timer) {
|
|
10446
|
-
// return this[`_start${timer}`] !== undefined;
|
|
10447
|
-
// }
|
|
10448
10454
|
start(timer) {
|
|
10449
|
-
// this[`_start${timer}`] = this._now();
|
|
10450
10455
|
this.timers[timer] = this.now();
|
|
10451
10456
|
}
|
|
10452
10457
|
stop(timer) {
|
|
10453
|
-
// this._metrics.timers[timer] += this._now() - this[`_start${timer}`];
|
|
10454
10458
|
this.metrics.chrono[timer] += this.now() - this.timers[timer];
|
|
10455
10459
|
}
|
|
10456
10460
|
constructor(container) {
|
|
@@ -10470,10 +10474,10 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10470
10474
|
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause);
|
|
10471
10475
|
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
|
|
10472
10476
|
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek);
|
|
10473
|
-
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this.inc(
|
|
10474
|
-
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this.inc(
|
|
10477
|
+
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this.inc(ClapprStatsCounter.Error));
|
|
10478
|
+
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this.inc(ClapprStatsCounter.Fullscreen));
|
|
10475
10479
|
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {
|
|
10476
|
-
dvrInUse && this.inc(
|
|
10480
|
+
dvrInUse && this.inc(ClapprStatsCounter.DvrUsage);
|
|
10477
10481
|
});
|
|
10478
10482
|
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress);
|
|
10479
10483
|
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate);
|
|
@@ -10501,7 +10505,7 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10501
10505
|
last.time = now - last.start;
|
|
10502
10506
|
}
|
|
10503
10507
|
this.metrics.extra.bitratesHistory.push({ start: this.now(), bitrate });
|
|
10504
|
-
this.inc(
|
|
10508
|
+
this.inc(ClapprStatsCounter.ChangeLevel);
|
|
10505
10509
|
}
|
|
10506
10510
|
stopReporting() {
|
|
10507
10511
|
this.buildReport();
|
|
@@ -10512,31 +10516,31 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10512
10516
|
}
|
|
10513
10517
|
startTimers() {
|
|
10514
10518
|
this.timerId = setInterval(this.buildReport.bind(this), this.runEach);
|
|
10515
|
-
this.start(
|
|
10516
|
-
this.start(
|
|
10519
|
+
this.start(ClapprStatsChronograph.Session);
|
|
10520
|
+
this.start(ClapprStatsChronograph.Startup);
|
|
10517
10521
|
}
|
|
10518
10522
|
onFirstPlaying() {
|
|
10519
10523
|
this.listenTo(this.container, Events.CONTAINER_TIMEUPDATE, this.onContainerUpdateWhilePlaying);
|
|
10520
|
-
this.start(
|
|
10521
|
-
this.stop(
|
|
10524
|
+
this.start(ClapprStatsChronograph.Watch);
|
|
10525
|
+
this.stop(ClapprStatsChronograph.Startup);
|
|
10522
10526
|
}
|
|
10523
10527
|
playAfterPause() {
|
|
10524
10528
|
this.listenTo(this.container, Events.CONTAINER_TIMEUPDATE, this.onContainerUpdateWhilePlaying);
|
|
10525
|
-
this.stop(
|
|
10526
|
-
this.start(
|
|
10529
|
+
this.stop(ClapprStatsChronograph.Pause);
|
|
10530
|
+
this.start(ClapprStatsChronograph.Watch);
|
|
10527
10531
|
}
|
|
10528
10532
|
onPlay() {
|
|
10529
|
-
this.inc(
|
|
10533
|
+
this.inc(ClapprStatsCounter.Play);
|
|
10530
10534
|
}
|
|
10531
10535
|
onPause() {
|
|
10532
|
-
this.stop(
|
|
10533
|
-
this.start(
|
|
10534
|
-
this.inc(
|
|
10536
|
+
this.stop(ClapprStatsChronograph.Watch);
|
|
10537
|
+
this.start(ClapprStatsChronograph.Pause);
|
|
10538
|
+
this.inc(ClapprStatsCounter.Pause);
|
|
10535
10539
|
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.playAfterPause);
|
|
10536
10540
|
this.stopListening(this.container, Events.CONTAINER_TIMEUPDATE, this.onContainerUpdateWhilePlaying);
|
|
10537
10541
|
}
|
|
10538
10542
|
onSeek(e) {
|
|
10539
|
-
this.inc(
|
|
10543
|
+
this.inc(ClapprStatsCounter.Seek);
|
|
10540
10544
|
this.metrics.extra.watchHistory.push([e * 1000, e * 1000]);
|
|
10541
10545
|
}
|
|
10542
10546
|
onTimeUpdate(e) {
|
|
@@ -10561,17 +10565,17 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10561
10565
|
}
|
|
10562
10566
|
onContainerUpdateWhilePlaying() {
|
|
10563
10567
|
if (this.container.playback.isPlaying()) {
|
|
10564
|
-
this.stop(
|
|
10565
|
-
this.start(
|
|
10568
|
+
this.stop(ClapprStatsChronograph.Watch);
|
|
10569
|
+
this.start(ClapprStatsChronograph.Watch);
|
|
10566
10570
|
}
|
|
10567
10571
|
}
|
|
10568
10572
|
onBuffering() {
|
|
10569
|
-
this.inc(
|
|
10570
|
-
this.start(
|
|
10573
|
+
this.inc(ClapprStatsCounter.Buffering);
|
|
10574
|
+
this.start(ClapprStatsChronograph.Buffering);
|
|
10571
10575
|
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferfull);
|
|
10572
10576
|
}
|
|
10573
10577
|
onBufferfull() {
|
|
10574
|
-
this.stop(
|
|
10578
|
+
this.stop(ClapprStatsChronograph.Buffering);
|
|
10575
10579
|
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
|
|
10576
10580
|
}
|
|
10577
10581
|
onProgress(progress) {
|
|
@@ -10583,8 +10587,8 @@ class ClapprStats extends ContainerPlugin {
|
|
|
10583
10587
|
// this.trigger(ClapprStatsEvents.PERCENTAGE, currentPercentage);
|
|
10584
10588
|
}
|
|
10585
10589
|
buildReport() {
|
|
10586
|
-
this.stop(
|
|
10587
|
-
this.start(
|
|
10590
|
+
this.stop(ClapprStatsChronograph.Session);
|
|
10591
|
+
this.start(ClapprStatsChronograph.Session);
|
|
10588
10592
|
this.metrics.extra.playbackName = this.playbackName;
|
|
10589
10593
|
this.metrics.extra.playbackType = this.playbackType;
|
|
10590
10594
|
this.calcBitrates();
|
|
@@ -12765,18 +12769,18 @@ const PLAYBACK_NAMES = {
|
|
|
12765
12769
|
hls: 'HLS.js',
|
|
12766
12770
|
html5_video: 'Native',
|
|
12767
12771
|
};
|
|
12768
|
-
const T$
|
|
12772
|
+
const T$c = 'plugins.nerd_stats';
|
|
12769
12773
|
/**
|
|
12770
|
-
* `PLUGIN` that displays useful network
|
|
12774
|
+
* `PLUGIN` that displays useful statistics regarding the playback as well as the network quality estimation.
|
|
12771
12775
|
* @beta
|
|
12772
12776
|
*
|
|
12773
12777
|
* @remarks
|
|
12774
12778
|
* Depends on:
|
|
12775
12779
|
*
|
|
12776
|
-
* - {@link BottomGear}
|
|
12777
|
-
*
|
|
12778
|
-
* - {@link ClapprStats}
|
|
12780
|
+
* - {@link BottomGear} - where the button is attached
|
|
12779
12781
|
*
|
|
12782
|
+
* - {@link ClapprStats} - to get the metrics from
|
|
12783
|
+
*
|
|
12780
12784
|
* The plugin is rendered as an item in the gear menu.
|
|
12781
12785
|
*
|
|
12782
12786
|
* When clicked, it shows an overlay window with the information about the network speed, latency, etc,
|
|
@@ -12968,7 +12972,7 @@ class NerdStats extends UICorePlugin {
|
|
|
12968
12972
|
prefix + videoQualityNames[liveQuality - 1];
|
|
12969
12973
|
}
|
|
12970
12974
|
updateMetrics(metrics) {
|
|
12971
|
-
trace(`${T$
|
|
12975
|
+
trace(`${T$c} updateMetrics`, { custom: this.speedtestMetrics });
|
|
12972
12976
|
Object.assign(this.metrics, metrics);
|
|
12973
12977
|
this.updateEstimatedQuality();
|
|
12974
12978
|
this.$el
|
|
@@ -13147,7 +13151,7 @@ class ClickToPause extends ContainerPlugin {
|
|
|
13147
13151
|
* @internal
|
|
13148
13152
|
*/
|
|
13149
13153
|
get name() {
|
|
13150
|
-
return '
|
|
13154
|
+
return 'click_to_pause';
|
|
13151
13155
|
}
|
|
13152
13156
|
/**
|
|
13153
13157
|
* @internal
|
|
@@ -13538,7 +13542,7 @@ class ContextMenu extends UIContainerPlugin {
|
|
|
13538
13542
|
|
|
13539
13543
|
const dvrHTML = "<div class=\"live-info\" id=\"media-control-live\"><%= i18n.t('live') %></div>\n<button type=\"button\" class=\"live-button\" aria-label=\"<%= i18n.t('back_to_live') %>\" id=\"media-control-back-to-live\"><%= i18n.t('back_to_live') %></button>\n";
|
|
13540
13544
|
|
|
13541
|
-
const T
|
|
13545
|
+
// const T = 'plugins.dvr_controls'
|
|
13542
13546
|
/**
|
|
13543
13547
|
* `PLUGIN` that adds the DVR controls to the media control UI
|
|
13544
13548
|
*
|
|
@@ -13587,18 +13591,17 @@ class DvrControls extends UICorePlugin {
|
|
|
13587
13591
|
* @internal
|
|
13588
13592
|
*/
|
|
13589
13593
|
bindEvents() {
|
|
13590
|
-
this.
|
|
13591
|
-
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.
|
|
13594
|
+
this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
|
|
13595
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
13592
13596
|
}
|
|
13593
13597
|
onCoreReady() {
|
|
13594
13598
|
const mediaControl = this.core.getPlugin('media_control');
|
|
13595
13599
|
assert(mediaControl, 'media_control plugin is required');
|
|
13596
|
-
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.
|
|
13597
|
-
// MediaControl has been rendered
|
|
13598
|
-
this.render();
|
|
13600
|
+
this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.mount);
|
|
13599
13601
|
}
|
|
13600
|
-
|
|
13601
|
-
this.
|
|
13602
|
+
onActiveContainerChanged() {
|
|
13603
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_LOADEDMETADATA, this.onMetadataLoaded);
|
|
13604
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.onDvrStateChanged);
|
|
13602
13605
|
}
|
|
13603
13606
|
click() {
|
|
13604
13607
|
const container = this.core.activeContainer;
|
|
@@ -13607,32 +13610,47 @@ class DvrControls extends UICorePlugin {
|
|
|
13607
13610
|
}
|
|
13608
13611
|
container.seek(container.getDuration());
|
|
13609
13612
|
}
|
|
13610
|
-
shouldRender() {
|
|
13611
|
-
return this.core.getPlaybackType() === Playback.LIVE;
|
|
13612
|
-
}
|
|
13613
13613
|
/**
|
|
13614
13614
|
* @internal
|
|
13615
13615
|
*/
|
|
13616
13616
|
render() {
|
|
13617
|
-
trace(`${T$c} render`, {
|
|
13618
|
-
dvrEnabled: this.core.activePlayback?.dvrEnabled,
|
|
13619
|
-
playbackType: this.core.getPlaybackType(),
|
|
13620
|
-
});
|
|
13621
|
-
const mediaControl = this.core.getPlugin('media_control');
|
|
13622
|
-
if (!mediaControl) {
|
|
13623
|
-
return this;
|
|
13624
|
-
}
|
|
13625
|
-
if (!this.shouldRender()) {
|
|
13626
|
-
return this;
|
|
13627
|
-
}
|
|
13628
|
-
mediaControl.toggleElement('duration', false);
|
|
13629
|
-
mediaControl.toggleElement('position', false);
|
|
13630
13617
|
this.$el.html(DvrControls.template({
|
|
13631
13618
|
i18n: this.core.i18n,
|
|
13632
13619
|
}));
|
|
13633
|
-
mediaControl.putElement('dvr', this.$el);
|
|
13634
13620
|
return this;
|
|
13635
13621
|
}
|
|
13622
|
+
onMediacontrolRendered() {
|
|
13623
|
+
this.render();
|
|
13624
|
+
}
|
|
13625
|
+
onMetadataLoaded() {
|
|
13626
|
+
this.mount();
|
|
13627
|
+
this.toggleState(this.core.activeContainer.isDvrInUse());
|
|
13628
|
+
}
|
|
13629
|
+
mount() {
|
|
13630
|
+
// TODO move mount point management logic to MediaControl
|
|
13631
|
+
if (this.core.getPlaybackType() !== Playback.LIVE) {
|
|
13632
|
+
return;
|
|
13633
|
+
}
|
|
13634
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
13635
|
+
assert(mediaControl, 'media_control plugin is required');
|
|
13636
|
+
// TODO -> to MediaControl
|
|
13637
|
+
mediaControl.toggleElement('duration', false);
|
|
13638
|
+
mediaControl.toggleElement('position', false);
|
|
13639
|
+
mediaControl.mount('dvr', this.$el);
|
|
13640
|
+
}
|
|
13641
|
+
onDvrStateChanged(dvrInUse) {
|
|
13642
|
+
this.toggleState(dvrInUse);
|
|
13643
|
+
}
|
|
13644
|
+
toggleState(dvrInUse) {
|
|
13645
|
+
if (dvrInUse) {
|
|
13646
|
+
this.$el.find('#media-control-back-to-live').show();
|
|
13647
|
+
this.$el.find('#media-control-live').hide();
|
|
13648
|
+
}
|
|
13649
|
+
else {
|
|
13650
|
+
this.$el.find('#media-control-back-to-live').hide();
|
|
13651
|
+
this.$el.find('#media-control-live').show();
|
|
13652
|
+
}
|
|
13653
|
+
}
|
|
13636
13654
|
}
|
|
13637
13655
|
|
|
13638
13656
|
const reloadIcon = "<svg fill=\"#FFFFFF\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z\"/>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"/>\n</svg>";
|
|
@@ -14437,8 +14455,6 @@ const DEFAULT_SETTINGS = {
|
|
|
14437
14455
|
right: [
|
|
14438
14456
|
'audiotracks',
|
|
14439
14457
|
'cc',
|
|
14440
|
-
// 'dvr',
|
|
14441
|
-
// 'duration',
|
|
14442
14458
|
'fullscreen',
|
|
14443
14459
|
'gear',
|
|
14444
14460
|
'multicamera',
|
|
@@ -14455,11 +14471,15 @@ const T$a = 'plugins.media_control';
|
|
|
14455
14471
|
const LEFT_ORDER = [
|
|
14456
14472
|
'playpause',
|
|
14457
14473
|
'playstop',
|
|
14458
|
-
'dvr',
|
|
14459
14474
|
'volume',
|
|
14460
14475
|
'position',
|
|
14461
14476
|
'duration',
|
|
14477
|
+
'dvr',
|
|
14462
14478
|
];
|
|
14479
|
+
var ExtendedEvents;
|
|
14480
|
+
(function (ExtendedEvents) {
|
|
14481
|
+
ExtendedEvents["MEDIACONTROL_VOLUME"] = "mediacontrol:volume";
|
|
14482
|
+
})(ExtendedEvents || (ExtendedEvents = {}));
|
|
14463
14483
|
const { Config, Fullscreen, formatTime: formatTime$1, extend, removeArrayItem } = Utils;
|
|
14464
14484
|
function orderByOrderPattern(arr, order) {
|
|
14465
14485
|
const arrWithoutDuplicates = [...new Set(arr)];
|
|
@@ -14937,14 +14957,15 @@ class MediaControl extends UICorePlugin {
|
|
|
14937
14957
|
// if the container is not ready etc
|
|
14938
14958
|
this.intendedVolume = value;
|
|
14939
14959
|
this.persistConfig && !isInitialVolume && Config.persist('volume', value);
|
|
14940
|
-
// TODO
|
|
14941
14960
|
const setWhenContainerReady = () => {
|
|
14942
14961
|
if (this.core.activeContainer && this.core.activeContainer.isReady) {
|
|
14943
14962
|
this.core.activeContainer.setVolume(value);
|
|
14963
|
+
this.trigger(ExtendedEvents.MEDIACONTROL_VOLUME, value);
|
|
14944
14964
|
}
|
|
14945
14965
|
else {
|
|
14946
14966
|
this.listenToOnce(this.core.activeContainer, Events.CONTAINER_READY, () => {
|
|
14947
14967
|
this.core.activeContainer.setVolume(value);
|
|
14968
|
+
this.trigger(ExtendedEvents.MEDIACONTROL_VOLUME, value);
|
|
14948
14969
|
});
|
|
14949
14970
|
}
|
|
14950
14971
|
};
|
|
@@ -15102,8 +15123,7 @@ class MediaControl extends UICorePlugin {
|
|
|
15102
15123
|
}
|
|
15103
15124
|
this.$el.show();
|
|
15104
15125
|
this.trigger(Events.MEDIACONTROL_SHOW, this.name);
|
|
15105
|
-
this.
|
|
15106
|
-
this.container.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name);
|
|
15126
|
+
this.core.activeContainer?.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name);
|
|
15107
15127
|
this.$el.removeClass('media-control-hide');
|
|
15108
15128
|
this.hideId = setTimeout(() => this.hide(), timeout);
|
|
15109
15129
|
if (event) {
|
|
@@ -15156,7 +15176,7 @@ class MediaControl extends UICorePlugin {
|
|
|
15156
15176
|
default: [],
|
|
15157
15177
|
right: [],
|
|
15158
15178
|
}, this.core.activeContainer.settings);
|
|
15159
|
-
newSettings.left.push('clips'); // TODO
|
|
15179
|
+
newSettings.left.push('clips'); // TODO settings
|
|
15160
15180
|
// TODO make order controlled via CSS
|
|
15161
15181
|
newSettings.left = orderByOrderPattern([...newSettings.left, 'volume', 'clips'], LEFT_ORDER);
|
|
15162
15182
|
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
@@ -15218,7 +15238,6 @@ class MediaControl extends UICorePlugin {
|
|
|
15218
15238
|
* Get a media control element DOM node
|
|
15219
15239
|
* @param name - The name of the media control element
|
|
15220
15240
|
* @returns The DOM node to render to or extend
|
|
15221
|
-
* @deprecated Use {@link MediaControl.putElement} instead
|
|
15222
15241
|
* @remarks
|
|
15223
15242
|
* Use this method to render custom media control UI in a plugin
|
|
15224
15243
|
* @example
|
|
@@ -15250,13 +15269,18 @@ class MediaControl extends UICorePlugin {
|
|
|
15250
15269
|
return;
|
|
15251
15270
|
}
|
|
15252
15271
|
}
|
|
15272
|
+
/**
|
|
15273
|
+
* @deprecated Use {@link MediaControl.mount} instead
|
|
15274
|
+
* @param name
|
|
15275
|
+
* @param element
|
|
15276
|
+
*/
|
|
15253
15277
|
putElement(name, element) {
|
|
15254
15278
|
this.mount(name, element);
|
|
15255
15279
|
}
|
|
15256
15280
|
/**
|
|
15257
15281
|
* Toggle the visibility of a media control element
|
|
15258
15282
|
* @param name - The name of the media control element
|
|
15259
|
-
* @param show -
|
|
15283
|
+
* @param show - Visibility state
|
|
15260
15284
|
*/
|
|
15261
15285
|
toggleElement(area, show) {
|
|
15262
15286
|
this.$el.find(`[data-${area}]`).toggle(show);
|
|
@@ -15472,6 +15496,7 @@ class MediaControl extends UICorePlugin {
|
|
|
15472
15496
|
width: this.options.width,
|
|
15473
15497
|
height: this.options.height,
|
|
15474
15498
|
});
|
|
15499
|
+
// TODO check out
|
|
15475
15500
|
this.hideVolumeBar(0);
|
|
15476
15501
|
}, 0);
|
|
15477
15502
|
this.parseColors();
|
|
@@ -16015,7 +16040,7 @@ class PictureInPicture extends UICorePlugin {
|
|
|
16015
16040
|
this.$el.html(PictureInPicture.buttonTemplate({ pipIcon }));
|
|
16016
16041
|
const mediaControl = this.core.getPlugin('media_control');
|
|
16017
16042
|
if (mediaControl) {
|
|
16018
|
-
mediaControl.
|
|
16043
|
+
mediaControl.mount('pip', this.$el);
|
|
16019
16044
|
}
|
|
16020
16045
|
return this;
|
|
16021
16046
|
}
|
|
@@ -16616,7 +16641,7 @@ class Poster extends UIContainerPlugin {
|
|
|
16616
16641
|
}
|
|
16617
16642
|
}
|
|
16618
16643
|
|
|
16619
|
-
const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' aria-haspopup=\"menu\">\n <span class=\"gear-option_icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('quality') %></span>\n <span class='gear-option_value'><%= currentText %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n</button>\n";
|
|
16644
|
+
const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' aria-haspopup=\"menu\" id=\"quality-levels\">\n <span class=\"gear-option_icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('quality') %></span>\n <span class='gear-option_value'><%= currentText %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n</button>\n";
|
|
16620
16645
|
|
|
16621
16646
|
const listHtml = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"level-selector-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('quality') %>\n</button>\n<ul class=\"gear-sub-menu quality-levels\" id=\"level-selector-menu\" role=\"menu\">\n <% if (!removeAuto) { %>\n <li>\n <a href=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color\"\n data-id=\"-1\"\n id=\"level_selector_auto\"\n aria-checked=\"<%= current === -1 %>\"\n role=\"menuitemradio\"\n >\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= i18n.t('auto') %>\n </a>\n </li>\n <% } %>\n <% for (const item of levels.slice().reverse()) {\n var disabled = maxLevel >= 0 && item.level > maxLevel\n var checked = item.level === current\n %>\n <li class=\"<%= disabled ? ' disabled' : ''%><%=checked ? ' current' : ''%>\">\n <a href=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color<%= checked ? ' gcore-skin-active' : '' %>\"\n data-id=\"<%= item.level %>\"\n aria-disabled=\"<%= disabled %>\"\n aria-checked=\"<%= checked %>\"\n role=\"menuitemradio\"\n id=\"level_selector_<%= item.width > item.height ? item.height : item.width %>\"\n >\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= labels[item.level] %>\n </a>\n </li>\n <% } %>\n</ul>\n";
|
|
16622
16647
|
|
|
@@ -17912,7 +17937,7 @@ class ClosedCaptions extends UICorePlugin {
|
|
|
17912
17937
|
this.$line = $(ClosedCaptions.templateString());
|
|
17913
17938
|
this.resizeFont();
|
|
17914
17939
|
this.core.activeContainer.$el.append(this.$line);
|
|
17915
|
-
mediaControl.
|
|
17940
|
+
mediaControl.mount('cc', this.$el);
|
|
17916
17941
|
this.updateSelection();
|
|
17917
17942
|
this.renderIcon();
|
|
17918
17943
|
return this;
|
|
@@ -18749,98 +18774,95 @@ var VolumeFadeEvents;
|
|
|
18749
18774
|
(function (VolumeFadeEvents) {
|
|
18750
18775
|
VolumeFadeEvents["FADE"] = "core:volume:fade";
|
|
18751
18776
|
})(VolumeFadeEvents || (VolumeFadeEvents = {}));
|
|
18777
|
+
const DEFAULT_DURATION = 600;
|
|
18752
18778
|
/**
|
|
18753
18779
|
* `PLUGIN` that applies fade effect to the player's volume change.
|
|
18754
18780
|
* @beta
|
|
18781
|
+
*
|
|
18782
|
+
* @remarks
|
|
18783
|
+
* Depends on {@link MediaControl} plugin.
|
|
18784
|
+
* Configuration options - {@link VolumeFadeSettings}
|
|
18755
18785
|
*/
|
|
18756
18786
|
class VolumeFade extends UICorePlugin {
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
interval = null;
|
|
18787
|
+
activeVolume = 0;
|
|
18788
|
+
duration = 0;
|
|
18789
|
+
timerId = null;
|
|
18761
18790
|
/**
|
|
18762
18791
|
* @internal
|
|
18763
18792
|
*/
|
|
18764
18793
|
get name() {
|
|
18765
18794
|
return 'volume_fade';
|
|
18766
18795
|
}
|
|
18796
|
+
constructor(core) {
|
|
18797
|
+
super(core);
|
|
18798
|
+
if (typeof this.options.volumeFade?.level === 'number') {
|
|
18799
|
+
this.activeVolume = this.options.volumeFade.level;
|
|
18800
|
+
}
|
|
18801
|
+
}
|
|
18767
18802
|
/**
|
|
18768
18803
|
* @internal
|
|
18769
18804
|
*/
|
|
18770
18805
|
bindEvents() {
|
|
18771
|
-
// TODO on container changed
|
|
18772
18806
|
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
18773
|
-
if (this.core.mediaControl) {
|
|
18774
|
-
this.listenTo(this.core.mediaControl, 'mediacontrol:volume:user', this._onUserChangeVolume);
|
|
18775
|
-
}
|
|
18776
|
-
// this.listenTo(this.core, 'core:volume:config', this._onVolumeConfig);
|
|
18777
|
-
}
|
|
18778
|
-
unBindEvents() {
|
|
18779
|
-
this.core.$el.off('mouseleave.volume');
|
|
18780
|
-
this.core.$el.off('mouseenter.volume');
|
|
18781
|
-
}
|
|
18782
|
-
_onUserChangeVolume(volume) {
|
|
18783
|
-
this._aboveBorderVolume = volume;
|
|
18784
|
-
}
|
|
18785
|
-
_onVolumeConfig(value) {
|
|
18786
|
-
this._aboveBorderVolume = value;
|
|
18787
|
-
this.container?.setVolume(0);
|
|
18788
18807
|
}
|
|
18789
18808
|
onCoreReady() {
|
|
18790
|
-
this.
|
|
18791
|
-
|
|
18792
|
-
if (this.core && this.core.$el) {
|
|
18793
|
-
// TODO find out why options.playerElement instead of this.core.$el or this.container.$el
|
|
18794
|
-
$(this.options.playerElement).on('mouseenter.volume', () => {
|
|
18795
|
-
this.onEnter();
|
|
18796
|
-
});
|
|
18797
|
-
$(this.options.playerElement).on('mouseleave.volume', () => {
|
|
18798
|
-
this.onLeave();
|
|
18799
|
-
});
|
|
18800
|
-
}
|
|
18801
|
-
if (!this._aboveBorderVolume) {
|
|
18802
|
-
this._aboveBorderVolume = this.container?.volume && !isNaN(this.container.volume) ? this.container.volume : 80;
|
|
18803
|
-
}
|
|
18804
|
-
if (this.options.mute || Browser.isMobile) {
|
|
18809
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
18810
|
+
if (Browser.isMobile) {
|
|
18805
18811
|
this.destroy();
|
|
18806
18812
|
return;
|
|
18807
18813
|
}
|
|
18808
|
-
|
|
18809
|
-
|
|
18814
|
+
if (mediaControl) {
|
|
18815
|
+
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_VOLUME, this.onVolumeChange);
|
|
18816
|
+
}
|
|
18817
|
+
$(this.core.$el).on('mouseenter', () => this.onEnter());
|
|
18818
|
+
$(this.core.$el).on('mouseleave', () => this.onLeave());
|
|
18819
|
+
if (!this.activeVolume) {
|
|
18820
|
+
this.activeVolume =
|
|
18821
|
+
this.core.activeContainer?.volume &&
|
|
18822
|
+
!isNaN(this.core.activeContainer.volume)
|
|
18823
|
+
? this.core.activeContainer.volume
|
|
18824
|
+
: 80;
|
|
18825
|
+
}
|
|
18826
|
+
this.duration = this.options.volumeFade?.duration || DEFAULT_DURATION;
|
|
18827
|
+
// TODO check if mute must be respected
|
|
18828
|
+
this.core.activeContainer?.setVolume(this.activeVolume);
|
|
18829
|
+
this.core.activePlayback.volume(0);
|
|
18830
|
+
}
|
|
18831
|
+
onVolumeChange(volume) {
|
|
18832
|
+
this.activeVolume = volume;
|
|
18810
18833
|
}
|
|
18811
18834
|
onEnter() {
|
|
18812
|
-
this.
|
|
18835
|
+
this.fade(this.duration, 1);
|
|
18813
18836
|
}
|
|
18814
|
-
|
|
18815
|
-
this.
|
|
18837
|
+
onLeave() {
|
|
18838
|
+
this.fade(this.duration, 0);
|
|
18839
|
+
}
|
|
18840
|
+
fade(duration, to) {
|
|
18841
|
+
this.stopFade();
|
|
18816
18842
|
const start = new Date().getTime();
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
const
|
|
18843
|
+
const from = 1 - to;
|
|
18844
|
+
this.timerId = setInterval(() => {
|
|
18845
|
+
const delta = new Date().getTime() - start;
|
|
18846
|
+
const progress = Math.min(1, delta / duration);
|
|
18847
|
+
const normVol = progress * to + (1 - progress) * from;
|
|
18848
|
+
const volume = normVol * this.activeVolume;
|
|
18849
|
+
this.core.activePlayback.volume(volume);
|
|
18823
18850
|
try {
|
|
18824
|
-
this.
|
|
18825
|
-
this.core.trigger(VolumeFadeEvents.FADE, progress * this._aboveBorderVolume);
|
|
18851
|
+
this.core.trigger(VolumeFadeEvents.FADE, volume);
|
|
18826
18852
|
}
|
|
18827
18853
|
catch (error) {
|
|
18828
|
-
this.clearCurrentInterval();
|
|
18829
18854
|
}
|
|
18830
|
-
if (progress >= 1
|
|
18831
|
-
this.
|
|
18855
|
+
if (progress >= 1) {
|
|
18856
|
+
this.stopFade();
|
|
18832
18857
|
}
|
|
18833
18858
|
}, 10);
|
|
18834
18859
|
}
|
|
18835
|
-
|
|
18836
|
-
if (this.
|
|
18837
|
-
clearInterval(this.
|
|
18838
|
-
this.
|
|
18860
|
+
stopFade() {
|
|
18861
|
+
if (this.timerId !== null) {
|
|
18862
|
+
clearInterval(this.timerId);
|
|
18863
|
+
this.timerId = null;
|
|
18839
18864
|
}
|
|
18840
18865
|
}
|
|
18841
|
-
onLeave() {
|
|
18842
|
-
this.numberTo(this.delay, 1);
|
|
18843
|
-
}
|
|
18844
18866
|
}
|
|
18845
18867
|
|
|
18846
|
-
export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, NerdStats as ClapprNerdStats, ClapprStats, ClickToPause, Clips, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, QualityLevels as LevelSelector, Logo, MediaControl, MultiCamera, NerdStats, PictureInPicture, PlaybackRate, Poster, QualityLevels, SeekTime, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };
|
|
18868
|
+
export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, NerdStats as ClapprNerdStats, ClapprStats, ClapprStatsChronograph, ClapprStatsCounter, ClapprStatsEvents, ClickToPause, Clips, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, ExtendedEvents, Favicon, GearEvents, GoogleAnalytics, QualityLevels as LevelSelector, Logo, MediaControl, MultiCamera, NerdStats, PictureInPicture, PlaybackRate, Poster, QualityLevels, SeekTime, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };
|