@gcorevideo/player 2.22.4 → 2.22.7
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/level-selector/button.ejs +1 -1
- package/assets/level-selector/list.ejs +10 -4
- package/assets/level-selector/style.scss +8 -3
- package/assets/media-control/media-control.ejs +1 -2
- package/dist/core.js +2 -2
- package/dist/index.css +916 -912
- package/dist/index.js +452 -413
- package/dist/plugins/index.css +668 -664
- package/dist/plugins/index.js +514 -474
- package/lib/index.plugins.d.ts +2 -1
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +1 -1
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +2 -2
- package/lib/plugins/level-selector/LevelSelector.d.ts +6 -5
- package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
- package/lib/plugins/level-selector/LevelSelector.js +11 -8
- package/lib/plugins/level-selector/QualityLevels.d.ts +112 -0
- package/lib/plugins/level-selector/QualityLevels.d.ts.map +1 -0
- package/lib/plugins/level-selector/QualityLevels.js +280 -0
- package/lib/plugins/media-control/MediaControl.d.ts +37 -6
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +54 -36
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +5 -4
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +46 -24
- package/lib/plugins/subtitles/ClosedCaptions.js +1 -1
- package/lib/plugins/utils/fullscreen.d.ts +4 -0
- package/lib/plugins/utils/fullscreen.d.ts.map +1 -0
- package/lib/plugins/utils/fullscreen.js +30 -0
- package/lib/plugins/utils.d.ts +0 -1
- package/lib/plugins/utils.d.ts.map +1 -1
- package/lib/plugins/utils.js +0 -28
- 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/lib/utils/fullscreen.d.ts +3 -0
- package/lib/utils/fullscreen.d.ts.map +1 -0
- package/lib/utils/fullscreen.js +2 -0
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -1
- package/src/playback/dash-playback/DashPlayback.ts +1 -4
- package/src/plugins/bottom-gear/BottomGear.ts +2 -2
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +15 -3
- package/src/plugins/level-selector/{LevelSelector.ts → QualityLevels.ts} +19 -13
- package/src/plugins/level-selector/__tests__/{LevelSelector.test.ts → QualityLevels.test.ts} +20 -6
- package/src/plugins/level-selector/__tests__/__snapshots__/{LevelSelector.test.ts.snap → QualityLevels.test.ts.snap} +58 -25
- package/src/plugins/media-control/MediaControl.ts +111 -62
- package/src/plugins/media-control/__tests__/MediaControl.test.ts +118 -8
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +149 -5
- package/src/plugins/playback-rate/PlaybackRate.ts +48 -26
- package/src/plugins/playback-rate/__tests__/PlaybackRate.test.ts +125 -55
- package/src/plugins/playback-rate/__tests__/__snapshots__/PlaybackRate.test.ts.snap +1 -1
- package/src/plugins/subtitles/ClosedCaptions.ts +1 -1
- package/src/plugins/utils/fullscreen.ts +34 -0
- package/src/plugins/utils.ts +0 -31
- package/src/plugins/vast-ads/VastAds.ts +8 -4
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -13091,8 +13091,8 @@ class DashPlayback extends BasePlayback {
|
|
|
13091
13091
|
return super.destroy();
|
|
13092
13092
|
}
|
|
13093
13093
|
_updatePlaybackType() {
|
|
13094
|
-
assert.ok(this._dash, 'An instance of dashjs MediaPlayer is required to update the playback type');
|
|
13095
13094
|
const prevPlaybackType = this._playbackType;
|
|
13095
|
+
// @ts-ignore
|
|
13096
13096
|
this._playbackType = this._dash.isDynamic() ? Playback.LIVE : Playback.VOD;
|
|
13097
13097
|
if (prevPlaybackType !== this._playbackType) {
|
|
13098
13098
|
this._updateSettings();
|
|
@@ -43299,7 +43299,7 @@ class Player {
|
|
|
43299
43299
|
}
|
|
43300
43300
|
}
|
|
43301
43301
|
|
|
43302
|
-
var version$1 = "2.22.
|
|
43302
|
+
var version$1 = "2.22.7";
|
|
43303
43303
|
|
|
43304
43304
|
var packages = {
|
|
43305
43305
|
"node_modules/@clappr/core": {
|
|
@@ -43843,7 +43843,6 @@ class BottomGear extends UICorePlugin {
|
|
|
43843
43843
|
.find('#gear-sub-menu-wrapper')
|
|
43844
43844
|
.hide();
|
|
43845
43845
|
// TODO make non-clickable when there are no items
|
|
43846
|
-
mediaControl.putElement('gear', this.$el);
|
|
43847
43846
|
setTimeout(() => {
|
|
43848
43847
|
this.trigger(GearEvents.RENDERED);
|
|
43849
43848
|
}, 0);
|
|
@@ -43873,7 +43872,8 @@ class BottomGear extends UICorePlugin {
|
|
|
43873
43872
|
}
|
|
43874
43873
|
onMediaControlRendered() {
|
|
43875
43874
|
trace(`${T$f} onMediaControlRendered`);
|
|
43876
|
-
this.
|
|
43875
|
+
const mediaControl = this.core.getPlugin('media_control');
|
|
43876
|
+
mediaControl.putElement('gear', this.$el);
|
|
43877
43877
|
}
|
|
43878
43878
|
}
|
|
43879
43879
|
|
|
@@ -46738,32 +46738,6 @@ function strtimeToMiliseconds(str) {
|
|
|
46738
46738
|
}
|
|
46739
46739
|
return (h + m + s);
|
|
46740
46740
|
}
|
|
46741
|
-
// TODO refactor
|
|
46742
|
-
function isFullscreen(el) {
|
|
46743
|
-
const video = el.nodeName === "video" ? el : el.querySelector('video');
|
|
46744
|
-
if (!video) {
|
|
46745
|
-
return false;
|
|
46746
|
-
}
|
|
46747
|
-
if (Browser.isiOS) {
|
|
46748
|
-
return FullscreenIOS.isFullscreen(video);
|
|
46749
|
-
}
|
|
46750
|
-
return !!(document.fullscreenElement);
|
|
46751
|
-
}
|
|
46752
|
-
const FullscreenIOS = {
|
|
46753
|
-
isFullscreen: function (el) {
|
|
46754
|
-
try {
|
|
46755
|
-
// @ts-ignore
|
|
46756
|
-
if (el.webkitDisplayingFullscreen !== undefined) {
|
|
46757
|
-
// @ts-ignore
|
|
46758
|
-
return !!(el.webkitDisplayingFullscreen);
|
|
46759
|
-
}
|
|
46760
|
-
}
|
|
46761
|
-
catch (e) {
|
|
46762
|
-
reportError(e);
|
|
46763
|
-
}
|
|
46764
|
-
return false;
|
|
46765
|
-
}
|
|
46766
|
-
};
|
|
46767
46741
|
function getPageX(event) {
|
|
46768
46742
|
if (event.pageX) {
|
|
46769
46743
|
return event.pageX;
|
|
@@ -47494,283 +47468,6 @@ class GoogleAnalytics extends ContainerPlugin {
|
|
|
47494
47468
|
}
|
|
47495
47469
|
}
|
|
47496
47470
|
|
|
47497
|
-
const buttonHtml$2 = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option'>\n <span class=\"gear-option_hd-icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span><%= i18n.t('quality') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= currentText %></span>\n</button>\n";
|
|
47498
|
-
|
|
47499
|
-
const listHtml$1 = "<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\" id=\"level-selector-menu\">\n <% if (!removeAuto) { %>\n <li>\n <a href=\"#\" class='gear-sub-menu_btn gcore-skin-text-color' data-id=\"-1\" id=\"level_selector_auto\">\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 <li class=\"<%= maxLevel >= 0 && item.level > maxLevel ? 'disabled ' : ''%><%=item.level === current ? 'current ' : ''%>\">\n <a href=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.level === current ? ' gcore-skin-active' : '' %>\"\n data-id=\"<%= item.level %>\"\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";
|
|
47500
|
-
|
|
47501
|
-
const hdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.9562 8.22232H13.9961V15.1873H14.9562C15.8914 15.1873 16.766 14.8253 17.4195 14.1676C18.0786 13.5037 18.4415 12.6281 18.4415 11.7026C18.4415 9.7837 16.8781 8.22253 14.9561 8.22253L14.9562 8.22232Z\"\n fill=\"#C9C9C9\"/>\n <path\n d=\"M22.0801 4H1.91994C0.859222 4 0 4.86406 0 5.91994V17.4878C0 18.5437 0.859222 19.4078 1.91994 19.4078H22.0801C23.1408 19.4078 24 18.5437 24 17.4878V5.91994C24 4.86406 23.1408 4 22.0801 4ZM10.3975 15.3473C10.3975 15.6124 10.1827 15.8272 9.91754 15.8272C9.65216 15.8272 9.43761 15.6122 9.43761 15.3473V12.0239H5.55956V15.3473C5.55956 15.6124 5.34481 15.8272 5.07963 15.8272C4.81425 15.8272 4.5997 15.6122 4.5997 15.3473L4.59949 7.74042C4.59949 7.47524 4.81425 7.26049 5.07943 7.26049C5.34481 7.26049 5.55936 7.47544 5.55936 7.74042V11.0636H9.43741V7.74042C9.43741 7.47524 9.65216 7.26049 9.91734 7.26049C10.1827 7.26049 10.3973 7.47544 10.3973 7.74042L10.3975 15.3473ZM18.1005 14.8438C17.2652 15.6844 16.1486 16.1472 14.9561 16.1472H13.5161C13.2507 16.1472 13.0361 15.9323 13.0361 15.6673V7.74263C13.0361 7.47745 13.2509 7.26269 13.5161 7.26269H14.9561C17.4072 7.26269 19.4013 9.25438 19.4013 11.7027C19.4013 12.8835 18.9392 13.9991 18.1005 14.844V14.8438Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
47502
|
-
|
|
47503
|
-
const arrowRightIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M8.70725 20.7073C8.51225 20.9023 8.25625 21.0002 8.00025 21.0002C7.74425 21.0002 7.48825 20.9023 7.29325 20.7073C6.90225 20.3162 6.90225 19.6842 7.29325 19.2932L14.5863 12.0002L7.29325 4.70725C6.90225 4.31625 6.90225 3.68425 7.29325 3.29325C7.68425 2.90225 8.31625 2.90225 8.70725 3.29325L16.7073 11.2933C17.0983 11.6842 17.0983 12.3162 16.7073 12.7072L8.70725 20.7073Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
47504
|
-
|
|
47505
|
-
const arrowLeftIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M16.7073 19.2932C17.0983 19.6842 17.0983 20.3162 16.7073 20.7073C16.5123 20.9023 16.2563 21.0002 16.0003 21.0002C15.7443 21.0002 15.4882 20.9023 15.2933 20.7073L7.29325 12.7072C6.90225 12.3162 6.90225 11.6842 7.29325 11.2933L15.2933 3.29325C15.6842 2.90225 16.3163 2.90225 16.7073 3.29325C17.0983 3.68425 17.0983 4.31625 16.7073 4.70725L9.41425 12.0002L16.7073 19.2932Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
47506
|
-
|
|
47507
|
-
const checkIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M20.5793 4.19296C20.1216 3.86696 19.4777 3.96396 19.1424 4.40896L9.37295 17.3809L4.81634 12.107C4.45222 11.683 3.80218 11.6289 3.36709 11.9839C2.932 12.3389 2.87543 12.97 3.2416 13.393L8.64165 19.643C8.83708 19.869 9.12506 20 9.42849 20C9.4398 20 9.45114 20 9.46246 19.999C9.77926 19.989 10.0724 19.838 10.2586 19.59L20.8015 5.58996C21.1368 5.14496 21.0371 4.51896 20.5793 4.19296Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
47508
|
-
|
|
47509
|
-
const T$a = 'plugins.level_selector';
|
|
47510
|
-
const VERSION$4 = '2.19.4';
|
|
47511
|
-
/**
|
|
47512
|
-
* `PLUGIN` that provides a UI to select the desired quality level of the playback.
|
|
47513
|
-
* @beta
|
|
47514
|
-
*
|
|
47515
|
-
* @remarks
|
|
47516
|
-
* Depends on:
|
|
47517
|
-
*
|
|
47518
|
-
* - {@link MediaControl}
|
|
47519
|
-
*
|
|
47520
|
-
* - {@link BottomGear}
|
|
47521
|
-
*
|
|
47522
|
-
* The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
|
|
47523
|
-
*
|
|
47524
|
-
* Configuration options - {@link LevelSelectorPluginSettings}
|
|
47525
|
-
*
|
|
47526
|
-
* @example
|
|
47527
|
-
* ```ts
|
|
47528
|
-
* new Player({
|
|
47529
|
-
* levelSelector: {
|
|
47530
|
-
* restrictResolution: 360,
|
|
47531
|
-
* labels: { 360: 'SD', 720: 'HD' },
|
|
47532
|
-
* },
|
|
47533
|
-
* })
|
|
47534
|
-
* ```
|
|
47535
|
-
*/
|
|
47536
|
-
class LevelSelector extends UICorePlugin {
|
|
47537
|
-
levels = [];
|
|
47538
|
-
levelLabels = [];
|
|
47539
|
-
removeAuto = false;
|
|
47540
|
-
isHd = false;
|
|
47541
|
-
currentText = '';
|
|
47542
|
-
selectedLevelId = -1;
|
|
47543
|
-
static buttonTemplate = tmpl(buttonHtml$2);
|
|
47544
|
-
static listTemplate = tmpl(listHtml$1);
|
|
47545
|
-
/**
|
|
47546
|
-
* @internal
|
|
47547
|
-
*/
|
|
47548
|
-
get name() {
|
|
47549
|
-
return 'level_selector';
|
|
47550
|
-
}
|
|
47551
|
-
/**
|
|
47552
|
-
* @internal
|
|
47553
|
-
*/
|
|
47554
|
-
get supportedVersion() {
|
|
47555
|
-
return { min: CLAPPR_VERSION };
|
|
47556
|
-
}
|
|
47557
|
-
/**
|
|
47558
|
-
* @internal
|
|
47559
|
-
*/
|
|
47560
|
-
static get version() {
|
|
47561
|
-
return VERSION$4;
|
|
47562
|
-
}
|
|
47563
|
-
/**
|
|
47564
|
-
* @internal
|
|
47565
|
-
*/
|
|
47566
|
-
get attributes() {
|
|
47567
|
-
return {
|
|
47568
|
-
class: 'level-selector',
|
|
47569
|
-
'data-level-selector': '',
|
|
47570
|
-
};
|
|
47571
|
-
}
|
|
47572
|
-
get events() {
|
|
47573
|
-
return {
|
|
47574
|
-
'click .gear-sub-menu_btn': 'onSelect',
|
|
47575
|
-
'click .go-back': 'goBack',
|
|
47576
|
-
};
|
|
47577
|
-
}
|
|
47578
|
-
/**
|
|
47579
|
-
* @internal
|
|
47580
|
-
*/
|
|
47581
|
-
bindEvents() {
|
|
47582
|
-
this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
|
|
47583
|
-
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
|
|
47584
|
-
}
|
|
47585
|
-
onCoreReady() {
|
|
47586
|
-
trace(`${T$a} onCoreReady`);
|
|
47587
|
-
const gear = this.core.getPlugin('bottom_gear');
|
|
47588
|
-
assert(gear, 'bottom_gear plugin is required');
|
|
47589
|
-
this.currentText = this.core.i18n.t('auto');
|
|
47590
|
-
this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
|
|
47591
|
-
}
|
|
47592
|
-
onGearRendered() {
|
|
47593
|
-
trace(`${T$a} onGearRendered`);
|
|
47594
|
-
this.render();
|
|
47595
|
-
}
|
|
47596
|
-
onActiveContainerChange() {
|
|
47597
|
-
this.removeAuto = false;
|
|
47598
|
-
this.isHd = false;
|
|
47599
|
-
const activePlayback = this.core.activePlayback;
|
|
47600
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
|
|
47601
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
|
|
47602
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
|
|
47603
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_BITRATE, this.onBitrate);
|
|
47604
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
|
|
47605
|
-
this.listenTo(activePlayback, Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
|
|
47606
|
-
this.isHd = isHd;
|
|
47607
|
-
this.updateHd();
|
|
47608
|
-
});
|
|
47609
|
-
if (activePlayback.levels?.length > 0) {
|
|
47610
|
-
this.onLevelsAvailable(activePlayback.levels);
|
|
47611
|
-
}
|
|
47612
|
-
}
|
|
47613
|
-
updateHd() {
|
|
47614
|
-
if (this.isHd) {
|
|
47615
|
-
this.$el.find('.gear-option_hd-icon').removeClass('hidden');
|
|
47616
|
-
}
|
|
47617
|
-
else {
|
|
47618
|
-
this.$el.find('.gear-option_hd-icon').addClass('hidden');
|
|
47619
|
-
}
|
|
47620
|
-
}
|
|
47621
|
-
onStop() {
|
|
47622
|
-
trace(`${T$a} onStop`);
|
|
47623
|
-
this.listenToOnce(this.core.activePlayback, Events$1.PLAYBACK_PLAY, () => {
|
|
47624
|
-
if (this.core.activePlayback.getPlaybackType() === 'live') {
|
|
47625
|
-
if (this.selectedLevelId !== -1) {
|
|
47626
|
-
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
47627
|
-
}
|
|
47628
|
-
}
|
|
47629
|
-
});
|
|
47630
|
-
}
|
|
47631
|
-
shouldRender() {
|
|
47632
|
-
const activePlayback = this.core.activePlayback;
|
|
47633
|
-
if (!activePlayback) {
|
|
47634
|
-
return false;
|
|
47635
|
-
}
|
|
47636
|
-
const supportsCurrentLevel = 'currentLevel' in activePlayback;
|
|
47637
|
-
if (!supportsCurrentLevel) {
|
|
47638
|
-
return false;
|
|
47639
|
-
}
|
|
47640
|
-
// Only care if we have at least 2 to choose from
|
|
47641
|
-
return !!(this.levels && this.levels.length > 1);
|
|
47642
|
-
}
|
|
47643
|
-
/**
|
|
47644
|
-
* @internal
|
|
47645
|
-
*/
|
|
47646
|
-
render() {
|
|
47647
|
-
if (!this.shouldRender()) {
|
|
47648
|
-
return this;
|
|
47649
|
-
}
|
|
47650
|
-
this.renderDropdown();
|
|
47651
|
-
this.updateButton();
|
|
47652
|
-
return this;
|
|
47653
|
-
}
|
|
47654
|
-
renderDropdown() {
|
|
47655
|
-
this.$el.html(LevelSelector.listTemplate({
|
|
47656
|
-
arrowLeftIcon,
|
|
47657
|
-
checkIcon,
|
|
47658
|
-
current: this.selectedLevelId,
|
|
47659
|
-
labels: this.levelLabels,
|
|
47660
|
-
levels: this.levels,
|
|
47661
|
-
maxLevel: this.maxLevel,
|
|
47662
|
-
removeAuto: this.removeAuto,
|
|
47663
|
-
i18n: this.core.i18n,
|
|
47664
|
-
}));
|
|
47665
|
-
}
|
|
47666
|
-
updateButton() {
|
|
47667
|
-
this.core.getPlugin('bottom_gear')
|
|
47668
|
-
?.addItem('quality', this.$el)
|
|
47669
|
-
.html(LevelSelector.buttonTemplate({
|
|
47670
|
-
arrowRightIcon,
|
|
47671
|
-
currentText: this.currentText,
|
|
47672
|
-
isHd: this.isHd,
|
|
47673
|
-
hdIcon,
|
|
47674
|
-
i18n: this.core.i18n,
|
|
47675
|
-
}));
|
|
47676
|
-
}
|
|
47677
|
-
get maxLevel() {
|
|
47678
|
-
const maxRes = this.core.options.levelSelector?.restrictResolution;
|
|
47679
|
-
return maxRes
|
|
47680
|
-
? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
|
|
47681
|
-
maxRes)?.level ?? -1
|
|
47682
|
-
: -1;
|
|
47683
|
-
}
|
|
47684
|
-
onLevelsAvailable(levels) {
|
|
47685
|
-
const maxResolution = this.core.options.levelSelector?.restrictResolution;
|
|
47686
|
-
this.levels = levels;
|
|
47687
|
-
this.makeLevelsLabels();
|
|
47688
|
-
if (maxResolution) {
|
|
47689
|
-
this.removeAuto = true;
|
|
47690
|
-
const initialLevel = levels
|
|
47691
|
-
.filter((level) => (level.width > level.height ? level.height : level.width) <=
|
|
47692
|
-
maxResolution)
|
|
47693
|
-
.pop();
|
|
47694
|
-
this.setLevel(initialLevel?.level ?? 0);
|
|
47695
|
-
}
|
|
47696
|
-
this.render();
|
|
47697
|
-
}
|
|
47698
|
-
makeLevelsLabels() {
|
|
47699
|
-
const labels = this.core.options.levelSelector?.labels ?? {};
|
|
47700
|
-
this.levelLabels = [];
|
|
47701
|
-
for (const level of this.levels) {
|
|
47702
|
-
const ll = level.width > level.height ? level.height : level.width;
|
|
47703
|
-
const label = labels[ll] || `${ll}p`;
|
|
47704
|
-
this.levelLabels.push(label);
|
|
47705
|
-
}
|
|
47706
|
-
}
|
|
47707
|
-
onSelect(event) {
|
|
47708
|
-
const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
|
|
47709
|
-
this.setLevel(selectedLevel);
|
|
47710
|
-
event.stopPropagation();
|
|
47711
|
-
event.preventDefault();
|
|
47712
|
-
return false;
|
|
47713
|
-
}
|
|
47714
|
-
goBack() {
|
|
47715
|
-
trace(`${T$a} goBack`);
|
|
47716
|
-
this.core.getPlugin('bottom_gear').refresh();
|
|
47717
|
-
}
|
|
47718
|
-
setLevel(index) {
|
|
47719
|
-
this.selectedLevelId = index;
|
|
47720
|
-
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
47721
|
-
this.highlightCurrentLevel();
|
|
47722
|
-
}
|
|
47723
|
-
allLevelElements() {
|
|
47724
|
-
return this.$('#level-selector-menu li');
|
|
47725
|
-
}
|
|
47726
|
-
levelElement(id = -1) {
|
|
47727
|
-
return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
|
|
47728
|
-
}
|
|
47729
|
-
onLevelSwitchStart() {
|
|
47730
|
-
this.levelElement(this.selectedLevelId).addClass('changing');
|
|
47731
|
-
}
|
|
47732
|
-
onLevelSwitchEnd() {
|
|
47733
|
-
this.levelElement(this.selectedLevelId).removeClass('changing');
|
|
47734
|
-
}
|
|
47735
|
-
updateText(level) {
|
|
47736
|
-
this.currentText = this.getLevelLabel(level);
|
|
47737
|
-
this.updateButton();
|
|
47738
|
-
}
|
|
47739
|
-
getLevelLabel(id) {
|
|
47740
|
-
if (id < 0) {
|
|
47741
|
-
return this.core.i18n.t('auto');
|
|
47742
|
-
}
|
|
47743
|
-
const index = this.levels.findIndex((l) => l.level === id);
|
|
47744
|
-
if (index < 0) {
|
|
47745
|
-
return this.core.i18n.t('auto');
|
|
47746
|
-
}
|
|
47747
|
-
return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
|
|
47748
|
-
}
|
|
47749
|
-
onBitrate(info) {
|
|
47750
|
-
trace(`${T$a} updateCurrentLevel`, { info });
|
|
47751
|
-
this.highlightCurrentLevel();
|
|
47752
|
-
}
|
|
47753
|
-
highlightCurrentLevel() {
|
|
47754
|
-
trace(`${T$a} highlightCurrentLevel`, {
|
|
47755
|
-
selectedLevelId: this.selectedLevelId,
|
|
47756
|
-
});
|
|
47757
|
-
this.allLevelElements()
|
|
47758
|
-
.removeClass('current')
|
|
47759
|
-
.find('a')
|
|
47760
|
-
.removeClass('gcore-skin-active');
|
|
47761
|
-
const currentLevelElement = this.levelElement(this.selectedLevelId);
|
|
47762
|
-
currentLevelElement
|
|
47763
|
-
.addClass('current')
|
|
47764
|
-
.find('a')
|
|
47765
|
-
.addClass('gcore-skin-active');
|
|
47766
|
-
this.updateText(this.selectedLevelId);
|
|
47767
|
-
}
|
|
47768
|
-
}
|
|
47769
|
-
function formatLevelLabel(level) {
|
|
47770
|
-
const h = level.width > level.height ? level.height : level.width;
|
|
47771
|
-
return `${h}p`;
|
|
47772
|
-
}
|
|
47773
|
-
|
|
47774
47471
|
function calculateSize(original) {
|
|
47775
47472
|
const transformed = {
|
|
47776
47473
|
media: {
|
|
@@ -48178,7 +47875,36 @@ function keyName(keyCode) {
|
|
|
48178
47875
|
return KEY_NAMES_BY_CODE[keyCode] || '';
|
|
48179
47876
|
}
|
|
48180
47877
|
|
|
48181
|
-
const
|
|
47878
|
+
const fullscreenEnabled = Utils.Fullscreen.fullscreenEnabled;
|
|
47879
|
+
function isFullscreen(el) {
|
|
47880
|
+
const video = el.nodeName === 'video'
|
|
47881
|
+
? el
|
|
47882
|
+
: el.querySelector('video');
|
|
47883
|
+
if (!video) {
|
|
47884
|
+
return false;
|
|
47885
|
+
}
|
|
47886
|
+
if (Browser.isiOS) {
|
|
47887
|
+
return FullscreenIOS.isFullscreen(video);
|
|
47888
|
+
}
|
|
47889
|
+
return !!document.fullscreenElement;
|
|
47890
|
+
}
|
|
47891
|
+
const FullscreenIOS = {
|
|
47892
|
+
isFullscreen: function (el) {
|
|
47893
|
+
try {
|
|
47894
|
+
// @ts-ignore
|
|
47895
|
+
if (el.webkitDisplayingFullscreen !== undefined) {
|
|
47896
|
+
// @ts-ignore
|
|
47897
|
+
return !!el.webkitDisplayingFullscreen;
|
|
47898
|
+
}
|
|
47899
|
+
}
|
|
47900
|
+
catch (e) {
|
|
47901
|
+
reportError(e);
|
|
47902
|
+
}
|
|
47903
|
+
return false;
|
|
47904
|
+
},
|
|
47905
|
+
};
|
|
47906
|
+
|
|
47907
|
+
const mediaControlHTML = "<div class=\"media-control-background\" data-background></div>\n\n<div class=\"media-control-layer gcore-skin-bg-color\" data-controls>\n <% var renderBar = function(name) { %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1\" data-<%= name %>></div>\n <div class=\"bar-fill-2 gcore-skin-main-color\" data-<%= name %>></div>\n <div class=\"bar-hover\" data-<%= name %>></div>\n </div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1 gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class=\"drawer-container\" data-<%= name %>>\n <div class=\"drawer-icon-container\" data-<%= name %>>\n <div class=\"drawer-icon media-control-icon gcore-skin-button-color\" data-<%= name %>></div>\n <span class=\"drawer-text\" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class=\"media-control-indicator gcore-skin-text-color\" data-<%= name %>></div>\n <% }; %>\n <% var renderQuality = function(name) { %>\n <div class=\"media-control-quality\" data-<%= name %>></div>\n <% }; %>\n <% var renderNerd = function(name) { %>\n <div class=\"media-control-nerd\" data-<%= name %>></div>\n <% }; %>\n <% var renderMultiCamera = function(name) { %>\n <div class=\"media-control-multicamera\" data-<%= name %>></div>\n <% }; %>\n <% var renderClipsText = function(name) { %>\n <div class=\"media-clip-container gcore-skin-text-color\" data-<%= name %>>\n <div class=\"media-clip-point gcore-skin-text-color\" data-<%= name %>>•</div>\n <div class=\"media-clip-text gcore-skin-text-color\" data-<%= name %>></div>\n </div>\n <% }; %>\n <% var renderVR = function(name) { %>\n <div class=\"media-control-vr\" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type=\"button\" class=\"media-control-button media-control-icon gcore-skin-button-color\" data-<%= name %>\n aria-label=\"<%= name %>\"></button>\n <% }; %>\n\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function (settingsList) {\n settingsList.forEach(function (setting) {\n\n if (setting === \"seekbar\") {\n renderBar(setting);\n } else if (setting === \"volume\") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function (name) {\n return renderSegmentedBar(name);\n });\n } else if (setting === \"duration\" || setting === \"position\") {\n renderIndicator(setting);\n } else if (setting === \"quality\") {\n renderQuality(setting)\n } else if (setting === \"nerd\") {\n renderNerd(setting)\n } else if (setting === \"multicamera\") {\n renderMultiCamera(setting)\n } else if (setting === \"vr\") {\n renderVR(setting)\n } else if (setting === \"clipsText\") {\n renderClipsText(setting)\n } else if ([\"playpause\", \"playstop\", \"fullscreen\"].includes(setting)) {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.left && settings.left.length) { %>\n <div class=\"media-control-left-panel\" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.default && settings.default.length) { %>\n <div class=\"media-control-center-panel\" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class=\"media-control-right-panel\" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n";
|
|
48182
47908
|
|
|
48183
47909
|
const volumeMaxIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.187 7.71405C13.759 8.06405 13.697 8.69307 14.046 9.12107C14.662 9.87207 15 10.8941 15 11.9961C15 13.0991 14.662 14.1201 14.046 14.8711C13.697 15.2991 13.759 15.9291 14.187 16.2781C14.373 16.4311 14.597 16.5051 14.82 16.5051C15.109 16.5051 15.396 16.3801 15.594 16.1391C16.501 15.0301 17 13.5601 17 11.9961C17 10.4331 16.501 8.96207 15.594 7.85407C15.245 7.42707 14.614 7.36405 14.187 7.71405ZM19.772 5.14408C19.443 4.70008 18.816 4.60907 18.374 4.94007C17.931 5.27007 17.839 5.89605 18.169 6.33905C19.367 7.94705 20 9.90307 20 11.9961C20 14.0891 19.367 16.0451 18.169 17.6531C17.839 18.0971 17.931 18.7231 18.374 19.0531C18.553 19.1871 18.762 19.2511 18.97 19.2511C19.275 19.2511 19.576 19.1121 19.772 18.8491C21.23 16.8921 22 14.5231 22 11.9961C22 9.47007 21.23 7.10108 19.772 5.14408ZM12 3.85108V20.1421C12 20.4881 11.793 20.7971 11.473 20.9291C11.368 20.9721 11.258 20.9921 11.149 20.9921C10.926 20.9921 10.708 20.9031 10.544 20.7371L6.317 16.4431C6.038 16.1591 5.648 15.9961 5.249 15.9961H3.5C2.673 15.9961 2 15.3231 2 14.4961V9.49607C2 8.66907 2.673 7.99607 3.5 7.99607H5.249C5.648 7.99607 6.038 7.83308 6.317 7.54908L10.544 3.25507C10.787 3.00807 11.151 2.93206 11.473 3.06406C11.793 3.19506 12 3.50408 12 3.85108Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
48184
47910
|
|
|
@@ -48192,21 +47918,24 @@ const fullscreenOnIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"
|
|
|
48192
47918
|
// Use of this source code is governed by a BSD-style
|
|
48193
47919
|
// license that can be found in the {@link https://github.com/clappr/clappr-plugins/blob/master/LICENSE | LICENSE}.
|
|
48194
47920
|
const DEFAULT_SETTINGS = {
|
|
48195
|
-
left: [],
|
|
48196
47921
|
right: [
|
|
47922
|
+
'audiotracks',
|
|
47923
|
+
'cc',
|
|
47924
|
+
// 'dvr',
|
|
47925
|
+
// 'duration',
|
|
48197
47926
|
'fullscreen',
|
|
48198
|
-
'pip',
|
|
48199
47927
|
'gear',
|
|
48200
|
-
'cc',
|
|
48201
47928
|
'multicamera',
|
|
48202
|
-
|
|
47929
|
+
'pip',
|
|
48203
47930
|
'vr',
|
|
48204
|
-
|
|
48205
|
-
|
|
47931
|
+
]};
|
|
47932
|
+
const INITIAL_SETTINGS = {
|
|
47933
|
+
left: [],
|
|
47934
|
+
right: [],
|
|
48206
47935
|
default: [],
|
|
48207
|
-
seekEnabled:
|
|
47936
|
+
seekEnabled: false,
|
|
48208
47937
|
};
|
|
48209
|
-
const T$
|
|
47938
|
+
const T$a = 'plugins.media_control';
|
|
48210
47939
|
const LEFT_ORDER = [
|
|
48211
47940
|
'playpause',
|
|
48212
47941
|
'playstop',
|
|
@@ -48227,11 +47956,17 @@ function orderByOrderPattern(arr, order) {
|
|
|
48227
47956
|
* @beta
|
|
48228
47957
|
* @remarks
|
|
48229
47958
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
47959
|
+
*
|
|
47960
|
+
* Configuration options:
|
|
47961
|
+
*
|
|
47962
|
+
* - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
|
|
47963
|
+
*
|
|
47964
|
+
* - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
|
|
47965
|
+
*
|
|
47966
|
+
* - `chromeless`: boolean
|
|
48230
47967
|
*/
|
|
48231
47968
|
class MediaControl extends UICorePlugin {
|
|
48232
47969
|
// private advertisementPlaying = false
|
|
48233
|
-
customAreaElements = {};
|
|
48234
|
-
customAreaHandler;
|
|
48235
47970
|
buttonsColor = null;
|
|
48236
47971
|
currentDurationValue = 0;
|
|
48237
47972
|
currentPositionValue = 0;
|
|
@@ -48242,7 +47977,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48242
47977
|
displayedSeekBarPercentage = null;
|
|
48243
47978
|
draggingSeekBar = false;
|
|
48244
47979
|
draggingVolumeBar = false;
|
|
48245
|
-
fullScreenOnVideoTagSupported =
|
|
47980
|
+
fullScreenOnVideoTagSupported = false;
|
|
48246
47981
|
hideId = null;
|
|
48247
47982
|
hideVolumeId = null;
|
|
48248
47983
|
intendedVolume = 100;
|
|
@@ -48250,9 +47985,10 @@ class MediaControl extends UICorePlugin {
|
|
|
48250
47985
|
kibo;
|
|
48251
47986
|
lastMouseX = 0;
|
|
48252
47987
|
lastMouseY = 0;
|
|
47988
|
+
needsUpdate = false;
|
|
48253
47989
|
persistConfig;
|
|
48254
47990
|
rendered = false;
|
|
48255
|
-
settings =
|
|
47991
|
+
settings = INITIAL_SETTINGS;
|
|
48256
47992
|
userDisabled = false;
|
|
48257
47993
|
userKeepVisible = false;
|
|
48258
47994
|
verticalVolume = false;
|
|
@@ -48263,7 +47999,6 @@ class MediaControl extends UICorePlugin {
|
|
|
48263
47999
|
$multiCameraSelector = null;
|
|
48264
48000
|
$playPauseToggle = null;
|
|
48265
48001
|
$playStopToggle = null;
|
|
48266
|
-
$playbackRate = null;
|
|
48267
48002
|
$position = null;
|
|
48268
48003
|
$seekBarContainer = null;
|
|
48269
48004
|
$seekBarHover = null;
|
|
@@ -48444,7 +48179,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48444
48179
|
* Hides the media control UI
|
|
48445
48180
|
*/
|
|
48446
48181
|
disable() {
|
|
48447
|
-
trace(`${T$
|
|
48182
|
+
trace(`${T$a} disable`);
|
|
48448
48183
|
this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
|
|
48449
48184
|
this.hide();
|
|
48450
48185
|
this.unbindKeyEvents();
|
|
@@ -48454,7 +48189,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48454
48189
|
* Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
|
|
48455
48190
|
*/
|
|
48456
48191
|
enable() {
|
|
48457
|
-
trace(`${T$
|
|
48192
|
+
trace(`${T$a} enable`);
|
|
48458
48193
|
if (this.options.chromeless) {
|
|
48459
48194
|
return;
|
|
48460
48195
|
}
|
|
@@ -48477,7 +48212,8 @@ class MediaControl extends UICorePlugin {
|
|
|
48477
48212
|
const video = this.core.activePlayback?.el;
|
|
48478
48213
|
// video.webkitSupportsFullscreen is deprecated but iOS appears to only use this
|
|
48479
48214
|
// see https://github.com/clappr/clappr/issues/1127
|
|
48480
|
-
if (!
|
|
48215
|
+
if (!fullscreenEnabled() && video.webkitSupportsFullscreen) {
|
|
48216
|
+
// TODO sort out, use single utility function
|
|
48481
48217
|
this.fullScreenOnVideoTagSupported = true;
|
|
48482
48218
|
}
|
|
48483
48219
|
this.updateSettings();
|
|
@@ -48709,22 +48445,21 @@ class MediaControl extends UICorePlugin {
|
|
|
48709
48445
|
}
|
|
48710
48446
|
}
|
|
48711
48447
|
onActiveContainerChanged() {
|
|
48712
|
-
this.fullScreenOnVideoTagSupported =
|
|
48448
|
+
this.fullScreenOnVideoTagSupported = false;
|
|
48713
48449
|
// set the new container to match the volume of the last one
|
|
48714
48450
|
this.setInitialVolume();
|
|
48715
48451
|
this.changeTogglePlay();
|
|
48716
48452
|
this.bindContainerEvents();
|
|
48453
|
+
// TODO remove?
|
|
48717
48454
|
this.updateSettings();
|
|
48718
|
-
// TODO
|
|
48719
|
-
this.core.activeContainer.trigger(Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.core.activeContainer.isDvrInUse());
|
|
48720
|
-
// TODO test
|
|
48455
|
+
// TODO test, figure out if this is needed
|
|
48721
48456
|
if (this.core.activeContainer.mediaControlDisabled) {
|
|
48722
48457
|
this.disable();
|
|
48723
48458
|
}
|
|
48724
48459
|
else {
|
|
48725
48460
|
this.enable();
|
|
48726
48461
|
}
|
|
48727
|
-
this.trigger(Events$1.MEDIACONTROL_CONTAINERCHANGED); // TODO
|
|
48462
|
+
this.trigger(Events$1.MEDIACONTROL_CONTAINERCHANGED); // TODO figure out
|
|
48728
48463
|
if (this.core.activeContainer.$el) {
|
|
48729
48464
|
this.core.activeContainer.$el.addClass('container-skin-1');
|
|
48730
48465
|
}
|
|
@@ -48895,11 +48630,13 @@ class MediaControl extends UICorePlugin {
|
|
|
48895
48630
|
}
|
|
48896
48631
|
}
|
|
48897
48632
|
updateSettings() {
|
|
48633
|
+
trace(`${T$a} updateSettings`, { settings: this.settings });
|
|
48898
48634
|
const newSettings = $.extend(true, {
|
|
48899
48635
|
left: [],
|
|
48900
48636
|
default: [],
|
|
48901
48637
|
right: [],
|
|
48902
48638
|
}, this.core.activeContainer.settings);
|
|
48639
|
+
trace(`${T$a} updateSettings`, { newSettings });
|
|
48903
48640
|
// TODO make order controlled via CSS
|
|
48904
48641
|
newSettings.left = orderByOrderPattern([...newSettings.left, 'clipsText', 'volume'], LEFT_ORDER);
|
|
48905
48642
|
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
@@ -48907,10 +48644,15 @@ class MediaControl extends UICorePlugin {
|
|
|
48907
48644
|
newSettings.left.push('dvr');
|
|
48908
48645
|
}
|
|
48909
48646
|
// actual order of the items appear rendered is controlled by CSS
|
|
48910
|
-
newSettings.right = DEFAULT_SETTINGS.right;
|
|
48647
|
+
newSettings.right = DEFAULT_SETTINGS.right; // TODO get from the options
|
|
48911
48648
|
if ((!this.fullScreenOnVideoTagSupported &&
|
|
48912
|
-
!
|
|
48649
|
+
!fullscreenEnabled()) ||
|
|
48913
48650
|
this.options.fullscreenDisable) {
|
|
48651
|
+
trace(`${T$a} updateSettings removing fullscreen`, {
|
|
48652
|
+
supported: this.fullScreenOnVideoTagSupported,
|
|
48653
|
+
enabled: Fullscreen.fullscreenEnabled(),
|
|
48654
|
+
optionsDisable: this.options.fullscreenDisable,
|
|
48655
|
+
});
|
|
48914
48656
|
// remove fullscreen from settings if it is not available
|
|
48915
48657
|
removeArrayItem(newSettings.default, 'fullscreen');
|
|
48916
48658
|
removeArrayItem(newSettings.left, 'fullscreen');
|
|
@@ -48925,6 +48667,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48925
48667
|
const settingsChanged = serializeSettings(this.settings) !== serializeSettings(newSettings);
|
|
48926
48668
|
if (settingsChanged) {
|
|
48927
48669
|
this.settings = newSettings;
|
|
48670
|
+
this.needsUpdate = true;
|
|
48928
48671
|
this.render();
|
|
48929
48672
|
}
|
|
48930
48673
|
}
|
|
@@ -48949,7 +48692,6 @@ class MediaControl extends UICorePlugin {
|
|
|
48949
48692
|
this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]');
|
|
48950
48693
|
this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]');
|
|
48951
48694
|
this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]');
|
|
48952
|
-
this.$playbackRate = this.$el.find('.media-control-playbackrate[data-playbackrate]');
|
|
48953
48695
|
this.$multiCameraSelector = this.$el.find('.media-control-multicamera[data-multicamera]');
|
|
48954
48696
|
this.$clipText = this.$el.find('.media-clip-text[data-clipstext]'); // TODO
|
|
48955
48697
|
this.$clipTextContainer = this.$el.find('.media-clip-container[data-clipstext]');
|
|
@@ -48981,15 +48723,13 @@ class MediaControl extends UICorePlugin {
|
|
|
48981
48723
|
return null;
|
|
48982
48724
|
case 'clipText':
|
|
48983
48725
|
return this.$clipText;
|
|
48984
|
-
case 'playbackRate':
|
|
48985
|
-
return this.$playbackRate;
|
|
48986
48726
|
case 'seekBarContainer':
|
|
48987
48727
|
return this.$seekBarContainer;
|
|
48988
48728
|
}
|
|
48989
48729
|
}
|
|
48990
48730
|
putElement(name, element) {
|
|
48991
48731
|
const panel = this.getElementLocation(name);
|
|
48992
|
-
trace(`${T$
|
|
48732
|
+
trace(`${T$a} putElement`, { name, panel: !!panel });
|
|
48993
48733
|
if (panel) {
|
|
48994
48734
|
const current = panel.find(`[data-${name}]`);
|
|
48995
48735
|
element.attr(`data-${name}`, '');
|
|
@@ -49006,13 +48746,6 @@ class MediaControl extends UICorePlugin {
|
|
|
49006
48746
|
return;
|
|
49007
48747
|
}
|
|
49008
48748
|
}
|
|
49009
|
-
handleCustomArea(handler) {
|
|
49010
|
-
this.customAreaHandler = handler;
|
|
49011
|
-
Object.entries(this.customAreaElements).forEach(([name, element]) => {
|
|
49012
|
-
handler(name, element);
|
|
49013
|
-
});
|
|
49014
|
-
this.customAreaElements = {};
|
|
49015
|
-
}
|
|
49016
48749
|
/**
|
|
49017
48750
|
* Toggle the visibility of a media control element
|
|
49018
48751
|
* @param name - The name of the media control element
|
|
@@ -49110,8 +48843,8 @@ class MediaControl extends UICorePlugin {
|
|
|
49110
48843
|
keys.forEach((i) => {
|
|
49111
48844
|
this.bindKeyAndShow(i, () => {
|
|
49112
48845
|
this.settings.seekEnabled &&
|
|
49113
|
-
this.
|
|
49114
|
-
this.
|
|
48846
|
+
this.core.activeContainer &&
|
|
48847
|
+
this.core.activeContainer.seekPercentage(Number(i) * 10);
|
|
49115
48848
|
return false;
|
|
49116
48849
|
});
|
|
49117
48850
|
});
|
|
@@ -49177,10 +48910,12 @@ class MediaControl extends UICorePlugin {
|
|
|
49177
48910
|
* @internal
|
|
49178
48911
|
*/
|
|
49179
48912
|
render() {
|
|
49180
|
-
trace(`${T$
|
|
48913
|
+
trace(`${T$a} render`, { needsUpdate: this.needsUpdate });
|
|
48914
|
+
if (!this.needsUpdate) {
|
|
48915
|
+
return this;
|
|
48916
|
+
}
|
|
49181
48917
|
const timeout = this.options.hideMediaControlDelay || 2000;
|
|
49182
|
-
|
|
49183
|
-
this.$el.html(html);
|
|
48918
|
+
this.$el.html(MediaControl.template({ settings: this.settings }));
|
|
49184
48919
|
// const style = Styler.getStyleFor(mediaControlStyle, { baseUrl: this.options.baseUrl });
|
|
49185
48920
|
// this.$el.append(style[0]);
|
|
49186
48921
|
this.createCachedElements();
|
|
@@ -49226,7 +48961,8 @@ class MediaControl extends UICorePlugin {
|
|
|
49226
48961
|
this.core.$el.append(this.el);
|
|
49227
48962
|
this.rendered = true;
|
|
49228
48963
|
this.updateVolumeUI();
|
|
49229
|
-
|
|
48964
|
+
this.needsUpdate = false;
|
|
48965
|
+
// TODO setTimeout?
|
|
49230
48966
|
this.trigger(Events$1.MEDIACONTROL_RENDERED);
|
|
49231
48967
|
return this;
|
|
49232
48968
|
}
|
|
@@ -49292,6 +49028,7 @@ class MediaControl extends UICorePlugin {
|
|
|
49292
49028
|
element.el.css({ 'pointer-events': 'none' });
|
|
49293
49029
|
});
|
|
49294
49030
|
}
|
|
49031
|
+
// TODO drop
|
|
49295
49032
|
isSeekEnabledForHtml5Playback() {
|
|
49296
49033
|
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
49297
49034
|
return this.options.dvrEnabled;
|
|
@@ -49299,7 +49036,7 @@ class MediaControl extends UICorePlugin {
|
|
|
49299
49036
|
return isFinite(this.core.activePlayback.getDuration());
|
|
49300
49037
|
}
|
|
49301
49038
|
getElementLocation(name) {
|
|
49302
|
-
trace(`${T$
|
|
49039
|
+
trace(`${T$a} getElementLocation`, {
|
|
49303
49040
|
name,
|
|
49304
49041
|
right: this.settings.right,
|
|
49305
49042
|
left: this.settings.left,
|
|
@@ -49346,8 +49083,8 @@ const streamsMomentoIcon = "<svg id=\"Слой_1\" data-name=\"Слой 1\" xmln
|
|
|
49346
49083
|
|
|
49347
49084
|
const streamsWhiteNightsIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"50\" height=\"50\" viewBox=\"0 0 50 50\">\n <defs>\n <clipPath id=\"clip-Icon\">\n <rect width=\"50\" height=\"50\"/>\n </clipPath>\n </defs>\n <g id=\"Icon\" clip-path=\"url(#clip-Icon)\">\n <g id=\"icon2\" transform=\"translate(-0.041 0)\">\n <path id=\"Контур_77\" data-name=\"Контур 77\" d=\"M6.493,13v8.266h6.275V19.74H8.31V17.714h4.006V16.3H8.31V14.53h4.365V13Zm7.5,0v8.266h1.7V15.732h.023l3.438,5.534h1.818V13h-1.7v5.545h-.023L15.8,13Z\" fill=\"#fff\"/>\n <path id=\"Контур_76\" data-name=\"Контур 76\" d=\"M29.949,29.1V26.774H31.94a1.4,1.4,0,0,1,.938.272,1.1,1.1,0,0,1,.313.874,1.155,1.155,0,0,1-.313.9,1.375,1.375,0,0,1-.938.278ZM28.132,25.36v8.266h1.817V30.4h1.818a1.353,1.353,0,0,1,.984.3,1.637,1.637,0,0,1,.394.949c.046.333.079.681.1,1.042a3.2,3.2,0,0,0,.185.938h1.819a1.218,1.218,0,0,1-.191-.423,3.611,3.611,0,0,1-.093-.527c-.019-.185-.033-.367-.041-.544s-.016-.332-.023-.463a5.052,5.052,0,0,0-.087-.625,2.109,2.109,0,0,0-.2-.573,1.586,1.586,0,0,0-.359-.451,1.414,1.414,0,0,0-.556-.284v-.023a1.926,1.926,0,0,0,1-.81,2.494,2.494,0,0,0,.307-1.262,2.308,2.308,0,0,0-.165-.88,2.128,2.128,0,0,0-.486-.724,2.3,2.3,0,0,0-.764-.492,2.67,2.67,0,0,0-1-.179ZM43.506,30.5V25.36H41.689V30.5a2.065,2.065,0,0,1-.37,1.36,1.7,1.7,0,0,1-1.343.434,2.086,2.086,0,0,1-.886-.156,1.283,1.283,0,0,1-.758-.978,3.748,3.748,0,0,1-.058-.66V25.36H36.456V30.5a3.16,3.16,0,0,0,.92,2.5,3.807,3.807,0,0,0,2.6.81,3.82,3.82,0,0,0,2.593-.816,3.132,3.132,0,0,0,.937-2.492Z\" fill=\"#fff\"/>\n <path id=\"Контур_80\" data-name=\"Контур 80\" d=\"M22.646,31.2H4.689a4.505,4.505,0,0,1-4.5-4.5V8.5A4.505,4.505,0,0,1,4.689,4h18.2a4.505,4.505,0,0,1,4.5,4.5v8.445l-.893.1a3.184,3.184,0,0,0-2.846,3.177V30.5l-.465.7ZM4.689,6a2.5,2.5,0,0,0-2.5,2.5V26.7a2.5,2.5,0,0,0,2.5,2.5H21.65V20.22a5.18,5.18,0,0,1,3.739-4.992V8.5a2.5,2.5,0,0,0-2.5-2.5Z\" fill=\"#fff\"/>\n <path id=\"Контур_81\" data-name=\"Контур 81\" d=\"M30.127,47.884a1,1,0,0,1-1-1V43.267H26.846a5.206,5.206,0,0,1-5.2-5.2V20.222a5.206,5.206,0,0,1,5.2-5.2H44.692a5.206,5.206,0,0,1,5.2,5.2V38.068a5.206,5.206,0,0,1-5.2,5.2H35.058l-4.216,4.316A1,1,0,0,1,30.127,47.884ZM26.846,17.022a3.2,3.2,0,0,0-3.2,3.2V38.067a3.2,3.2,0,0,0,3.2,3.2h3.281a1,1,0,0,1,1,1v2.162l2.8-2.86a1,1,0,0,1,.715-.3H44.692a3.2,3.2,0,0,0,3.2-3.2V20.222a3.2,3.2,0,0,0-3.2-3.2Z\" fill=\"#fff\"/>\n </g>\n </g>\n</svg>\n";
|
|
49348
49085
|
|
|
49349
|
-
const VERSION$
|
|
49350
|
-
const T$
|
|
49086
|
+
const VERSION$4 = '0.0.1';
|
|
49087
|
+
const T$9 = 'plugins.multicamera';
|
|
49351
49088
|
/**
|
|
49352
49089
|
* `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
|
|
49353
49090
|
* @beta
|
|
@@ -49365,7 +49102,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49365
49102
|
return { min: CLAPPR_VERSION };
|
|
49366
49103
|
}
|
|
49367
49104
|
static get version() {
|
|
49368
|
-
return VERSION$
|
|
49105
|
+
return VERSION$4;
|
|
49369
49106
|
}
|
|
49370
49107
|
get template() {
|
|
49371
49108
|
return tmpl(pluginHtml$3);
|
|
@@ -49493,7 +49230,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49493
49230
|
}
|
|
49494
49231
|
onCameraSelect(event) {
|
|
49495
49232
|
const value = event.currentTarget.dataset.multicameraSelectorSelect;
|
|
49496
|
-
trace(`${T$
|
|
49233
|
+
trace(`${T$9} onCameraSelect`, { value });
|
|
49497
49234
|
if (value !== undefined) {
|
|
49498
49235
|
this.changeById(parseInt(value, 10));
|
|
49499
49236
|
}
|
|
@@ -49619,13 +49356,13 @@ class MultiCamera extends UICorePlugin {
|
|
|
49619
49356
|
}
|
|
49620
49357
|
}
|
|
49621
49358
|
changeById(id) {
|
|
49622
|
-
trace(`${T$
|
|
49359
|
+
trace(`${T$9} changeById`, { id });
|
|
49623
49360
|
queueMicrotask(() => {
|
|
49624
49361
|
const playbackOptions = this.core.options.playback || {};
|
|
49625
49362
|
// TODO figure out what this does
|
|
49626
49363
|
playbackOptions.recycleVideo = Browser.isMobile;
|
|
49627
49364
|
this.currentCamera = this.findElementById(id) ?? null;
|
|
49628
|
-
trace(`${T$
|
|
49365
|
+
trace(`${T$9} changeById`, { id, currentCamera: this.currentCamera, multicamera: this.multicamera });
|
|
49629
49366
|
if (!this.currentCamera) {
|
|
49630
49367
|
return;
|
|
49631
49368
|
}
|
|
@@ -49642,7 +49379,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49642
49379
|
// TODO remove?
|
|
49643
49380
|
// for html5 playback:
|
|
49644
49381
|
this.options.dvrEnabled = this.currentCamera.dvr;
|
|
49645
|
-
trace(`${T$
|
|
49382
|
+
trace(`${T$9} changeById`, { currentCamera: this.currentCamera });
|
|
49646
49383
|
// TODO
|
|
49647
49384
|
this.core.configure({
|
|
49648
49385
|
playback: playbackOptions,
|
|
@@ -49697,10 +49434,10 @@ class MultiCamera extends UICorePlugin {
|
|
|
49697
49434
|
|
|
49698
49435
|
const pipIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M21.05 3.00001C21.302 3.00001 21.5435 3.10003 21.7217 3.27833C21.9 3.45646 22 3.69802 22 3.95003V10.6H20.1V4.90003H4.90001V18.2H10.6V20.1H3.95001C3.69802 20.1 3.45647 20 3.27832 19.8217C3.10002 19.6436 3 19.402 3 19.15V3.95001C3 3.69802 3.10002 3.45647 3.27832 3.27832C3.45644 3.10002 3.69801 3 3.95001 3L21.05 3.00001ZM21.05 12.5C21.302 12.5 21.5435 12.6 21.7217 12.7783C21.9 12.9565 22 13.198 22 13.45V19.15C22 19.402 21.9 19.6436 21.7217 19.8217C21.5436 20 21.302 20.1 21.05 20.1H13.45C13.198 20.1 12.9564 20 12.7783 19.8217C12.6 19.6436 12.5 19.402 12.5 19.15V13.45C12.5 13.198 12.6 12.9565 12.7783 12.7783C12.9564 12.6 13.198 12.5 13.45 12.5H21.05ZM7.47178 6.12823L9.60928 8.26572L11.5501 6.32492V11.5499H6.32509L8.26589 9.60911L6.12839 7.47161L7.47178 6.12823Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
49699
49436
|
|
|
49700
|
-
const buttonHtml$
|
|
49437
|
+
const buttonHtml$2 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
|
|
49701
49438
|
|
|
49702
|
-
const VERSION$
|
|
49703
|
-
const T$
|
|
49439
|
+
const VERSION$3 = '0.0.1';
|
|
49440
|
+
const T$8 = `plugins.pip`;
|
|
49704
49441
|
/**
|
|
49705
49442
|
* `PLUGIN` that enables picture in picture mode.
|
|
49706
49443
|
* @beta
|
|
@@ -49728,9 +49465,9 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49728
49465
|
* @internal
|
|
49729
49466
|
*/
|
|
49730
49467
|
static get version() {
|
|
49731
|
-
return VERSION$
|
|
49468
|
+
return VERSION$3;
|
|
49732
49469
|
}
|
|
49733
|
-
static buttonTemplate = tmpl(buttonHtml$
|
|
49470
|
+
static buttonTemplate = tmpl(buttonHtml$2);
|
|
49734
49471
|
/**
|
|
49735
49472
|
* @internal
|
|
49736
49473
|
*/
|
|
@@ -49758,7 +49495,7 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49758
49495
|
});
|
|
49759
49496
|
}
|
|
49760
49497
|
isPiPSupported() {
|
|
49761
|
-
trace(`${T$
|
|
49498
|
+
trace(`${T$8} isPiPSupported`, {
|
|
49762
49499
|
pictureInPictureEnabled: !!document.pictureInPictureEnabled,
|
|
49763
49500
|
requestPictureInPicture: !!HTMLVideoElement.prototype.requestPictureInPicture,
|
|
49764
49501
|
});
|
|
@@ -49779,7 +49516,7 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49779
49516
|
return this;
|
|
49780
49517
|
}
|
|
49781
49518
|
togglePictureInPicture() {
|
|
49782
|
-
trace(`${T$
|
|
49519
|
+
trace(`${T$8} togglePictureInPicture`);
|
|
49783
49520
|
if (this.videoElement !== document.pictureInPictureElement) {
|
|
49784
49521
|
this.requestPictureInPicture();
|
|
49785
49522
|
}
|
|
@@ -49788,23 +49525,29 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49788
49525
|
}
|
|
49789
49526
|
}
|
|
49790
49527
|
requestPictureInPicture() {
|
|
49791
|
-
trace(`${T$
|
|
49528
|
+
trace(`${T$8} requestPictureInPicture`, {
|
|
49792
49529
|
videoElement: !!this.videoElement,
|
|
49793
49530
|
});
|
|
49794
49531
|
this.videoElement.requestPictureInPicture();
|
|
49795
49532
|
}
|
|
49796
49533
|
exitPictureInPicture() {
|
|
49797
|
-
trace(`${T$
|
|
49534
|
+
trace(`${T$8} exitPictureInPicture`);
|
|
49798
49535
|
document.exitPictureInPicture();
|
|
49799
49536
|
}
|
|
49800
49537
|
}
|
|
49801
49538
|
|
|
49802
|
-
const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' id=\"playback-rate-button\">\n <span class=\"gear-option_speed-icon\"><%= speedIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('playback_rate') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= title %></span>\n</button>\n";
|
|
49539
|
+
const buttonHtml$1 = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' id=\"playback-rate-button\">\n <span class=\"gear-option_speed-icon\"><%= speedIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('playback_rate') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= title %></span>\n</button>\n";
|
|
49803
49540
|
|
|
49804
|
-
const listHtml = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"playback-rate-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('playback_rate') %>\n</button>\n<ul class=\"gear-sub-menu\" id=\"playback-rate-menu\">\n <% for (const item of playbackRates) { %>\n <li<%= item.value === current ? ' class=\"current\"' : '' %>>\n <a href=\"#\" class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.value === current ? ' gcore-skin-active' : '' %>\" data-rate=\"<%= item.value %>\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= item.label %>\n </a>\n </li>\n <% } %>\n</ul>";
|
|
49541
|
+
const listHtml$1 = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"playback-rate-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('playback_rate') %>\n</button>\n<ul class=\"gear-sub-menu\" id=\"playback-rate-menu\">\n <% for (const item of playbackRates) { %>\n <li<%= item.value === current ? ' class=\"current\"' : '' %>>\n <a href=\"#\" class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.value === current ? ' gcore-skin-active' : '' %>\" data-rate=\"<%= item.value %>\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= item.label %>\n </a>\n </li>\n <% } %>\n</ul>";
|
|
49805
49542
|
|
|
49806
49543
|
const speedIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.9854 23.9999C11.4272 23.9999 10.9571 23.5293 10.9571 22.9704C10.9571 22.4115 11.4272 21.9409 11.9854 21.9409C17.4492 21.9409 21.9143 17.4704 21.9143 11.9999C21.9143 6.52948 17.4492 2.05899 11.9854 2.05899C11.4272 2.05899 10.9571 1.58836 10.9571 1.02949C10.9571 0.470625 11.4272 0 11.9854 0C18.5949 0 24 5.38224 24 12.0291C24 18.6766 18.5949 24 11.9854 24V23.9999ZM10.2227 17.853L17.4785 13.4413C18.0072 13.1178 18.301 12.5885 18.301 11.9707C18.301 11.353 17.9779 10.8237 17.4785 10.5002L10.2227 6.08852C9.69405 5.76499 9.01826 5.76499 8.4896 6.05919C7.96094 6.35338 7.60828 6.94157 7.60828 7.5591V16.3824C7.60828 17.0002 7.93142 17.5883 8.4896 17.8824C8.75393 18.0294 9.04779 18.1177 9.34139 18.1177C9.63523 18.1177 9.95838 18.0294 10.2227 17.853V17.853ZM15.9216 11.9707L9.66457 15.7647V8.17661L15.9216 11.9707ZM8.22516 22.3529C8.4602 21.8236 8.25447 21.2058 7.7258 20.9705C7.19714 20.7353 6.69755 20.4413 6.2277 20.0882C5.75764 19.7646 5.11137 19.8822 4.78824 20.3235C4.46509 20.7941 4.58251 21.4412 5.02327 21.7647C5.58146 22.1764 6.19819 22.5293 6.81519 22.8235C6.96211 22.8824 7.10903 22.9117 7.25574 22.9117C7.66699 22.941 8.04893 22.7057 8.22513 22.3528L8.22516 22.3529ZM3.58381 19.0882C4.05387 18.7647 4.17127 18.1177 3.84814 17.647C3.52502 17.1764 3.23115 16.6765 2.99635 16.1471C2.76132 15.6178 2.14456 15.4118 1.6157 15.6472C1.08704 15.8825 0.881306 16.5 1.11634 17.0295C1.41018 17.6472 1.7626 18.2648 2.14459 18.8236C2.35032 19.1178 2.67325 19.2646 2.99638 19.2646C3.20191 19.2942 3.40763 19.2353 3.58384 19.0882L3.58381 19.0882ZM1.14563 13.9707C1.70382 13.9118 2.14435 13.4118 2.08576 12.853C2.05645 12.5588 2.05645 12.2648 2.05645 11.9706C2.05645 11.6764 2.05645 11.4117 2.08576 11.1178C2.14456 10.5589 1.70381 10.059 1.14563 10.0001C0.587439 9.94122 0.0881057 10.3825 0.0293019 10.9414C1.96979e-07 11.2942 0 11.6178 0 11.9709C0 12.3237 0.0293018 12.6768 0.0588091 13.0297C0.117618 13.5589 0.558169 13.9709 1.08706 13.9709C1.08686 13.9707 1.11636 13.9707 1.14567 13.9707L1.14563 13.9707ZM2.96687 7.79432C3.2019 7.26502 3.49553 6.76482 3.81866 6.2944C4.1418 5.82377 4.02439 5.17672 3.55432 4.8532C3.08427 4.52967 2.438 4.64722 2.11486 5.11786C1.73292 5.67672 1.38047 6.2942 1.08661 6.91193C0.851579 7.44123 1.08661 8.05897 1.58597 8.29426C1.73289 8.35314 1.87981 8.38247 2.02652 8.38247C2.40888 8.41181 2.7906 8.1767 2.96686 7.7943L2.96687 7.79432ZM6.22757 3.85328C6.69762 3.52974 7.19696 3.23554 7.69635 2.97089C8.22501 2.73558 8.43074 2.11807 8.19571 1.58857C7.96068 1.05927 7.34392 0.85329 6.81505 1.08861C6.19806 1.3828 5.58128 1.73565 5.02314 2.14741C4.55308 2.47094 4.43568 3.11797 4.78811 3.5886C4.99384 3.8828 5.31676 4.02969 5.6399 4.02969C5.84583 4.05902 6.05135 4.00014 6.22757 3.85325V3.85328Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
49807
49544
|
|
|
49545
|
+
const arrowRightIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M8.70725 20.7073C8.51225 20.9023 8.25625 21.0002 8.00025 21.0002C7.74425 21.0002 7.48825 20.9023 7.29325 20.7073C6.90225 20.3162 6.90225 19.6842 7.29325 19.2932L14.5863 12.0002L7.29325 4.70725C6.90225 4.31625 6.90225 3.68425 7.29325 3.29325C7.68425 2.90225 8.31625 2.90225 8.70725 3.29325L16.7073 11.2933C17.0983 11.6842 17.0983 12.3162 16.7073 12.7072L8.70725 20.7073Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
49546
|
+
|
|
49547
|
+
const arrowLeftIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M16.7073 19.2932C17.0983 19.6842 17.0983 20.3162 16.7073 20.7073C16.5123 20.9023 16.2563 21.0002 16.0003 21.0002C15.7443 21.0002 15.4882 20.9023 15.2933 20.7073L7.29325 12.7072C6.90225 12.3162 6.90225 11.6842 7.29325 11.2933L15.2933 3.29325C15.6842 2.90225 16.3163 2.90225 16.7073 3.29325C17.0983 3.68425 17.0983 4.31625 16.7073 4.70725L9.41425 12.0002L16.7073 19.2932Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
49548
|
+
|
|
49549
|
+
const checkIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M20.5793 4.19296C20.1216 3.86696 19.4777 3.96396 19.1424 4.40896L9.37295 17.3809L4.81634 12.107C4.45222 11.683 3.80218 11.6289 3.36709 11.9839C2.932 12.3389 2.87543 12.97 3.2416 13.393L8.64165 19.643C8.83708 19.869 9.12506 20 9.42849 20C9.4398 20 9.45114 20 9.46246 19.999C9.77926 19.989 10.0724 19.838 10.2586 19.59L20.8015 5.58996C21.1368 5.14496 21.0371 4.51896 20.5793 4.19296Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
49550
|
+
|
|
49808
49551
|
const DEFAULT_PLAYBACK_RATES = [
|
|
49809
49552
|
{ value: 0.5, label: '0.5x' },
|
|
49810
49553
|
{ value: 0.75, label: '0.75x' },
|
|
@@ -49815,7 +49558,7 @@ const DEFAULT_PLAYBACK_RATES = [
|
|
|
49815
49558
|
{ value: 2.0, label: '2x' },
|
|
49816
49559
|
];
|
|
49817
49560
|
const DEFAULT_PLAYBACK_RATE = 1;
|
|
49818
|
-
const T$
|
|
49561
|
+
const T$7 = 'plugins.playback_rate';
|
|
49819
49562
|
/**
|
|
49820
49563
|
* `PLUGIN` that allows changing the playback speed of the video.
|
|
49821
49564
|
* @beta
|
|
@@ -49843,12 +49586,11 @@ const T$6 = 'plugins.playback_rate';
|
|
|
49843
49586
|
* { value: 1, label: '1x' },
|
|
49844
49587
|
* ],
|
|
49845
49588
|
* defaultValue: 1,
|
|
49846
|
-
* }
|
|
49589
|
+
* },
|
|
49847
49590
|
* })
|
|
49848
49591
|
* ```
|
|
49849
49592
|
*/
|
|
49850
49593
|
class PlaybackRate extends UICorePlugin {
|
|
49851
|
-
playbackRates = DEFAULT_PLAYBACK_RATES;
|
|
49852
49594
|
// Saved when an ad starts to restore after it finishes
|
|
49853
49595
|
// private prevSelectedRate: string | undefined
|
|
49854
49596
|
selectedRate = DEFAULT_PLAYBACK_RATE;
|
|
@@ -49864,14 +49606,16 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49864
49606
|
get supportedVersion() {
|
|
49865
49607
|
return { min: CLAPPR_VERSION };
|
|
49866
49608
|
}
|
|
49867
|
-
static buttonTemplate = tmpl(buttonHtml);
|
|
49868
|
-
static listTemplate = tmpl(listHtml);
|
|
49609
|
+
static buttonTemplate = tmpl(buttonHtml$1);
|
|
49610
|
+
static listTemplate = tmpl(listHtml$1);
|
|
49869
49611
|
constructor(core) {
|
|
49870
49612
|
super(core);
|
|
49871
|
-
this.
|
|
49872
|
-
core.options.playbackRate
|
|
49873
|
-
|
|
49874
|
-
|
|
49613
|
+
if (this.core.options.playbackRate?.defaultValue) {
|
|
49614
|
+
this.setSelectedRate(this.core.options.playbackRate.defaultValue);
|
|
49615
|
+
}
|
|
49616
|
+
}
|
|
49617
|
+
get playbackRates() {
|
|
49618
|
+
return this.core.options.playbackRate?.options || DEFAULT_PLAYBACK_RATES;
|
|
49875
49619
|
}
|
|
49876
49620
|
/**
|
|
49877
49621
|
* @internal
|
|
@@ -49898,7 +49642,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49898
49642
|
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
|
|
49899
49643
|
}
|
|
49900
49644
|
onCoreReady() {
|
|
49901
|
-
trace(`${T$
|
|
49645
|
+
trace(`${T$7} onCoreReady`);
|
|
49902
49646
|
const mediaControl = this.core.getPlugin('media_control');
|
|
49903
49647
|
assert(mediaControl, 'media_control plugin is required');
|
|
49904
49648
|
const gear = this.core.getPlugin('bottom_gear');
|
|
@@ -49907,22 +49651,27 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49907
49651
|
this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
|
|
49908
49652
|
}
|
|
49909
49653
|
onActiveContainerChange() {
|
|
49910
|
-
trace(`${T$
|
|
49654
|
+
trace(`${T$7} onActiveContainerChange`);
|
|
49911
49655
|
this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
|
|
49912
49656
|
this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_PLAY, this.onPlay);
|
|
49913
49657
|
this.listenTo(this.core.activePlayback, PlaybackEvents.PLAYBACK_RATE_CHANGED, this.onPlaybackRateChange);
|
|
49914
49658
|
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_LOADEDMETADATA, this.onMetaDataLoaded);
|
|
49915
49659
|
}
|
|
49916
49660
|
onMediaControlRendered() {
|
|
49917
|
-
trace(`${T$
|
|
49661
|
+
trace(`${T$7} onMediaControlRendered`);
|
|
49918
49662
|
this.render();
|
|
49919
49663
|
}
|
|
49920
49664
|
onGearRendered() {
|
|
49921
|
-
trace(`${T$
|
|
49922
|
-
this.
|
|
49665
|
+
trace(`${T$7} onGearRendered`);
|
|
49666
|
+
this.mount();
|
|
49923
49667
|
}
|
|
49924
|
-
|
|
49925
|
-
trace(`${T$
|
|
49668
|
+
mount() {
|
|
49669
|
+
trace(`${T$7} mount`, {
|
|
49670
|
+
shouldMount: this.shouldMount(),
|
|
49671
|
+
});
|
|
49672
|
+
if (!this.shouldMount()) {
|
|
49673
|
+
return;
|
|
49674
|
+
}
|
|
49926
49675
|
this.core
|
|
49927
49676
|
.getPlugin('bottom_gear')
|
|
49928
49677
|
?.addItem('rate', this.$el)
|
|
@@ -49934,7 +49683,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49934
49683
|
})));
|
|
49935
49684
|
}
|
|
49936
49685
|
onMetaDataLoaded() {
|
|
49937
|
-
trace(`${T$
|
|
49686
|
+
trace(`${T$7} onMetaDataLoaded`);
|
|
49938
49687
|
this.render();
|
|
49939
49688
|
}
|
|
49940
49689
|
allRateElements() {
|
|
@@ -49949,13 +49698,13 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49949
49698
|
this.core.activePlayback?.setPlaybackRate(this.selectedRate);
|
|
49950
49699
|
}
|
|
49951
49700
|
else {
|
|
49952
|
-
trace(`${T$
|
|
49701
|
+
trace(`${T$7} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
|
|
49953
49702
|
playbackRate,
|
|
49954
49703
|
selectedRate: this.selectedRate,
|
|
49955
49704
|
});
|
|
49956
49705
|
}
|
|
49957
49706
|
}
|
|
49958
|
-
|
|
49707
|
+
shouldMount() {
|
|
49959
49708
|
if (!this.core.activePlayback) {
|
|
49960
49709
|
return false;
|
|
49961
49710
|
}
|
|
@@ -49969,12 +49718,9 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49969
49718
|
* @internal
|
|
49970
49719
|
*/
|
|
49971
49720
|
render() {
|
|
49972
|
-
trace(`${T$
|
|
49973
|
-
|
|
49721
|
+
trace(`${T$7} render`, {
|
|
49722
|
+
shouldMount: this.shouldMount(),
|
|
49974
49723
|
});
|
|
49975
|
-
if (!this.shouldRender()) {
|
|
49976
|
-
return this;
|
|
49977
|
-
}
|
|
49978
49724
|
this.$el.html(PlaybackRate.listTemplate({
|
|
49979
49725
|
arrowLeftIcon,
|
|
49980
49726
|
checkIcon,
|
|
@@ -49982,7 +49728,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49982
49728
|
i18n: this.core.i18n,
|
|
49983
49729
|
playbackRates: this.playbackRates,
|
|
49984
49730
|
}));
|
|
49985
|
-
this.
|
|
49731
|
+
this.mount();
|
|
49986
49732
|
return this;
|
|
49987
49733
|
}
|
|
49988
49734
|
// private onStartAd() {
|
|
@@ -50005,11 +49751,21 @@ class PlaybackRate extends UICorePlugin {
|
|
|
50005
49751
|
this.resetPlaybackRate();
|
|
50006
49752
|
}
|
|
50007
49753
|
else {
|
|
50008
|
-
this.
|
|
49754
|
+
this.syncRate();
|
|
50009
49755
|
}
|
|
50010
49756
|
}
|
|
49757
|
+
syncRate() {
|
|
49758
|
+
trace(`${T$7} syncRate`, {
|
|
49759
|
+
selectedRate: this.selectedRate,
|
|
49760
|
+
});
|
|
49761
|
+
this.core.activePlayback?.setPlaybackRate(this.selectedRate);
|
|
49762
|
+
}
|
|
50011
49763
|
resetPlaybackRate() {
|
|
50012
|
-
|
|
49764
|
+
trace(`${T$7} resetPlaybackRate`, {
|
|
49765
|
+
selectedRate: this.selectedRate,
|
|
49766
|
+
});
|
|
49767
|
+
this.core.activePlayback?.setPlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
49768
|
+
this.selectedRate = DEFAULT_PLAYBACK_RATE;
|
|
50013
49769
|
}
|
|
50014
49770
|
onStop() { }
|
|
50015
49771
|
onSelect(event) {
|
|
@@ -50017,8 +49773,6 @@ class PlaybackRate extends UICorePlugin {
|
|
|
50017
49773
|
const rate = parseFloat(event.currentTarget.dataset.rate || '');
|
|
50018
49774
|
if (rate) {
|
|
50019
49775
|
this.setSelectedRate(rate);
|
|
50020
|
-
this.highlightCurrentRate();
|
|
50021
|
-
this.updateGearOptionLabel();
|
|
50022
49776
|
}
|
|
50023
49777
|
return false;
|
|
50024
49778
|
}
|
|
@@ -50028,14 +49782,23 @@ class PlaybackRate extends UICorePlugin {
|
|
|
50028
49782
|
}, 0);
|
|
50029
49783
|
}
|
|
50030
49784
|
setSelectedRate(rate) {
|
|
50031
|
-
this.
|
|
49785
|
+
if (rate === this.selectedRate) {
|
|
49786
|
+
return;
|
|
49787
|
+
}
|
|
50032
49788
|
this.selectedRate = rate;
|
|
49789
|
+
this.syncRate();
|
|
49790
|
+
this.highlightCurrentRate();
|
|
49791
|
+
this.updateGearOptionLabel();
|
|
50033
49792
|
}
|
|
50034
49793
|
getTitle() {
|
|
50035
|
-
|
|
50036
|
-
|
|
49794
|
+
const rate = this.selectedRate;
|
|
49795
|
+
return (this.playbackRates.find((r) => r.value === rate)?.label ||
|
|
49796
|
+
`x${rate}`);
|
|
50037
49797
|
}
|
|
50038
49798
|
highlightCurrentRate() {
|
|
49799
|
+
trace(`${T$7} highlightCurrentRate`, {
|
|
49800
|
+
selectedRate: this.selectedRate,
|
|
49801
|
+
});
|
|
50039
49802
|
this.allRateElements().removeClass('current');
|
|
50040
49803
|
this.allRateElements().find('a').removeClass('gcore-skin-active');
|
|
50041
49804
|
this.rateElement(this.selectedRate)
|
|
@@ -50044,8 +49807,10 @@ class PlaybackRate extends UICorePlugin {
|
|
|
50044
49807
|
.addClass('gcore-skin-active');
|
|
50045
49808
|
}
|
|
50046
49809
|
updateGearOptionLabel() {
|
|
50047
|
-
trace(`${T$
|
|
50048
|
-
|
|
49810
|
+
trace(`${T$7} updateGearOptionLabel`, {
|
|
49811
|
+
selectedRate: this.selectedRate,
|
|
49812
|
+
});
|
|
49813
|
+
this.mount();
|
|
50049
49814
|
}
|
|
50050
49815
|
}
|
|
50051
49816
|
|
|
@@ -50054,7 +49819,7 @@ const posterHTML = "<div class=\"play-wrapper\" data-poster></div>\n";
|
|
|
50054
49819
|
//Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
50055
49820
|
// Use of this source code is governed by a BSD-style
|
|
50056
49821
|
// license that can be found in the LICENSE file.
|
|
50057
|
-
const T$
|
|
49822
|
+
const T$6 = 'plugins.poster';
|
|
50058
49823
|
/**
|
|
50059
49824
|
* `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
|
|
50060
49825
|
* @beta
|
|
@@ -50160,13 +49925,13 @@ class Poster extends UIContainerPlugin {
|
|
|
50160
49925
|
* Disables the plugin, unmounting it from the DOM
|
|
50161
49926
|
*/
|
|
50162
49927
|
disable() {
|
|
50163
|
-
trace(`${T$
|
|
49928
|
+
trace(`${T$6} disable`);
|
|
50164
49929
|
this.hasStartedPlaying = false;
|
|
50165
49930
|
this.playRequested = false;
|
|
50166
49931
|
super.disable();
|
|
50167
49932
|
}
|
|
50168
49933
|
onError(error) {
|
|
50169
|
-
trace(`${T$
|
|
49934
|
+
trace(`${T$6} onError`, {
|
|
50170
49935
|
error,
|
|
50171
49936
|
enabled: this.enabled,
|
|
50172
49937
|
});
|
|
@@ -50179,18 +49944,18 @@ class Poster extends UIContainerPlugin {
|
|
|
50179
49944
|
}
|
|
50180
49945
|
}
|
|
50181
49946
|
onPlay() {
|
|
50182
|
-
trace(`${T$
|
|
49947
|
+
trace(`${T$6} onPlay`);
|
|
50183
49948
|
this.hasStartedPlaying = true;
|
|
50184
49949
|
this.playRequested = false;
|
|
50185
49950
|
this.update();
|
|
50186
49951
|
}
|
|
50187
49952
|
onPlayIntent() {
|
|
50188
|
-
trace(`${T$
|
|
49953
|
+
trace(`${T$6} onPlayIntent`);
|
|
50189
49954
|
this.playRequested = true;
|
|
50190
49955
|
this.update();
|
|
50191
49956
|
}
|
|
50192
49957
|
onStop() {
|
|
50193
|
-
trace(`${T$
|
|
49958
|
+
trace(`${T$6} onStop`, {
|
|
50194
49959
|
enabled: this.enabled,
|
|
50195
49960
|
});
|
|
50196
49961
|
this.hasStartedPlaying = false;
|
|
@@ -50198,7 +49963,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50198
49963
|
this.update();
|
|
50199
49964
|
}
|
|
50200
49965
|
updatePlayButton(show) {
|
|
50201
|
-
trace(`${T$
|
|
49966
|
+
trace(`${T$6} updatePlayButton`, {
|
|
50202
49967
|
show,
|
|
50203
49968
|
chromeless: this.options.chromeless,
|
|
50204
49969
|
allowUserInteraction: this.options.allowUserInteraction,
|
|
@@ -50227,7 +49992,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50227
49992
|
this.$el.removeClass('clickable');
|
|
50228
49993
|
}
|
|
50229
49994
|
clicked() {
|
|
50230
|
-
trace(`${T$
|
|
49995
|
+
trace(`${T$6} clicked`, {
|
|
50231
49996
|
hasStartedPlaying: this.hasStartedPlaying,
|
|
50232
49997
|
chromeless: this.options.chromeless,
|
|
50233
49998
|
allowUserInteraction: this.options.allowUserInteraction,
|
|
@@ -50248,7 +50013,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50248
50013
|
return !this.container.playback.isAudioOnly;
|
|
50249
50014
|
}
|
|
50250
50015
|
update() {
|
|
50251
|
-
trace(`${T$
|
|
50016
|
+
trace(`${T$6} update`, {
|
|
50252
50017
|
shouldRender: this.shouldRender,
|
|
50253
50018
|
});
|
|
50254
50019
|
if (!this.shouldRender) {
|
|
@@ -50261,7 +50026,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50261
50026
|
this.updatePoster();
|
|
50262
50027
|
}
|
|
50263
50028
|
updatePoster() {
|
|
50264
|
-
trace(`${T$
|
|
50029
|
+
trace(`${T$6} updatePoster`, {
|
|
50265
50030
|
hasStartedPlaying: this.hasStartedPlaying,
|
|
50266
50031
|
});
|
|
50267
50032
|
if (!this.hasStartedPlaying) {
|
|
@@ -50276,7 +50041,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50276
50041
|
this.$el.show();
|
|
50277
50042
|
}
|
|
50278
50043
|
hidePoster() {
|
|
50279
|
-
trace(`${T$
|
|
50044
|
+
trace(`${T$6} hidePoster`, {
|
|
50280
50045
|
shouldHideOnPlay: this.shouldHideOnPlay(),
|
|
50281
50046
|
});
|
|
50282
50047
|
if (!this.options.disableMediaControl) {
|
|
@@ -50326,6 +50091,280 @@ class Poster extends UIContainerPlugin {
|
|
|
50326
50091
|
}
|
|
50327
50092
|
}
|
|
50328
50093
|
|
|
50094
|
+
const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' aria-haspopup=\"menu\">\n <span class=\"gear-option_hd-icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span><%= i18n.t('quality') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= currentText %></span>\n</button>\n";
|
|
50095
|
+
|
|
50096
|
+
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=\"#\" class='gear-sub-menu_btn gcore-skin-text-color' data-id=\"-1\" id=\"level_selector_auto\">\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 data-disabled=\"<%= disabled %>\"\n data-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";
|
|
50097
|
+
|
|
50098
|
+
const hdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.9562 8.22232H13.9961V15.1873H14.9562C15.8914 15.1873 16.766 14.8253 17.4195 14.1676C18.0786 13.5037 18.4415 12.6281 18.4415 11.7026C18.4415 9.7837 16.8781 8.22253 14.9561 8.22253L14.9562 8.22232Z\"\n fill=\"#C9C9C9\"/>\n <path\n d=\"M22.0801 4H1.91994C0.859222 4 0 4.86406 0 5.91994V17.4878C0 18.5437 0.859222 19.4078 1.91994 19.4078H22.0801C23.1408 19.4078 24 18.5437 24 17.4878V5.91994C24 4.86406 23.1408 4 22.0801 4ZM10.3975 15.3473C10.3975 15.6124 10.1827 15.8272 9.91754 15.8272C9.65216 15.8272 9.43761 15.6122 9.43761 15.3473V12.0239H5.55956V15.3473C5.55956 15.6124 5.34481 15.8272 5.07963 15.8272C4.81425 15.8272 4.5997 15.6122 4.5997 15.3473L4.59949 7.74042C4.59949 7.47524 4.81425 7.26049 5.07943 7.26049C5.34481 7.26049 5.55936 7.47544 5.55936 7.74042V11.0636H9.43741V7.74042C9.43741 7.47524 9.65216 7.26049 9.91734 7.26049C10.1827 7.26049 10.3973 7.47544 10.3973 7.74042L10.3975 15.3473ZM18.1005 14.8438C17.2652 15.6844 16.1486 16.1472 14.9561 16.1472H13.5161C13.2507 16.1472 13.0361 15.9323 13.0361 15.6673V7.74263C13.0361 7.47745 13.2509 7.26269 13.5161 7.26269H14.9561C17.4072 7.26269 19.4013 9.25438 19.4013 11.7027C19.4013 12.8835 18.9392 13.9991 18.1005 14.844V14.8438Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
|
|
50099
|
+
|
|
50100
|
+
const T$5 = 'plugins.quality_levels';
|
|
50101
|
+
const VERSION$2 = 'v2.22.5';
|
|
50102
|
+
/**
|
|
50103
|
+
* `PLUGIN` that provides a UI to select the desired quality level of the playback.
|
|
50104
|
+
* @beta
|
|
50105
|
+
*
|
|
50106
|
+
* @remarks
|
|
50107
|
+
* Depends on:
|
|
50108
|
+
*
|
|
50109
|
+
* - {@link MediaControl}
|
|
50110
|
+
*
|
|
50111
|
+
* - {@link BottomGear}
|
|
50112
|
+
*
|
|
50113
|
+
* The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
|
|
50114
|
+
*
|
|
50115
|
+
* Configuration options - {@link QualityLevelsPluginSettings}
|
|
50116
|
+
*
|
|
50117
|
+
* @example
|
|
50118
|
+
* ```ts
|
|
50119
|
+
* new Player({
|
|
50120
|
+
* qualityLevels: {
|
|
50121
|
+
* restrictResolution: 360,
|
|
50122
|
+
* labels: { 360: 'SD', 720: 'HD' },
|
|
50123
|
+
* },
|
|
50124
|
+
* })
|
|
50125
|
+
* ```
|
|
50126
|
+
*/
|
|
50127
|
+
class QualityLevels extends UICorePlugin {
|
|
50128
|
+
levels = [];
|
|
50129
|
+
levelLabels = [];
|
|
50130
|
+
removeAuto = false;
|
|
50131
|
+
isHd = false;
|
|
50132
|
+
currentText = '';
|
|
50133
|
+
selectedLevelId = -1;
|
|
50134
|
+
static buttonTemplate = tmpl(buttonHtml);
|
|
50135
|
+
static listTemplate = tmpl(listHtml);
|
|
50136
|
+
/**
|
|
50137
|
+
* @internal
|
|
50138
|
+
*/
|
|
50139
|
+
get name() {
|
|
50140
|
+
return 'level_selector';
|
|
50141
|
+
}
|
|
50142
|
+
/**
|
|
50143
|
+
* @internal
|
|
50144
|
+
*/
|
|
50145
|
+
get supportedVersion() {
|
|
50146
|
+
return { min: CLAPPR_VERSION };
|
|
50147
|
+
}
|
|
50148
|
+
/**
|
|
50149
|
+
* @internal
|
|
50150
|
+
*/
|
|
50151
|
+
static get version() {
|
|
50152
|
+
return VERSION$2;
|
|
50153
|
+
}
|
|
50154
|
+
/**
|
|
50155
|
+
* @internal
|
|
50156
|
+
*/
|
|
50157
|
+
get attributes() {
|
|
50158
|
+
return {
|
|
50159
|
+
class: 'level-selector',
|
|
50160
|
+
'data-level-selector': '',
|
|
50161
|
+
};
|
|
50162
|
+
}
|
|
50163
|
+
get events() {
|
|
50164
|
+
return {
|
|
50165
|
+
'click .gear-sub-menu_btn': 'onSelect',
|
|
50166
|
+
'click .go-back': 'goBack',
|
|
50167
|
+
};
|
|
50168
|
+
}
|
|
50169
|
+
/**
|
|
50170
|
+
* @internal
|
|
50171
|
+
*/
|
|
50172
|
+
bindEvents() {
|
|
50173
|
+
this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
|
|
50174
|
+
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
|
|
50175
|
+
}
|
|
50176
|
+
onCoreReady() {
|
|
50177
|
+
trace(`${T$5} onCoreReady`);
|
|
50178
|
+
const gear = this.core.getPlugin('bottom_gear');
|
|
50179
|
+
assert(gear, 'bottom_gear plugin is required');
|
|
50180
|
+
this.currentText = this.core.i18n.t('auto');
|
|
50181
|
+
this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
|
|
50182
|
+
}
|
|
50183
|
+
onGearRendered() {
|
|
50184
|
+
trace(`${T$5} onGearRendered`);
|
|
50185
|
+
this.render();
|
|
50186
|
+
}
|
|
50187
|
+
onActiveContainerChange() {
|
|
50188
|
+
this.removeAuto = false;
|
|
50189
|
+
this.isHd = false;
|
|
50190
|
+
const activePlayback = this.core.activePlayback;
|
|
50191
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
|
|
50192
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
|
|
50193
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
|
|
50194
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_BITRATE, this.onBitrate);
|
|
50195
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
|
|
50196
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
|
|
50197
|
+
this.isHd = isHd;
|
|
50198
|
+
this.updateHd();
|
|
50199
|
+
});
|
|
50200
|
+
if (activePlayback.levels?.length > 0) {
|
|
50201
|
+
this.onLevelsAvailable(activePlayback.levels);
|
|
50202
|
+
}
|
|
50203
|
+
}
|
|
50204
|
+
updateHd() {
|
|
50205
|
+
if (this.isHd) {
|
|
50206
|
+
this.$el.find('.gear-option_hd-icon').removeClass('hidden');
|
|
50207
|
+
}
|
|
50208
|
+
else {
|
|
50209
|
+
this.$el.find('.gear-option_hd-icon').addClass('hidden');
|
|
50210
|
+
}
|
|
50211
|
+
}
|
|
50212
|
+
onStop() {
|
|
50213
|
+
trace(`${T$5} onStop`);
|
|
50214
|
+
this.listenToOnce(this.core.activePlayback, Events$1.PLAYBACK_PLAY, () => {
|
|
50215
|
+
if (this.core.activePlayback.getPlaybackType() === 'live') {
|
|
50216
|
+
if (this.selectedLevelId !== -1) {
|
|
50217
|
+
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
50218
|
+
}
|
|
50219
|
+
}
|
|
50220
|
+
});
|
|
50221
|
+
}
|
|
50222
|
+
shouldRender() {
|
|
50223
|
+
const activePlayback = this.core.activePlayback;
|
|
50224
|
+
if (!activePlayback) {
|
|
50225
|
+
return false;
|
|
50226
|
+
}
|
|
50227
|
+
const supportsCurrentLevel = 'currentLevel' in activePlayback;
|
|
50228
|
+
if (!supportsCurrentLevel) {
|
|
50229
|
+
return false;
|
|
50230
|
+
}
|
|
50231
|
+
// Only care if we have at least 2 to choose from
|
|
50232
|
+
return !!(this.levels && this.levels.length > 1);
|
|
50233
|
+
}
|
|
50234
|
+
/**
|
|
50235
|
+
* @internal
|
|
50236
|
+
*/
|
|
50237
|
+
render() {
|
|
50238
|
+
if (!this.shouldRender()) {
|
|
50239
|
+
return this;
|
|
50240
|
+
}
|
|
50241
|
+
this.renderDropdown();
|
|
50242
|
+
this.updateButton();
|
|
50243
|
+
return this;
|
|
50244
|
+
}
|
|
50245
|
+
renderDropdown() {
|
|
50246
|
+
this.$el.html(QualityLevels.listTemplate({
|
|
50247
|
+
arrowLeftIcon,
|
|
50248
|
+
checkIcon,
|
|
50249
|
+
current: this.selectedLevelId,
|
|
50250
|
+
labels: this.levelLabels,
|
|
50251
|
+
levels: this.levels,
|
|
50252
|
+
maxLevel: this.maxLevel,
|
|
50253
|
+
removeAuto: this.removeAuto,
|
|
50254
|
+
i18n: this.core.i18n,
|
|
50255
|
+
}));
|
|
50256
|
+
}
|
|
50257
|
+
updateButton() {
|
|
50258
|
+
this.core.getPlugin('bottom_gear')
|
|
50259
|
+
?.addItem('quality', this.$el)
|
|
50260
|
+
.html(QualityLevels.buttonTemplate({
|
|
50261
|
+
arrowRightIcon,
|
|
50262
|
+
currentText: this.currentText,
|
|
50263
|
+
isHd: this.isHd,
|
|
50264
|
+
hdIcon,
|
|
50265
|
+
i18n: this.core.i18n,
|
|
50266
|
+
}));
|
|
50267
|
+
}
|
|
50268
|
+
get pluginOptions() {
|
|
50269
|
+
return (this.core.options.qualityLevels || this.core.options.levelSelector || {});
|
|
50270
|
+
}
|
|
50271
|
+
get maxLevel() {
|
|
50272
|
+
const maxRes = this.pluginOptions.restrictResolution;
|
|
50273
|
+
return maxRes
|
|
50274
|
+
? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
|
|
50275
|
+
maxRes)?.level ?? -1
|
|
50276
|
+
: -1;
|
|
50277
|
+
}
|
|
50278
|
+
onLevelsAvailable(levels) {
|
|
50279
|
+
const maxResolution = this.pluginOptions.restrictResolution;
|
|
50280
|
+
this.levels = levels;
|
|
50281
|
+
this.makeLevelsLabels();
|
|
50282
|
+
if (maxResolution) {
|
|
50283
|
+
this.removeAuto = true;
|
|
50284
|
+
const initialLevel = levels
|
|
50285
|
+
.filter((level) => (level.width > level.height ? level.height : level.width) <=
|
|
50286
|
+
maxResolution)
|
|
50287
|
+
.pop();
|
|
50288
|
+
this.setLevel(initialLevel?.level ?? 0);
|
|
50289
|
+
}
|
|
50290
|
+
this.render();
|
|
50291
|
+
}
|
|
50292
|
+
makeLevelsLabels() {
|
|
50293
|
+
const labels = this.pluginOptions.labels ?? {};
|
|
50294
|
+
this.levelLabels = [];
|
|
50295
|
+
for (const level of this.levels) {
|
|
50296
|
+
const ll = level.width > level.height ? level.height : level.width;
|
|
50297
|
+
const label = labels[ll] || `${ll}p`;
|
|
50298
|
+
this.levelLabels.push(label);
|
|
50299
|
+
}
|
|
50300
|
+
}
|
|
50301
|
+
onSelect(event) {
|
|
50302
|
+
const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
|
|
50303
|
+
this.setLevel(selectedLevel);
|
|
50304
|
+
event.stopPropagation();
|
|
50305
|
+
event.preventDefault();
|
|
50306
|
+
return false;
|
|
50307
|
+
}
|
|
50308
|
+
goBack() {
|
|
50309
|
+
trace(`${T$5} goBack`);
|
|
50310
|
+
this.core.getPlugin('bottom_gear').refresh();
|
|
50311
|
+
}
|
|
50312
|
+
setLevel(index) {
|
|
50313
|
+
this.selectedLevelId = index;
|
|
50314
|
+
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
50315
|
+
this.highlightCurrentLevel();
|
|
50316
|
+
}
|
|
50317
|
+
allLevelElements() {
|
|
50318
|
+
return this.$('#level-selector-menu li');
|
|
50319
|
+
}
|
|
50320
|
+
levelElement(id = -1) {
|
|
50321
|
+
return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
|
|
50322
|
+
}
|
|
50323
|
+
onLevelSwitchStart() {
|
|
50324
|
+
this.levelElement(this.selectedLevelId).addClass('changing');
|
|
50325
|
+
}
|
|
50326
|
+
onLevelSwitchEnd() {
|
|
50327
|
+
this.levelElement(this.selectedLevelId).removeClass('changing');
|
|
50328
|
+
}
|
|
50329
|
+
updateText(level) {
|
|
50330
|
+
this.currentText = this.getLevelLabel(level);
|
|
50331
|
+
this.updateButton();
|
|
50332
|
+
}
|
|
50333
|
+
getLevelLabel(id) {
|
|
50334
|
+
if (id < 0) {
|
|
50335
|
+
return this.core.i18n.t('auto');
|
|
50336
|
+
}
|
|
50337
|
+
const index = this.levels.findIndex((l) => l.level === id);
|
|
50338
|
+
if (index < 0) {
|
|
50339
|
+
return this.core.i18n.t('auto');
|
|
50340
|
+
}
|
|
50341
|
+
return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
|
|
50342
|
+
}
|
|
50343
|
+
onBitrate(info) {
|
|
50344
|
+
trace(`${T$5} updateCurrentLevel`, { info });
|
|
50345
|
+
this.highlightCurrentLevel();
|
|
50346
|
+
}
|
|
50347
|
+
highlightCurrentLevel() {
|
|
50348
|
+
trace(`${T$5} highlightCurrentLevel`, {
|
|
50349
|
+
selectedLevelId: this.selectedLevelId,
|
|
50350
|
+
});
|
|
50351
|
+
this.allLevelElements()
|
|
50352
|
+
.removeClass('current')
|
|
50353
|
+
.find('a')
|
|
50354
|
+
.removeClass('gcore-skin-active');
|
|
50355
|
+
const currentLevelElement = this.levelElement(this.selectedLevelId);
|
|
50356
|
+
currentLevelElement
|
|
50357
|
+
.addClass('current')
|
|
50358
|
+
.find('a')
|
|
50359
|
+
.addClass('gcore-skin-active');
|
|
50360
|
+
this.updateText(this.selectedLevelId);
|
|
50361
|
+
}
|
|
50362
|
+
}
|
|
50363
|
+
function formatLevelLabel(level) {
|
|
50364
|
+
const h = level.width > level.height ? level.height : level.width;
|
|
50365
|
+
return `${h}p`;
|
|
50366
|
+
}
|
|
50367
|
+
|
|
50329
50368
|
const seekTimeHTML = "<span data-seek-time></span>\n<span data-duration></span>\n";
|
|
50330
50369
|
|
|
50331
50370
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
@@ -52292,4 +52331,4 @@ class VolumeFade extends UICorePlugin {
|
|
|
52292
52331
|
}
|
|
52293
52332
|
}
|
|
52294
52333
|
|
|
52295
|
-
export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, LevelSelector, LogTracer, Logger, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };
|
|
52334
|
+
export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, QualityLevels as LevelSelector, LogTracer, Logger, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, QualityLevels, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };
|