@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
package/dist/index.js
CHANGED
|
@@ -43303,7 +43303,7 @@ class Player {
|
|
|
43303
43303
|
}
|
|
43304
43304
|
}
|
|
43305
43305
|
|
|
43306
|
-
var version$1 = "2.24.
|
|
43306
|
+
var version$1 = "2.24.3";
|
|
43307
43307
|
|
|
43308
43308
|
var packages = {
|
|
43309
43309
|
"node_modules/@clappr/core": {
|
|
@@ -43327,7 +43327,7 @@ function version() {
|
|
|
43327
43327
|
};
|
|
43328
43328
|
}
|
|
43329
43329
|
|
|
43330
|
-
const pluginHtml$
|
|
43330
|
+
const pluginHtml$6 = "<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";
|
|
43331
43331
|
|
|
43332
43332
|
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";
|
|
43333
43333
|
|
|
@@ -43636,6 +43636,10 @@ const LEFT_ORDER = [
|
|
|
43636
43636
|
'duration',
|
|
43637
43637
|
'dvr',
|
|
43638
43638
|
];
|
|
43639
|
+
/**
|
|
43640
|
+
* Extended events for the {@link MediaControl} plugin
|
|
43641
|
+
* @beta
|
|
43642
|
+
*/
|
|
43639
43643
|
var ExtendedEvents;
|
|
43640
43644
|
(function (ExtendedEvents) {
|
|
43641
43645
|
ExtendedEvents["MEDIACONTROL_VOLUME"] = "mediacontrol:volume";
|
|
@@ -43916,6 +43920,7 @@ class MediaControl extends UICorePlugin {
|
|
|
43916
43920
|
onVolumeChanged() {
|
|
43917
43921
|
this.updateVolumeUI();
|
|
43918
43922
|
}
|
|
43923
|
+
// TODO check if CONTAINER_SETTINGSUPDATE handler is sufficient
|
|
43919
43924
|
onLoadedMetadata() {
|
|
43920
43925
|
const video = this.core.activePlayback?.el;
|
|
43921
43926
|
// video.webkitSupportsFullscreen is deprecated but iOS appears to only use this
|
|
@@ -44802,7 +44807,7 @@ class AudioTracks extends UICorePlugin {
|
|
|
44802
44807
|
static get version() {
|
|
44803
44808
|
return VERSION$7;
|
|
44804
44809
|
}
|
|
44805
|
-
static template = tmpl(pluginHtml$
|
|
44810
|
+
static template = tmpl(pluginHtml$6);
|
|
44806
44811
|
/**
|
|
44807
44812
|
* @internal
|
|
44808
44813
|
*/
|
|
@@ -44943,20 +44948,25 @@ class AudioTracks extends UICorePlugin {
|
|
|
44943
44948
|
}
|
|
44944
44949
|
}
|
|
44945
44950
|
|
|
44946
|
-
const
|
|
44951
|
+
const templateHtml$2 = "<div class=\"big-mute-icon-wrapper\" data-big-mute id=\"gplayer-big-mute-button\">\n <div class=\"big-mute-icon gcore-skin-border-color\" data-big-mute-icon id=\"gplayer-big-mute-icon\"></div>\n</div>\n";
|
|
44947
44952
|
|
|
44948
44953
|
const T$h = 'plugins.big_mute_button';
|
|
44949
44954
|
// TODO rewrite as a container plugin
|
|
44950
44955
|
/**
|
|
44951
|
-
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
44952
|
-
* Once pressed, it unmutes the video.
|
|
44956
|
+
* `PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
44953
44957
|
* @beta
|
|
44958
|
+
* @remarks
|
|
44959
|
+
* When pressed, it unmutes the video.
|
|
44960
|
+
* @example
|
|
44961
|
+
* ```ts
|
|
44962
|
+
* import { BigMuteButton } from '@gcorevideo/player'
|
|
44963
|
+
* Player.registerPlugin(BigMuteButton)
|
|
44964
|
+
* ```
|
|
44954
44965
|
*/
|
|
44955
44966
|
class BigMuteButton extends UICorePlugin {
|
|
44956
|
-
|
|
44967
|
+
hidden = false;
|
|
44968
|
+
// TODO get back to the ads-related logic later
|
|
44957
44969
|
_adIsPlaying = false;
|
|
44958
|
-
$bigMuteBtnContainer = null;
|
|
44959
|
-
$bigMuteButton = null;
|
|
44960
44970
|
/**
|
|
44961
44971
|
* @internal
|
|
44962
44972
|
*/
|
|
@@ -44969,14 +44979,13 @@ class BigMuteButton extends UICorePlugin {
|
|
|
44969
44979
|
get supportedVersion() {
|
|
44970
44980
|
return { min: CLAPPR_VERSION$1 };
|
|
44971
44981
|
}
|
|
44972
|
-
static template = tmpl(
|
|
44982
|
+
static template = tmpl(templateHtml$2);
|
|
44973
44983
|
/**
|
|
44974
44984
|
* @internal
|
|
44975
44985
|
*/
|
|
44976
44986
|
get events() {
|
|
44977
44987
|
return {
|
|
44978
|
-
'click
|
|
44979
|
-
'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
|
|
44988
|
+
'click': 'clicked',
|
|
44980
44989
|
};
|
|
44981
44990
|
}
|
|
44982
44991
|
/**
|
|
@@ -44984,111 +44993,92 @@ class BigMuteButton extends UICorePlugin {
|
|
|
44984
44993
|
*/
|
|
44985
44994
|
bindEvents() {
|
|
44986
44995
|
this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
|
|
44996
|
+
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
|
|
44987
44997
|
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
44988
44998
|
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
44989
|
-
trace(`${T$h} bindEvents`, {
|
|
44990
|
-
mediacontrol: !!this.core.mediaControl,
|
|
44991
|
-
});
|
|
44992
|
-
// TOOD use core.getPlugin('media_control')
|
|
44993
|
-
this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mediaControlRendered);
|
|
44994
44999
|
}
|
|
44995
45000
|
onCoreReady() {
|
|
45001
|
+
}
|
|
45002
|
+
onContainerChanged() {
|
|
44996
45003
|
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_VOLUME, this.onContainerVolume);
|
|
44997
|
-
this.listenTo(
|
|
45004
|
+
// this.listenTo(
|
|
45005
|
+
// this.core.activeContainer,
|
|
45006
|
+
// Events.CONTAINER_READY,
|
|
45007
|
+
// this.onContainerReady,
|
|
45008
|
+
// )
|
|
44998
45009
|
this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_ENDED, this.onPlaybackEnded);
|
|
45010
|
+
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAY, this.onPlay);
|
|
44999
45011
|
}
|
|
45000
|
-
|
|
45001
|
-
|
|
45002
|
-
|
|
45012
|
+
onPlay(_, { autoPlay }) {
|
|
45013
|
+
const container = this.core.activeContainer;
|
|
45014
|
+
const { volume } = container;
|
|
45015
|
+
const { wasMuted } = this.options;
|
|
45016
|
+
trace(`${T$h} onPlay`, {
|
|
45017
|
+
autoPlay,
|
|
45018
|
+
wasMuted,
|
|
45019
|
+
volume,
|
|
45020
|
+
});
|
|
45021
|
+
if (autoPlay && !wasMuted && volume === 0) {
|
|
45022
|
+
this.mount();
|
|
45023
|
+
}
|
|
45024
|
+
else {
|
|
45025
|
+
this.destroy();
|
|
45003
45026
|
}
|
|
45004
45027
|
}
|
|
45005
|
-
|
|
45006
|
-
if (
|
|
45007
|
-
this.
|
|
45028
|
+
onContainerVolume(value) {
|
|
45029
|
+
if (value !== 0) {
|
|
45030
|
+
this.destroy();
|
|
45008
45031
|
}
|
|
45009
45032
|
}
|
|
45010
45033
|
onPlaybackEnded() {
|
|
45011
|
-
this.
|
|
45012
|
-
}
|
|
45013
|
-
mediaControlRendered() {
|
|
45014
|
-
const container = this.core.activeContainer;
|
|
45015
|
-
trace(`${T$h} mediaControlRendered`, {
|
|
45016
|
-
container: !!container,
|
|
45017
|
-
});
|
|
45018
|
-
if (container) {
|
|
45019
|
-
this.listenTo(container.playback, Events$1.PLAYBACK_PLAY, () => {
|
|
45020
|
-
trace(`${T$h} PLAYBACK_PLAY`);
|
|
45021
|
-
this.render();
|
|
45022
|
-
});
|
|
45023
|
-
}
|
|
45034
|
+
this.hide();
|
|
45024
45035
|
}
|
|
45025
45036
|
onStartAd() {
|
|
45026
45037
|
this._adIsPlaying = true;
|
|
45027
|
-
|
|
45028
|
-
this.$bigMuteBtnContainer.addClass('hide');
|
|
45029
|
-
}
|
|
45038
|
+
this.hide();
|
|
45030
45039
|
}
|
|
45031
45040
|
onFinishAd() {
|
|
45032
45041
|
this._adIsPlaying = false;
|
|
45033
|
-
|
|
45034
|
-
this.$bigMuteBtnContainer.removeClass('hide');
|
|
45035
|
-
}
|
|
45036
|
-
}
|
|
45037
|
-
shouldRender() {
|
|
45038
|
-
const container = this.core.activeContainer;
|
|
45039
|
-
if (!container) {
|
|
45040
|
-
return false;
|
|
45041
|
-
}
|
|
45042
|
-
const { autoPlay, wasMuted } = this.options;
|
|
45043
|
-
const volume = container.volume;
|
|
45044
|
-
trace(`${T$h} shouldRender`, {
|
|
45045
|
-
autoPlay,
|
|
45046
|
-
wasMuted,
|
|
45047
|
-
volume,
|
|
45048
|
-
});
|
|
45049
|
-
return autoPlay && !wasMuted && volume === 0;
|
|
45042
|
+
this.show();
|
|
45050
45043
|
}
|
|
45051
45044
|
/**
|
|
45052
45045
|
* @internal
|
|
45053
45046
|
*/
|
|
45054
45047
|
render() {
|
|
45055
|
-
|
|
45056
|
-
|
|
45057
|
-
|
|
45058
|
-
|
|
45059
|
-
|
|
45060
|
-
this.$bigMuteBtnContainer = this.$el.find('.big-mute-icon-wrapper[data-big-mute]');
|
|
45061
|
-
this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide');
|
|
45062
|
-
this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon');
|
|
45063
|
-
this.$bigMuteButton.append(volumeMuteIcon);
|
|
45064
|
-
const container = this.core.activeContainer;
|
|
45065
|
-
container.$el.append(this.$el.get(0));
|
|
45066
|
-
}
|
|
45048
|
+
trace(`${T$h} render`);
|
|
45049
|
+
this.$el.html(BigMuteButton.template());
|
|
45050
|
+
this.$el.find('#gplayer-big-mute-icon').append(volumeMuteIcon);
|
|
45051
|
+
// TODO
|
|
45052
|
+
// this._adIsPlaying && this.hide()
|
|
45067
45053
|
return this;
|
|
45068
45054
|
}
|
|
45069
|
-
|
|
45070
|
-
this.
|
|
45071
|
-
this
|
|
45055
|
+
mount() {
|
|
45056
|
+
this.core.activeContainer.$el.append(this.$el);
|
|
45057
|
+
this.show();
|
|
45072
45058
|
}
|
|
45073
|
-
|
|
45074
|
-
this.
|
|
45075
|
-
|
|
45076
|
-
this.$bigMuteBtnContainer.removeClass('hide');
|
|
45077
|
-
}
|
|
45059
|
+
hide() {
|
|
45060
|
+
this.hidden = true;
|
|
45061
|
+
this.$el.find('#gplayer-big-mute-button')?.addClass('hide');
|
|
45078
45062
|
}
|
|
45079
|
-
|
|
45080
|
-
this.
|
|
45081
|
-
|
|
45082
|
-
e.stopPropagation();
|
|
45083
|
-
}
|
|
45084
|
-
this.destroy();
|
|
45063
|
+
show() {
|
|
45064
|
+
this.hidden = false;
|
|
45065
|
+
this.$el.find('#gplayer-big-mute-button')?.removeClass('hide');
|
|
45085
45066
|
}
|
|
45086
45067
|
clicked(e) {
|
|
45068
|
+
trace(`${T$h} clicked`);
|
|
45069
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
45070
|
+
// TODO delegate to media_control plugin
|
|
45087
45071
|
const localVolume = Utils.Config.restore('volume');
|
|
45088
45072
|
const volume = !isNaN(localVolume) ? localVolume : 100;
|
|
45089
|
-
|
|
45090
|
-
|
|
45091
|
-
|
|
45073
|
+
const unmuted = volume === 0 ? 100 : volume;
|
|
45074
|
+
if (mediaControl) {
|
|
45075
|
+
mediaControl.setVolume(unmuted);
|
|
45076
|
+
}
|
|
45077
|
+
else {
|
|
45078
|
+
this.core.activeContainer.setVolume(unmuted);
|
|
45079
|
+
}
|
|
45080
|
+
e.stopPropagation?.();
|
|
45081
|
+
this.destroy();
|
|
45092
45082
|
}
|
|
45093
45083
|
}
|
|
45094
45084
|
|
|
@@ -45735,24 +45725,42 @@ const CMCD_KEYS = [
|
|
|
45735
45725
|
];
|
|
45736
45726
|
// const T = 'plugins.cmcd'
|
|
45737
45727
|
/**
|
|
45738
|
-
* A `PLUGIN` that configures CMCD for playback
|
|
45728
|
+
* A `PLUGIN` that configures {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf | CMCD} for playback
|
|
45739
45729
|
* @beta
|
|
45740
45730
|
* @remarks
|
|
45741
|
-
* Configuration options
|
|
45742
|
-
*
|
|
45731
|
+
* Configuration options - {@link CmcdConfigOptions}.
|
|
45732
|
+
* @example
|
|
45733
|
+
* ```ts
|
|
45734
|
+
* import { CmcdConfig } from '@gcorevideo/player'
|
|
45735
|
+
* Player.registerPlugin(CmcdConfig)
|
|
45736
|
+
*
|
|
45737
|
+
* const player = new Player({
|
|
45738
|
+
* source: 'https://example.com/video.mp4',
|
|
45739
|
+
* cmcd: {
|
|
45740
|
+
* sessionId: '1234567890',
|
|
45741
|
+
* contentId: 'f572d396fae9206628714fb2ce00f72e94f2258f',
|
|
45742
|
+
* },
|
|
45743
|
+
* })
|
|
45744
|
+
* ```
|
|
45743
45745
|
*/
|
|
45744
45746
|
class CmcdConfig extends CorePlugin {
|
|
45745
45747
|
sid;
|
|
45746
45748
|
cid = '';
|
|
45747
45749
|
/**
|
|
45748
|
-
* @
|
|
45750
|
+
* @internal
|
|
45749
45751
|
*/
|
|
45750
45752
|
get name() {
|
|
45751
45753
|
return 'cmcd';
|
|
45752
45754
|
}
|
|
45755
|
+
/**
|
|
45756
|
+
* @internal
|
|
45757
|
+
*/
|
|
45753
45758
|
get version() {
|
|
45754
45759
|
return '0.1.0';
|
|
45755
45760
|
}
|
|
45761
|
+
/**
|
|
45762
|
+
* @internal
|
|
45763
|
+
*/
|
|
45756
45764
|
get supportedVersion() {
|
|
45757
45765
|
return CLAPPR_VERSION$1;
|
|
45758
45766
|
}
|
|
@@ -45762,11 +45770,16 @@ class CmcdConfig extends CorePlugin {
|
|
|
45762
45770
|
this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
|
|
45763
45771
|
}
|
|
45764
45772
|
/**
|
|
45765
|
-
* @
|
|
45773
|
+
* @internal
|
|
45766
45774
|
*/
|
|
45767
45775
|
bindEvents() {
|
|
45768
45776
|
this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () => this.updateSettings(this.core.containers[0]));
|
|
45769
45777
|
}
|
|
45778
|
+
/**
|
|
45779
|
+
* Returns the current `sid` and `cid` values.
|
|
45780
|
+
* Useful when the auto-generated values need to be known.
|
|
45781
|
+
* @returns `sid` and `cid` values
|
|
45782
|
+
*/
|
|
45770
45783
|
exportIds() {
|
|
45771
45784
|
return {
|
|
45772
45785
|
sid: this.sid,
|
|
@@ -45802,19 +45815,6 @@ class CmcdConfig extends CorePlugin {
|
|
|
45802
45815
|
break;
|
|
45803
45816
|
}
|
|
45804
45817
|
}
|
|
45805
|
-
updateHlsjsSettings(options, { cid, sid }) {
|
|
45806
|
-
$.extend(true, options, {
|
|
45807
|
-
playback: {
|
|
45808
|
-
hlsjsConfig: {
|
|
45809
|
-
cmcd: {
|
|
45810
|
-
includeKeys: CMCD_KEYS,
|
|
45811
|
-
sessionId: sid,
|
|
45812
|
-
contentId: cid,
|
|
45813
|
-
},
|
|
45814
|
-
},
|
|
45815
|
-
},
|
|
45816
|
-
});
|
|
45817
|
-
}
|
|
45818
45818
|
generateContentId() {
|
|
45819
45819
|
return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
|
|
45820
45820
|
}
|
|
@@ -48526,7 +48526,8 @@ class Clips extends UICorePlugin {
|
|
|
48526
48526
|
* @returns The text of the clip at the given time
|
|
48527
48527
|
*/
|
|
48528
48528
|
getText(time) {
|
|
48529
|
-
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
48529
|
+
return this.clips.find((clip) => clip.start <= time && clip.end >= time)
|
|
48530
|
+
?.text;
|
|
48530
48531
|
}
|
|
48531
48532
|
onCoreReady() {
|
|
48532
48533
|
trace(`${T$d} onCoreReady`);
|
|
@@ -51322,6 +51323,7 @@ class SourceController extends CorePlugin {
|
|
|
51322
51323
|
currentSourceIndex = 0;
|
|
51323
51324
|
sourcesDelay = {};
|
|
51324
51325
|
active = false;
|
|
51326
|
+
autoPlay = false;
|
|
51325
51327
|
switching = false;
|
|
51326
51328
|
sync = noSync;
|
|
51327
51329
|
/**
|
|
@@ -51397,6 +51399,7 @@ class SourceController extends CorePlugin {
|
|
|
51397
51399
|
if (this.switching) {
|
|
51398
51400
|
return;
|
|
51399
51401
|
}
|
|
51402
|
+
this.autoPlay = !!this.core.activeContainer.actionsMetadata.playEvent?.autoPlay;
|
|
51400
51403
|
switch (error.code) {
|
|
51401
51404
|
case PlaybackErrorCode.MediaSourceUnavailable:
|
|
51402
51405
|
this.core.activeContainer?.getPlugin('poster')?.disable();
|
|
@@ -51415,6 +51418,12 @@ class SourceController extends CorePlugin {
|
|
|
51415
51418
|
this.core.activeContainer?.getPlugin('spinner')?.hide();
|
|
51416
51419
|
}
|
|
51417
51420
|
});
|
|
51421
|
+
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAY, (_, { autoPlay }) => {
|
|
51422
|
+
trace(`${T$4} onContainerPlay`, {
|
|
51423
|
+
autoPlay,
|
|
51424
|
+
});
|
|
51425
|
+
this.autoPlay = !!autoPlay;
|
|
51426
|
+
});
|
|
51418
51427
|
}
|
|
51419
51428
|
reset() {
|
|
51420
51429
|
this.active = false;
|
|
@@ -51432,17 +51441,20 @@ class SourceController extends CorePlugin {
|
|
|
51432
51441
|
trace(`${T$4} retryPlayback syncing...`, {
|
|
51433
51442
|
nextSource,
|
|
51434
51443
|
});
|
|
51435
|
-
const rnd = RETRY_DELAY_BLUR * Math.random();
|
|
51444
|
+
const rnd = Math.round(RETRY_DELAY_BLUR * Math.random());
|
|
51436
51445
|
this.sync(() => {
|
|
51437
|
-
trace(`${T$4} retryPlayback loading...`);
|
|
51438
51446
|
this.switching = false;
|
|
51439
51447
|
this.core.load(nextSource.source, nextSource.mimeType);
|
|
51440
51448
|
trace(`${T$4} retryPlayback loaded`, {
|
|
51441
51449
|
nextSource,
|
|
51442
51450
|
});
|
|
51443
51451
|
setTimeout(() => {
|
|
51444
|
-
|
|
51445
|
-
|
|
51452
|
+
trace(`${T$4} retryPlayback playing`, {
|
|
51453
|
+
autoPlay: this.autoPlay,
|
|
51454
|
+
});
|
|
51455
|
+
this.core.activeContainer.play({
|
|
51456
|
+
autoPlay: this.autoPlay,
|
|
51457
|
+
});
|
|
51446
51458
|
}, rnd);
|
|
51447
51459
|
});
|
|
51448
51460
|
});
|
package/dist/player.d.ts
CHANGED
|
@@ -109,9 +109,15 @@ export { AudioTracks as AudioSelector }
|
|
|
109
109
|
export { AudioTracks }
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* `PLUGIN` that displays a big mute button over the video when it's muted.
|
|
113
|
-
* Once pressed, it unmutes the video.
|
|
112
|
+
* `PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
114
113
|
* @beta
|
|
114
|
+
* @remarks
|
|
115
|
+
* When pressed, it unmutes the video.
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* import { BigMuteButton } from '@gcorevideo/player'
|
|
119
|
+
* Player.registerPlugin(BigMuteButton)
|
|
120
|
+
* ```
|
|
115
121
|
*/
|
|
116
122
|
export declare class BigMuteButton extends UICorePlugin {
|
|
117
123
|
private isBigMuteButtonHidden;
|
|
@@ -144,14 +150,16 @@ export declare class BigMuteButton extends UICorePlugin {
|
|
|
144
150
|
private onContainerVolume;
|
|
145
151
|
private onContainerStart;
|
|
146
152
|
private onPlaybackEnded;
|
|
147
|
-
private
|
|
153
|
+
private onMediaControlRendered;
|
|
148
154
|
private onStartAd;
|
|
149
155
|
private onFinishAd;
|
|
150
|
-
private
|
|
156
|
+
private isActive;
|
|
151
157
|
/**
|
|
152
158
|
* @internal
|
|
153
159
|
*/
|
|
154
160
|
render(): this;
|
|
161
|
+
private mount;
|
|
162
|
+
private update;
|
|
155
163
|
private hideBigMuteBtn;
|
|
156
164
|
private showBigMuteBtn;
|
|
157
165
|
private destroyBigMuteBtn;
|
|
@@ -302,6 +310,7 @@ export declare class BottomGear extends UICorePlugin {
|
|
|
302
310
|
private onCoreReady;
|
|
303
311
|
private onMediaControlRendered;
|
|
304
312
|
private mount;
|
|
313
|
+
private alignSubmenu;
|
|
305
314
|
}
|
|
306
315
|
|
|
307
316
|
/**
|
|
@@ -480,13 +489,17 @@ export declare type ClapprStatsMetrics = {
|
|
|
480
489
|
};
|
|
481
490
|
};
|
|
482
491
|
|
|
483
|
-
|
|
492
|
+
/**
|
|
493
|
+
* Config options for the {@link ClapprStats} plugin
|
|
494
|
+
* @beta
|
|
495
|
+
*/
|
|
496
|
+
export declare interface ClapprStatsSettings {
|
|
484
497
|
/**
|
|
485
498
|
* The interval in milliseconds of periodic measurements.
|
|
486
499
|
* The plugin will emit a {@link ClapprStatsEvents.REPORT} event with the collected metrics at the specified interval.
|
|
487
500
|
*/
|
|
488
501
|
runEach?: number;
|
|
489
|
-
}
|
|
502
|
+
}
|
|
490
503
|
|
|
491
504
|
/**
|
|
492
505
|
* A small `PLUGIN` that toggles the playback state on click over the video container
|
|
@@ -578,7 +591,7 @@ export declare class Clips extends UICorePlugin {
|
|
|
578
591
|
*/
|
|
579
592
|
export declare interface ClipsPluginSettings {
|
|
580
593
|
/**
|
|
581
|
-
* The compiled text of the clips description, one clip per line in format
|
|
594
|
+
* The compiled text of the clips description, one clip per line in format:
|
|
582
595
|
* `HH:MM:SS text` or `MM:SS text` or `SS text`
|
|
583
596
|
*/
|
|
584
597
|
text: string;
|
|
@@ -704,49 +717,72 @@ export declare type ClosedCaptionsPluginSettings = {
|
|
|
704
717
|
};
|
|
705
718
|
|
|
706
719
|
/**
|
|
707
|
-
* A `PLUGIN` that configures CMCD for playback
|
|
720
|
+
* A `PLUGIN` that configures {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf | CMCD} for playback
|
|
708
721
|
* @beta
|
|
709
722
|
* @remarks
|
|
710
|
-
* Configuration options
|
|
711
|
-
*
|
|
723
|
+
* Configuration options - {@link CmcdConfigOptions}.
|
|
724
|
+
* @example
|
|
725
|
+
* ```ts
|
|
726
|
+
* import { CmcdConfig } from '@gcorevideo/player'
|
|
727
|
+
* Player.registerPlugin(CmcdConfig)
|
|
728
|
+
*
|
|
729
|
+
* const player = new Player({
|
|
730
|
+
* source: 'https://example.com/video.mp4',
|
|
731
|
+
* cmcd: {
|
|
732
|
+
* sessionId: '1234567890',
|
|
733
|
+
* contentId: 'f572d396fae9206628714fb2ce00f72e94f2258f',
|
|
734
|
+
* },
|
|
735
|
+
* })
|
|
736
|
+
* ```
|
|
712
737
|
*/
|
|
713
738
|
export declare class CmcdConfig extends CorePlugin {
|
|
714
739
|
private sid;
|
|
715
740
|
private cid;
|
|
716
741
|
/**
|
|
717
|
-
* @
|
|
742
|
+
* @internal
|
|
718
743
|
*/
|
|
719
744
|
get name(): string;
|
|
745
|
+
/**
|
|
746
|
+
* @internal
|
|
747
|
+
*/
|
|
720
748
|
get version(): string;
|
|
749
|
+
/**
|
|
750
|
+
* @internal
|
|
751
|
+
*/
|
|
721
752
|
get supportedVersion(): string;
|
|
722
753
|
constructor(core: Core);
|
|
723
754
|
/**
|
|
724
|
-
* @
|
|
755
|
+
* @internal
|
|
725
756
|
*/
|
|
726
757
|
bindEvents(): void;
|
|
758
|
+
/**
|
|
759
|
+
* Returns the current `sid` and `cid` values.
|
|
760
|
+
* Useful when the auto-generated values need to be known.
|
|
761
|
+
* @returns `sid` and `cid` values
|
|
762
|
+
*/
|
|
727
763
|
exportIds(): {
|
|
728
764
|
sid: string;
|
|
729
765
|
cid: string;
|
|
730
766
|
};
|
|
731
767
|
private updateSettings;
|
|
732
|
-
private updateHlsjsSettings;
|
|
733
768
|
private generateContentId;
|
|
734
769
|
}
|
|
735
770
|
|
|
736
771
|
/**
|
|
772
|
+
* Config options for the {@link CmcdConfig} plugin
|
|
737
773
|
* @beta
|
|
738
774
|
*/
|
|
739
|
-
export declare
|
|
775
|
+
export declare interface CmcdConfigOptions {
|
|
740
776
|
/**
|
|
741
|
-
*
|
|
777
|
+
* `sid` value. If ommitted, a random UUID will be generated
|
|
742
778
|
*/
|
|
743
|
-
sessionId
|
|
779
|
+
sessionId?: string;
|
|
744
780
|
/**
|
|
745
|
-
*
|
|
781
|
+
* `cid` value.
|
|
746
782
|
* If ommitted, the pathname part of the first source URL will be used
|
|
747
783
|
*/
|
|
748
784
|
contentId?: string;
|
|
749
|
-
}
|
|
785
|
+
}
|
|
750
786
|
|
|
751
787
|
/**
|
|
752
788
|
* @public
|
|
@@ -986,6 +1022,10 @@ export declare type ErrorScreenSettings = {
|
|
|
986
1022
|
noReload?: boolean;
|
|
987
1023
|
};
|
|
988
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* Extended events for the {@link MediaControl} plugin
|
|
1027
|
+
* @beta
|
|
1028
|
+
*/
|
|
989
1029
|
export declare enum ExtendedEvents {
|
|
990
1030
|
MEDIACONTROL_VOLUME = "mediacontrol:volume",
|
|
991
1031
|
MEDIACONTROL_MENU_COLLAPSE = "mediacontrol:menu:collapse"
|
|
@@ -1287,6 +1327,13 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
1287
1327
|
* Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
|
|
1288
1328
|
*/
|
|
1289
1329
|
enable(): void;
|
|
1330
|
+
/**
|
|
1331
|
+
*
|
|
1332
|
+
* @returns Vertical space available to render something on top of the container.
|
|
1333
|
+
* @remarks
|
|
1334
|
+
* This takes into account the container height and excludes the height of the controls bar
|
|
1335
|
+
*/
|
|
1336
|
+
getAvailableHeight(): number;
|
|
1290
1337
|
/**
|
|
1291
1338
|
* Set the initial volume, which is preserved when playback is interrupted by an advertisement
|
|
1292
1339
|
*/
|
|
@@ -2348,7 +2395,11 @@ export declare class Poster extends UIContainerPlugin {
|
|
|
2348
2395
|
destroy(): this;
|
|
2349
2396
|
}
|
|
2350
2397
|
|
|
2351
|
-
|
|
2398
|
+
/**
|
|
2399
|
+
* Config options for the {@link Poster} plugin
|
|
2400
|
+
* @beta
|
|
2401
|
+
*/
|
|
2402
|
+
export declare interface PosterPluginSettings {
|
|
2352
2403
|
/**
|
|
2353
2404
|
* Custom CSS background
|
|
2354
2405
|
*/
|
|
@@ -2362,10 +2413,10 @@ export declare type PosterPluginSettings = {
|
|
|
2362
2413
|
*/
|
|
2363
2414
|
url?: string;
|
|
2364
2415
|
/**
|
|
2365
|
-
* Whether to show the poster after playback has ended
|
|
2416
|
+
* Whether to show the poster after playback has ended, by default `true`
|
|
2366
2417
|
*/
|
|
2367
2418
|
showOnVideoEnd?: boolean;
|
|
2368
|
-
}
|
|
2419
|
+
}
|
|
2369
2420
|
|
|
2370
2421
|
/**
|
|
2371
2422
|
* A level of quality within a media source/representation.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
8
|
>
|
|
9
9
|
|
|
10
|
-
`PLUGIN` that displays a big mute button over the video when it's
|
|
10
|
+
`PLUGIN` that displays a big mute button over the video when it's being played muted.
|
|
11
11
|
|
|
12
12
|
**Signature:**
|
|
13
13
|
|
|
@@ -16,3 +16,15 @@ export declare class BigMuteButton extends UICorePlugin
|
|
|
16
16
|
```
|
|
17
17
|
**Extends:** UICorePlugin
|
|
18
18
|
|
|
19
|
+
## Remarks
|
|
20
|
+
|
|
21
|
+
When pressed, it unmutes the video.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { BigMuteButton } from '@gcorevideo/player'
|
|
28
|
+
Player.registerPlugin(BigMuteButton)
|
|
29
|
+
```
|
|
30
|
+
|