@gcorevideo/player 2.22.4 → 2.22.5
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/dist/core.js +1 -1
- package/dist/index.css +1337 -1333
- package/dist/index.js +329 -326
- package/dist/plugins/index.css +626 -622
- package/dist/plugins/index.js +305 -302
- 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/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/vast-ads/VastAds.d.ts +1 -0
- package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -1
- package/lib/plugins/vast-ads/VastAds.js +6 -3
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -1
- 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/vast-ads/VastAds.ts +8 -4
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -43299,7 +43299,7 @@ class Player {
|
|
|
43299
43299
|
}
|
|
43300
43300
|
}
|
|
43301
43301
|
|
|
43302
|
-
var version$1 = "2.22.
|
|
43302
|
+
var version$1 = "2.22.5";
|
|
43303
43303
|
|
|
43304
43304
|
var packages = {
|
|
43305
43305
|
"node_modules/@clappr/core": {
|
|
@@ -47494,283 +47494,6 @@ class GoogleAnalytics extends ContainerPlugin {
|
|
|
47494
47494
|
}
|
|
47495
47495
|
}
|
|
47496
47496
|
|
|
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
47497
|
function calculateSize(original) {
|
|
47775
47498
|
const transformed = {
|
|
47776
47499
|
media: {
|
|
@@ -48206,7 +47929,7 @@ const DEFAULT_SETTINGS = {
|
|
|
48206
47929
|
default: [],
|
|
48207
47930
|
seekEnabled: true,
|
|
48208
47931
|
};
|
|
48209
|
-
const T$
|
|
47932
|
+
const T$a = 'plugins.media_control';
|
|
48210
47933
|
const LEFT_ORDER = [
|
|
48211
47934
|
'playpause',
|
|
48212
47935
|
'playstop',
|
|
@@ -48444,7 +48167,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48444
48167
|
* Hides the media control UI
|
|
48445
48168
|
*/
|
|
48446
48169
|
disable() {
|
|
48447
|
-
trace(`${T$
|
|
48170
|
+
trace(`${T$a} disable`);
|
|
48448
48171
|
this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
|
|
48449
48172
|
this.hide();
|
|
48450
48173
|
this.unbindKeyEvents();
|
|
@@ -48454,7 +48177,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48454
48177
|
* Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
|
|
48455
48178
|
*/
|
|
48456
48179
|
enable() {
|
|
48457
|
-
trace(`${T$
|
|
48180
|
+
trace(`${T$a} enable`);
|
|
48458
48181
|
if (this.options.chromeless) {
|
|
48459
48182
|
return;
|
|
48460
48183
|
}
|
|
@@ -48989,7 +48712,7 @@ class MediaControl extends UICorePlugin {
|
|
|
48989
48712
|
}
|
|
48990
48713
|
putElement(name, element) {
|
|
48991
48714
|
const panel = this.getElementLocation(name);
|
|
48992
|
-
trace(`${T$
|
|
48715
|
+
trace(`${T$a} putElement`, { name, panel: !!panel });
|
|
48993
48716
|
if (panel) {
|
|
48994
48717
|
const current = panel.find(`[data-${name}]`);
|
|
48995
48718
|
element.attr(`data-${name}`, '');
|
|
@@ -49177,7 +48900,7 @@ class MediaControl extends UICorePlugin {
|
|
|
49177
48900
|
* @internal
|
|
49178
48901
|
*/
|
|
49179
48902
|
render() {
|
|
49180
|
-
trace(`${T$
|
|
48903
|
+
trace(`${T$a} render`);
|
|
49181
48904
|
const timeout = this.options.hideMediaControlDelay || 2000;
|
|
49182
48905
|
const html = MediaControl.template({ settings: this.settings ?? {} });
|
|
49183
48906
|
this.$el.html(html);
|
|
@@ -49299,7 +49022,7 @@ class MediaControl extends UICorePlugin {
|
|
|
49299
49022
|
return isFinite(this.core.activePlayback.getDuration());
|
|
49300
49023
|
}
|
|
49301
49024
|
getElementLocation(name) {
|
|
49302
|
-
trace(`${T$
|
|
49025
|
+
trace(`${T$a} getElementLocation`, {
|
|
49303
49026
|
name,
|
|
49304
49027
|
right: this.settings.right,
|
|
49305
49028
|
left: this.settings.left,
|
|
@@ -49346,8 +49069,8 @@ const streamsMomentoIcon = "<svg id=\"Слой_1\" data-name=\"Слой 1\" xmln
|
|
|
49346
49069
|
|
|
49347
49070
|
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
49071
|
|
|
49349
|
-
const VERSION$
|
|
49350
|
-
const T$
|
|
49072
|
+
const VERSION$4 = '0.0.1';
|
|
49073
|
+
const T$9 = 'plugins.multicamera';
|
|
49351
49074
|
/**
|
|
49352
49075
|
* `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
|
|
49353
49076
|
* @beta
|
|
@@ -49365,7 +49088,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49365
49088
|
return { min: CLAPPR_VERSION };
|
|
49366
49089
|
}
|
|
49367
49090
|
static get version() {
|
|
49368
|
-
return VERSION$
|
|
49091
|
+
return VERSION$4;
|
|
49369
49092
|
}
|
|
49370
49093
|
get template() {
|
|
49371
49094
|
return tmpl(pluginHtml$3);
|
|
@@ -49493,7 +49216,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49493
49216
|
}
|
|
49494
49217
|
onCameraSelect(event) {
|
|
49495
49218
|
const value = event.currentTarget.dataset.multicameraSelectorSelect;
|
|
49496
|
-
trace(`${T$
|
|
49219
|
+
trace(`${T$9} onCameraSelect`, { value });
|
|
49497
49220
|
if (value !== undefined) {
|
|
49498
49221
|
this.changeById(parseInt(value, 10));
|
|
49499
49222
|
}
|
|
@@ -49619,13 +49342,13 @@ class MultiCamera extends UICorePlugin {
|
|
|
49619
49342
|
}
|
|
49620
49343
|
}
|
|
49621
49344
|
changeById(id) {
|
|
49622
|
-
trace(`${T$
|
|
49345
|
+
trace(`${T$9} changeById`, { id });
|
|
49623
49346
|
queueMicrotask(() => {
|
|
49624
49347
|
const playbackOptions = this.core.options.playback || {};
|
|
49625
49348
|
// TODO figure out what this does
|
|
49626
49349
|
playbackOptions.recycleVideo = Browser.isMobile;
|
|
49627
49350
|
this.currentCamera = this.findElementById(id) ?? null;
|
|
49628
|
-
trace(`${T$
|
|
49351
|
+
trace(`${T$9} changeById`, { id, currentCamera: this.currentCamera, multicamera: this.multicamera });
|
|
49629
49352
|
if (!this.currentCamera) {
|
|
49630
49353
|
return;
|
|
49631
49354
|
}
|
|
@@ -49642,7 +49365,7 @@ class MultiCamera extends UICorePlugin {
|
|
|
49642
49365
|
// TODO remove?
|
|
49643
49366
|
// for html5 playback:
|
|
49644
49367
|
this.options.dvrEnabled = this.currentCamera.dvr;
|
|
49645
|
-
trace(`${T$
|
|
49368
|
+
trace(`${T$9} changeById`, { currentCamera: this.currentCamera });
|
|
49646
49369
|
// TODO
|
|
49647
49370
|
this.core.configure({
|
|
49648
49371
|
playback: playbackOptions,
|
|
@@ -49697,10 +49420,10 @@ class MultiCamera extends UICorePlugin {
|
|
|
49697
49420
|
|
|
49698
49421
|
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
49422
|
|
|
49700
|
-
const buttonHtml$
|
|
49423
|
+
const buttonHtml$2 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
|
|
49701
49424
|
|
|
49702
|
-
const VERSION$
|
|
49703
|
-
const T$
|
|
49425
|
+
const VERSION$3 = '0.0.1';
|
|
49426
|
+
const T$8 = `plugins.pip`;
|
|
49704
49427
|
/**
|
|
49705
49428
|
* `PLUGIN` that enables picture in picture mode.
|
|
49706
49429
|
* @beta
|
|
@@ -49728,9 +49451,9 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49728
49451
|
* @internal
|
|
49729
49452
|
*/
|
|
49730
49453
|
static get version() {
|
|
49731
|
-
return VERSION$
|
|
49454
|
+
return VERSION$3;
|
|
49732
49455
|
}
|
|
49733
|
-
static buttonTemplate = tmpl(buttonHtml$
|
|
49456
|
+
static buttonTemplate = tmpl(buttonHtml$2);
|
|
49734
49457
|
/**
|
|
49735
49458
|
* @internal
|
|
49736
49459
|
*/
|
|
@@ -49758,7 +49481,7 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49758
49481
|
});
|
|
49759
49482
|
}
|
|
49760
49483
|
isPiPSupported() {
|
|
49761
|
-
trace(`${T$
|
|
49484
|
+
trace(`${T$8} isPiPSupported`, {
|
|
49762
49485
|
pictureInPictureEnabled: !!document.pictureInPictureEnabled,
|
|
49763
49486
|
requestPictureInPicture: !!HTMLVideoElement.prototype.requestPictureInPicture,
|
|
49764
49487
|
});
|
|
@@ -49779,7 +49502,7 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49779
49502
|
return this;
|
|
49780
49503
|
}
|
|
49781
49504
|
togglePictureInPicture() {
|
|
49782
|
-
trace(`${T$
|
|
49505
|
+
trace(`${T$8} togglePictureInPicture`);
|
|
49783
49506
|
if (this.videoElement !== document.pictureInPictureElement) {
|
|
49784
49507
|
this.requestPictureInPicture();
|
|
49785
49508
|
}
|
|
@@ -49788,23 +49511,29 @@ class PictureInPicture extends UICorePlugin {
|
|
|
49788
49511
|
}
|
|
49789
49512
|
}
|
|
49790
49513
|
requestPictureInPicture() {
|
|
49791
|
-
trace(`${T$
|
|
49514
|
+
trace(`${T$8} requestPictureInPicture`, {
|
|
49792
49515
|
videoElement: !!this.videoElement,
|
|
49793
49516
|
});
|
|
49794
49517
|
this.videoElement.requestPictureInPicture();
|
|
49795
49518
|
}
|
|
49796
49519
|
exitPictureInPicture() {
|
|
49797
|
-
trace(`${T$
|
|
49520
|
+
trace(`${T$8} exitPictureInPicture`);
|
|
49798
49521
|
document.exitPictureInPicture();
|
|
49799
49522
|
}
|
|
49800
49523
|
}
|
|
49801
49524
|
|
|
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";
|
|
49525
|
+
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
49526
|
|
|
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>";
|
|
49527
|
+
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
49528
|
|
|
49806
49529
|
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
49530
|
|
|
49531
|
+
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";
|
|
49532
|
+
|
|
49533
|
+
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";
|
|
49534
|
+
|
|
49535
|
+
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";
|
|
49536
|
+
|
|
49808
49537
|
const DEFAULT_PLAYBACK_RATES = [
|
|
49809
49538
|
{ value: 0.5, label: '0.5x' },
|
|
49810
49539
|
{ value: 0.75, label: '0.75x' },
|
|
@@ -49815,7 +49544,7 @@ const DEFAULT_PLAYBACK_RATES = [
|
|
|
49815
49544
|
{ value: 2.0, label: '2x' },
|
|
49816
49545
|
];
|
|
49817
49546
|
const DEFAULT_PLAYBACK_RATE = 1;
|
|
49818
|
-
const T$
|
|
49547
|
+
const T$7 = 'plugins.playback_rate';
|
|
49819
49548
|
/**
|
|
49820
49549
|
* `PLUGIN` that allows changing the playback speed of the video.
|
|
49821
49550
|
* @beta
|
|
@@ -49864,8 +49593,8 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49864
49593
|
get supportedVersion() {
|
|
49865
49594
|
return { min: CLAPPR_VERSION };
|
|
49866
49595
|
}
|
|
49867
|
-
static buttonTemplate = tmpl(buttonHtml);
|
|
49868
|
-
static listTemplate = tmpl(listHtml);
|
|
49596
|
+
static buttonTemplate = tmpl(buttonHtml$1);
|
|
49597
|
+
static listTemplate = tmpl(listHtml$1);
|
|
49869
49598
|
constructor(core) {
|
|
49870
49599
|
super(core);
|
|
49871
49600
|
this.playbackRates =
|
|
@@ -49898,7 +49627,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49898
49627
|
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
|
|
49899
49628
|
}
|
|
49900
49629
|
onCoreReady() {
|
|
49901
|
-
trace(`${T$
|
|
49630
|
+
trace(`${T$7} onCoreReady`);
|
|
49902
49631
|
const mediaControl = this.core.getPlugin('media_control');
|
|
49903
49632
|
assert(mediaControl, 'media_control plugin is required');
|
|
49904
49633
|
const gear = this.core.getPlugin('bottom_gear');
|
|
@@ -49907,22 +49636,22 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49907
49636
|
this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
|
|
49908
49637
|
}
|
|
49909
49638
|
onActiveContainerChange() {
|
|
49910
|
-
trace(`${T$
|
|
49639
|
+
trace(`${T$7} onActiveContainerChange`);
|
|
49911
49640
|
this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
|
|
49912
49641
|
this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_PLAY, this.onPlay);
|
|
49913
49642
|
this.listenTo(this.core.activePlayback, PlaybackEvents.PLAYBACK_RATE_CHANGED, this.onPlaybackRateChange);
|
|
49914
49643
|
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_LOADEDMETADATA, this.onMetaDataLoaded);
|
|
49915
49644
|
}
|
|
49916
49645
|
onMediaControlRendered() {
|
|
49917
|
-
trace(`${T$
|
|
49646
|
+
trace(`${T$7} onMediaControlRendered`);
|
|
49918
49647
|
this.render();
|
|
49919
49648
|
}
|
|
49920
49649
|
onGearRendered() {
|
|
49921
|
-
trace(`${T$
|
|
49650
|
+
trace(`${T$7} onGearRendered`);
|
|
49922
49651
|
this.addGearItem();
|
|
49923
49652
|
}
|
|
49924
49653
|
addGearItem() {
|
|
49925
|
-
trace(`${T$
|
|
49654
|
+
trace(`${T$7} addGearItem`);
|
|
49926
49655
|
this.core
|
|
49927
49656
|
.getPlugin('bottom_gear')
|
|
49928
49657
|
?.addItem('rate', this.$el)
|
|
@@ -49934,7 +49663,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49934
49663
|
})));
|
|
49935
49664
|
}
|
|
49936
49665
|
onMetaDataLoaded() {
|
|
49937
|
-
trace(`${T$
|
|
49666
|
+
trace(`${T$7} onMetaDataLoaded`);
|
|
49938
49667
|
this.render();
|
|
49939
49668
|
}
|
|
49940
49669
|
allRateElements() {
|
|
@@ -49949,7 +49678,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49949
49678
|
this.core.activePlayback?.setPlaybackRate(this.selectedRate);
|
|
49950
49679
|
}
|
|
49951
49680
|
else {
|
|
49952
|
-
trace(`${T$
|
|
49681
|
+
trace(`${T$7} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
|
|
49953
49682
|
playbackRate,
|
|
49954
49683
|
selectedRate: this.selectedRate,
|
|
49955
49684
|
});
|
|
@@ -49969,7 +49698,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
49969
49698
|
* @internal
|
|
49970
49699
|
*/
|
|
49971
49700
|
render() {
|
|
49972
|
-
trace(`${T$
|
|
49701
|
+
trace(`${T$7} render`, {
|
|
49973
49702
|
shouldRender: this.shouldRender(),
|
|
49974
49703
|
});
|
|
49975
49704
|
if (!this.shouldRender()) {
|
|
@@ -50044,7 +49773,7 @@ class PlaybackRate extends UICorePlugin {
|
|
|
50044
49773
|
.addClass('gcore-skin-active');
|
|
50045
49774
|
}
|
|
50046
49775
|
updateGearOptionLabel() {
|
|
50047
|
-
trace(`${T$
|
|
49776
|
+
trace(`${T$7} updateGearOptionLabel`);
|
|
50048
49777
|
this.addGearItem();
|
|
50049
49778
|
}
|
|
50050
49779
|
}
|
|
@@ -50054,7 +49783,7 @@ const posterHTML = "<div class=\"play-wrapper\" data-poster></div>\n";
|
|
|
50054
49783
|
//Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
50055
49784
|
// Use of this source code is governed by a BSD-style
|
|
50056
49785
|
// license that can be found in the LICENSE file.
|
|
50057
|
-
const T$
|
|
49786
|
+
const T$6 = 'plugins.poster';
|
|
50058
49787
|
/**
|
|
50059
49788
|
* `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
|
|
50060
49789
|
* @beta
|
|
@@ -50160,13 +49889,13 @@ class Poster extends UIContainerPlugin {
|
|
|
50160
49889
|
* Disables the plugin, unmounting it from the DOM
|
|
50161
49890
|
*/
|
|
50162
49891
|
disable() {
|
|
50163
|
-
trace(`${T$
|
|
49892
|
+
trace(`${T$6} disable`);
|
|
50164
49893
|
this.hasStartedPlaying = false;
|
|
50165
49894
|
this.playRequested = false;
|
|
50166
49895
|
super.disable();
|
|
50167
49896
|
}
|
|
50168
49897
|
onError(error) {
|
|
50169
|
-
trace(`${T$
|
|
49898
|
+
trace(`${T$6} onError`, {
|
|
50170
49899
|
error,
|
|
50171
49900
|
enabled: this.enabled,
|
|
50172
49901
|
});
|
|
@@ -50179,18 +49908,18 @@ class Poster extends UIContainerPlugin {
|
|
|
50179
49908
|
}
|
|
50180
49909
|
}
|
|
50181
49910
|
onPlay() {
|
|
50182
|
-
trace(`${T$
|
|
49911
|
+
trace(`${T$6} onPlay`);
|
|
50183
49912
|
this.hasStartedPlaying = true;
|
|
50184
49913
|
this.playRequested = false;
|
|
50185
49914
|
this.update();
|
|
50186
49915
|
}
|
|
50187
49916
|
onPlayIntent() {
|
|
50188
|
-
trace(`${T$
|
|
49917
|
+
trace(`${T$6} onPlayIntent`);
|
|
50189
49918
|
this.playRequested = true;
|
|
50190
49919
|
this.update();
|
|
50191
49920
|
}
|
|
50192
49921
|
onStop() {
|
|
50193
|
-
trace(`${T$
|
|
49922
|
+
trace(`${T$6} onStop`, {
|
|
50194
49923
|
enabled: this.enabled,
|
|
50195
49924
|
});
|
|
50196
49925
|
this.hasStartedPlaying = false;
|
|
@@ -50198,7 +49927,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50198
49927
|
this.update();
|
|
50199
49928
|
}
|
|
50200
49929
|
updatePlayButton(show) {
|
|
50201
|
-
trace(`${T$
|
|
49930
|
+
trace(`${T$6} updatePlayButton`, {
|
|
50202
49931
|
show,
|
|
50203
49932
|
chromeless: this.options.chromeless,
|
|
50204
49933
|
allowUserInteraction: this.options.allowUserInteraction,
|
|
@@ -50227,7 +49956,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50227
49956
|
this.$el.removeClass('clickable');
|
|
50228
49957
|
}
|
|
50229
49958
|
clicked() {
|
|
50230
|
-
trace(`${T$
|
|
49959
|
+
trace(`${T$6} clicked`, {
|
|
50231
49960
|
hasStartedPlaying: this.hasStartedPlaying,
|
|
50232
49961
|
chromeless: this.options.chromeless,
|
|
50233
49962
|
allowUserInteraction: this.options.allowUserInteraction,
|
|
@@ -50248,7 +49977,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50248
49977
|
return !this.container.playback.isAudioOnly;
|
|
50249
49978
|
}
|
|
50250
49979
|
update() {
|
|
50251
|
-
trace(`${T$
|
|
49980
|
+
trace(`${T$6} update`, {
|
|
50252
49981
|
shouldRender: this.shouldRender,
|
|
50253
49982
|
});
|
|
50254
49983
|
if (!this.shouldRender) {
|
|
@@ -50261,7 +49990,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50261
49990
|
this.updatePoster();
|
|
50262
49991
|
}
|
|
50263
49992
|
updatePoster() {
|
|
50264
|
-
trace(`${T$
|
|
49993
|
+
trace(`${T$6} updatePoster`, {
|
|
50265
49994
|
hasStartedPlaying: this.hasStartedPlaying,
|
|
50266
49995
|
});
|
|
50267
49996
|
if (!this.hasStartedPlaying) {
|
|
@@ -50276,7 +50005,7 @@ class Poster extends UIContainerPlugin {
|
|
|
50276
50005
|
this.$el.show();
|
|
50277
50006
|
}
|
|
50278
50007
|
hidePoster() {
|
|
50279
|
-
trace(`${T$
|
|
50008
|
+
trace(`${T$6} hidePoster`, {
|
|
50280
50009
|
shouldHideOnPlay: this.shouldHideOnPlay(),
|
|
50281
50010
|
});
|
|
50282
50011
|
if (!this.options.disableMediaControl) {
|
|
@@ -50326,6 +50055,280 @@ class Poster extends UIContainerPlugin {
|
|
|
50326
50055
|
}
|
|
50327
50056
|
}
|
|
50328
50057
|
|
|
50058
|
+
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";
|
|
50059
|
+
|
|
50060
|
+
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";
|
|
50061
|
+
|
|
50062
|
+
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";
|
|
50063
|
+
|
|
50064
|
+
const T$5 = 'plugins.quality_levels';
|
|
50065
|
+
const VERSION$2 = 'v2.22.5';
|
|
50066
|
+
/**
|
|
50067
|
+
* `PLUGIN` that provides a UI to select the desired quality level of the playback.
|
|
50068
|
+
* @beta
|
|
50069
|
+
*
|
|
50070
|
+
* @remarks
|
|
50071
|
+
* Depends on:
|
|
50072
|
+
*
|
|
50073
|
+
* - {@link MediaControl}
|
|
50074
|
+
*
|
|
50075
|
+
* - {@link BottomGear}
|
|
50076
|
+
*
|
|
50077
|
+
* The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
|
|
50078
|
+
*
|
|
50079
|
+
* Configuration options - {@link QualityLevelsPluginSettings}
|
|
50080
|
+
*
|
|
50081
|
+
* @example
|
|
50082
|
+
* ```ts
|
|
50083
|
+
* new Player({
|
|
50084
|
+
* qualityLevels: {
|
|
50085
|
+
* restrictResolution: 360,
|
|
50086
|
+
* labels: { 360: 'SD', 720: 'HD' },
|
|
50087
|
+
* },
|
|
50088
|
+
* })
|
|
50089
|
+
* ```
|
|
50090
|
+
*/
|
|
50091
|
+
class QualityLevels extends UICorePlugin {
|
|
50092
|
+
levels = [];
|
|
50093
|
+
levelLabels = [];
|
|
50094
|
+
removeAuto = false;
|
|
50095
|
+
isHd = false;
|
|
50096
|
+
currentText = '';
|
|
50097
|
+
selectedLevelId = -1;
|
|
50098
|
+
static buttonTemplate = tmpl(buttonHtml);
|
|
50099
|
+
static listTemplate = tmpl(listHtml);
|
|
50100
|
+
/**
|
|
50101
|
+
* @internal
|
|
50102
|
+
*/
|
|
50103
|
+
get name() {
|
|
50104
|
+
return 'level_selector';
|
|
50105
|
+
}
|
|
50106
|
+
/**
|
|
50107
|
+
* @internal
|
|
50108
|
+
*/
|
|
50109
|
+
get supportedVersion() {
|
|
50110
|
+
return { min: CLAPPR_VERSION };
|
|
50111
|
+
}
|
|
50112
|
+
/**
|
|
50113
|
+
* @internal
|
|
50114
|
+
*/
|
|
50115
|
+
static get version() {
|
|
50116
|
+
return VERSION$2;
|
|
50117
|
+
}
|
|
50118
|
+
/**
|
|
50119
|
+
* @internal
|
|
50120
|
+
*/
|
|
50121
|
+
get attributes() {
|
|
50122
|
+
return {
|
|
50123
|
+
class: 'level-selector',
|
|
50124
|
+
'data-level-selector': '',
|
|
50125
|
+
};
|
|
50126
|
+
}
|
|
50127
|
+
get events() {
|
|
50128
|
+
return {
|
|
50129
|
+
'click .gear-sub-menu_btn': 'onSelect',
|
|
50130
|
+
'click .go-back': 'goBack',
|
|
50131
|
+
};
|
|
50132
|
+
}
|
|
50133
|
+
/**
|
|
50134
|
+
* @internal
|
|
50135
|
+
*/
|
|
50136
|
+
bindEvents() {
|
|
50137
|
+
this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
|
|
50138
|
+
this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
|
|
50139
|
+
}
|
|
50140
|
+
onCoreReady() {
|
|
50141
|
+
trace(`${T$5} onCoreReady`);
|
|
50142
|
+
const gear = this.core.getPlugin('bottom_gear');
|
|
50143
|
+
assert(gear, 'bottom_gear plugin is required');
|
|
50144
|
+
this.currentText = this.core.i18n.t('auto');
|
|
50145
|
+
this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
|
|
50146
|
+
}
|
|
50147
|
+
onGearRendered() {
|
|
50148
|
+
trace(`${T$5} onGearRendered`);
|
|
50149
|
+
this.render();
|
|
50150
|
+
}
|
|
50151
|
+
onActiveContainerChange() {
|
|
50152
|
+
this.removeAuto = false;
|
|
50153
|
+
this.isHd = false;
|
|
50154
|
+
const activePlayback = this.core.activePlayback;
|
|
50155
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
|
|
50156
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
|
|
50157
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
|
|
50158
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_BITRATE, this.onBitrate);
|
|
50159
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
|
|
50160
|
+
this.listenTo(activePlayback, Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
|
|
50161
|
+
this.isHd = isHd;
|
|
50162
|
+
this.updateHd();
|
|
50163
|
+
});
|
|
50164
|
+
if (activePlayback.levels?.length > 0) {
|
|
50165
|
+
this.onLevelsAvailable(activePlayback.levels);
|
|
50166
|
+
}
|
|
50167
|
+
}
|
|
50168
|
+
updateHd() {
|
|
50169
|
+
if (this.isHd) {
|
|
50170
|
+
this.$el.find('.gear-option_hd-icon').removeClass('hidden');
|
|
50171
|
+
}
|
|
50172
|
+
else {
|
|
50173
|
+
this.$el.find('.gear-option_hd-icon').addClass('hidden');
|
|
50174
|
+
}
|
|
50175
|
+
}
|
|
50176
|
+
onStop() {
|
|
50177
|
+
trace(`${T$5} onStop`);
|
|
50178
|
+
this.listenToOnce(this.core.activePlayback, Events$1.PLAYBACK_PLAY, () => {
|
|
50179
|
+
if (this.core.activePlayback.getPlaybackType() === 'live') {
|
|
50180
|
+
if (this.selectedLevelId !== -1) {
|
|
50181
|
+
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
50182
|
+
}
|
|
50183
|
+
}
|
|
50184
|
+
});
|
|
50185
|
+
}
|
|
50186
|
+
shouldRender() {
|
|
50187
|
+
const activePlayback = this.core.activePlayback;
|
|
50188
|
+
if (!activePlayback) {
|
|
50189
|
+
return false;
|
|
50190
|
+
}
|
|
50191
|
+
const supportsCurrentLevel = 'currentLevel' in activePlayback;
|
|
50192
|
+
if (!supportsCurrentLevel) {
|
|
50193
|
+
return false;
|
|
50194
|
+
}
|
|
50195
|
+
// Only care if we have at least 2 to choose from
|
|
50196
|
+
return !!(this.levels && this.levels.length > 1);
|
|
50197
|
+
}
|
|
50198
|
+
/**
|
|
50199
|
+
* @internal
|
|
50200
|
+
*/
|
|
50201
|
+
render() {
|
|
50202
|
+
if (!this.shouldRender()) {
|
|
50203
|
+
return this;
|
|
50204
|
+
}
|
|
50205
|
+
this.renderDropdown();
|
|
50206
|
+
this.updateButton();
|
|
50207
|
+
return this;
|
|
50208
|
+
}
|
|
50209
|
+
renderDropdown() {
|
|
50210
|
+
this.$el.html(QualityLevels.listTemplate({
|
|
50211
|
+
arrowLeftIcon,
|
|
50212
|
+
checkIcon,
|
|
50213
|
+
current: this.selectedLevelId,
|
|
50214
|
+
labels: this.levelLabels,
|
|
50215
|
+
levels: this.levels,
|
|
50216
|
+
maxLevel: this.maxLevel,
|
|
50217
|
+
removeAuto: this.removeAuto,
|
|
50218
|
+
i18n: this.core.i18n,
|
|
50219
|
+
}));
|
|
50220
|
+
}
|
|
50221
|
+
updateButton() {
|
|
50222
|
+
this.core.getPlugin('bottom_gear')
|
|
50223
|
+
?.addItem('quality', this.$el)
|
|
50224
|
+
.html(QualityLevels.buttonTemplate({
|
|
50225
|
+
arrowRightIcon,
|
|
50226
|
+
currentText: this.currentText,
|
|
50227
|
+
isHd: this.isHd,
|
|
50228
|
+
hdIcon,
|
|
50229
|
+
i18n: this.core.i18n,
|
|
50230
|
+
}));
|
|
50231
|
+
}
|
|
50232
|
+
get pluginOptions() {
|
|
50233
|
+
return (this.core.options.qualityLevels || this.core.options.levelSelector || {});
|
|
50234
|
+
}
|
|
50235
|
+
get maxLevel() {
|
|
50236
|
+
const maxRes = this.pluginOptions.restrictResolution;
|
|
50237
|
+
return maxRes
|
|
50238
|
+
? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
|
|
50239
|
+
maxRes)?.level ?? -1
|
|
50240
|
+
: -1;
|
|
50241
|
+
}
|
|
50242
|
+
onLevelsAvailable(levels) {
|
|
50243
|
+
const maxResolution = this.pluginOptions.restrictResolution;
|
|
50244
|
+
this.levels = levels;
|
|
50245
|
+
this.makeLevelsLabels();
|
|
50246
|
+
if (maxResolution) {
|
|
50247
|
+
this.removeAuto = true;
|
|
50248
|
+
const initialLevel = levels
|
|
50249
|
+
.filter((level) => (level.width > level.height ? level.height : level.width) <=
|
|
50250
|
+
maxResolution)
|
|
50251
|
+
.pop();
|
|
50252
|
+
this.setLevel(initialLevel?.level ?? 0);
|
|
50253
|
+
}
|
|
50254
|
+
this.render();
|
|
50255
|
+
}
|
|
50256
|
+
makeLevelsLabels() {
|
|
50257
|
+
const labels = this.pluginOptions.labels ?? {};
|
|
50258
|
+
this.levelLabels = [];
|
|
50259
|
+
for (const level of this.levels) {
|
|
50260
|
+
const ll = level.width > level.height ? level.height : level.width;
|
|
50261
|
+
const label = labels[ll] || `${ll}p`;
|
|
50262
|
+
this.levelLabels.push(label);
|
|
50263
|
+
}
|
|
50264
|
+
}
|
|
50265
|
+
onSelect(event) {
|
|
50266
|
+
const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
|
|
50267
|
+
this.setLevel(selectedLevel);
|
|
50268
|
+
event.stopPropagation();
|
|
50269
|
+
event.preventDefault();
|
|
50270
|
+
return false;
|
|
50271
|
+
}
|
|
50272
|
+
goBack() {
|
|
50273
|
+
trace(`${T$5} goBack`);
|
|
50274
|
+
this.core.getPlugin('bottom_gear').refresh();
|
|
50275
|
+
}
|
|
50276
|
+
setLevel(index) {
|
|
50277
|
+
this.selectedLevelId = index;
|
|
50278
|
+
this.core.activePlayback.currentLevel = this.selectedLevelId;
|
|
50279
|
+
this.highlightCurrentLevel();
|
|
50280
|
+
}
|
|
50281
|
+
allLevelElements() {
|
|
50282
|
+
return this.$('#level-selector-menu li');
|
|
50283
|
+
}
|
|
50284
|
+
levelElement(id = -1) {
|
|
50285
|
+
return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
|
|
50286
|
+
}
|
|
50287
|
+
onLevelSwitchStart() {
|
|
50288
|
+
this.levelElement(this.selectedLevelId).addClass('changing');
|
|
50289
|
+
}
|
|
50290
|
+
onLevelSwitchEnd() {
|
|
50291
|
+
this.levelElement(this.selectedLevelId).removeClass('changing');
|
|
50292
|
+
}
|
|
50293
|
+
updateText(level) {
|
|
50294
|
+
this.currentText = this.getLevelLabel(level);
|
|
50295
|
+
this.updateButton();
|
|
50296
|
+
}
|
|
50297
|
+
getLevelLabel(id) {
|
|
50298
|
+
if (id < 0) {
|
|
50299
|
+
return this.core.i18n.t('auto');
|
|
50300
|
+
}
|
|
50301
|
+
const index = this.levels.findIndex((l) => l.level === id);
|
|
50302
|
+
if (index < 0) {
|
|
50303
|
+
return this.core.i18n.t('auto');
|
|
50304
|
+
}
|
|
50305
|
+
return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
|
|
50306
|
+
}
|
|
50307
|
+
onBitrate(info) {
|
|
50308
|
+
trace(`${T$5} updateCurrentLevel`, { info });
|
|
50309
|
+
this.highlightCurrentLevel();
|
|
50310
|
+
}
|
|
50311
|
+
highlightCurrentLevel() {
|
|
50312
|
+
trace(`${T$5} highlightCurrentLevel`, {
|
|
50313
|
+
selectedLevelId: this.selectedLevelId,
|
|
50314
|
+
});
|
|
50315
|
+
this.allLevelElements()
|
|
50316
|
+
.removeClass('current')
|
|
50317
|
+
.find('a')
|
|
50318
|
+
.removeClass('gcore-skin-active');
|
|
50319
|
+
const currentLevelElement = this.levelElement(this.selectedLevelId);
|
|
50320
|
+
currentLevelElement
|
|
50321
|
+
.addClass('current')
|
|
50322
|
+
.find('a')
|
|
50323
|
+
.addClass('gcore-skin-active');
|
|
50324
|
+
this.updateText(this.selectedLevelId);
|
|
50325
|
+
}
|
|
50326
|
+
}
|
|
50327
|
+
function formatLevelLabel(level) {
|
|
50328
|
+
const h = level.width > level.height ? level.height : level.width;
|
|
50329
|
+
return `${h}p`;
|
|
50330
|
+
}
|
|
50331
|
+
|
|
50329
50332
|
const seekTimeHTML = "<span data-seek-time></span>\n<span data-duration></span>\n";
|
|
50330
50333
|
|
|
50331
50334
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
@@ -52292,4 +52295,4 @@ class VolumeFade extends UICorePlugin {
|
|
|
52292
52295
|
}
|
|
52293
52296
|
}
|
|
52294
52297
|
|
|
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 };
|
|
52298
|
+
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 };
|