@gcorevideo/player 2.24.13 → 2.25.0
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/clips/clips.ejs +1 -1
- package/assets/clips/clips.scss +7 -5
- package/assets/dvr-controls/dvr_controls.scss +19 -20
- package/assets/media-control/width370.scss +3 -5
- package/dist/core.js +1 -1
- package/dist/index.css +689 -693
- package/dist/index.embed.js +172 -101
- package/dist/index.js +150 -78
- package/dist/player.d.ts +106 -42
- package/docs/api/player.md +18 -20
- package/docs/api/player.mediacontrol.defaultsettings.md +32 -0
- package/docs/api/player.mediacontrol.extendsettings.md +77 -0
- package/docs/api/player.mediacontrol.md +31 -11
- package/docs/api/player.mediacontrol.mount.md +8 -8
- package/docs/api/player.mediacontrol.slot.md +97 -0
- package/docs/api/player.mediacontrolelement.md +6 -3
- package/docs/api/player.mediacontrolpluginsettings.md +13 -0
- package/docs/api/player.mediacontrolsettings.md +5 -5
- package/docs/api/{player.mediacontrol.enablecontrolbutton.md → player.mediacontrolslotmountpoint.md} +4 -8
- package/docs/api/{player.mediacontrol.disabledcontrolbutton.md → player.standardmediacontrolelement.md} +4 -8
- package/lib/plugins/clips/Clips.d.ts +1 -0
- package/lib/plugins/clips/Clips.d.ts.map +1 -1
- package/lib/plugins/clips/Clips.js +16 -2
- package/lib/plugins/dvr-controls/DvrControls.js +1 -1
- package/lib/plugins/media-control/MediaControl.d.ts +87 -34
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +121 -76
- package/package.json +1 -1
- package/src/plugins/clips/Clips.ts +17 -2
- package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
- package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +1 -1
- package/src/plugins/dvr-controls/DvrControls.ts +1 -1
- package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +1 -1
- package/src/plugins/media-control/MediaControl.ts +170 -141
- package/src/plugins/media-control/__tests__/MediaControl.test.ts +24 -17
- package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +125 -93
- package/temp/player.api.json +186 -108
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.mediacontrollayerelement.md +0 -16
- package/docs/api/player.mediacontrolleftelement.md +0 -16
- package/docs/api/player.mediacontrolrightelement.md +0 -16
package/dist/index.js
CHANGED
|
@@ -43314,7 +43314,7 @@ class Player {
|
|
|
43314
43314
|
}
|
|
43315
43315
|
}
|
|
43316
43316
|
|
|
43317
|
-
var version$1 = "2.
|
|
43317
|
+
var version$1 = "2.25.0";
|
|
43318
43318
|
|
|
43319
43319
|
var packages = {
|
|
43320
43320
|
"node_modules/@clappr/core": {
|
|
@@ -43622,16 +43622,27 @@ const fullscreenOnIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"
|
|
|
43622
43622
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
43623
43623
|
// Use of this source code is governed by a BSD-style
|
|
43624
43624
|
// license that can be found in the {@link https://github.com/clappr/clappr-plugins/blob/master/LICENSE | LICENSE}.
|
|
43625
|
+
const STANDARD_MEDIA_CONTROL_ELEMENTS = [
|
|
43626
|
+
'duration',
|
|
43627
|
+
'fullscreen',
|
|
43628
|
+
'hd-indicator',
|
|
43629
|
+
'playpause',
|
|
43630
|
+
'playstop',
|
|
43631
|
+
'position',
|
|
43632
|
+
'seekbar',
|
|
43633
|
+
'volume',
|
|
43634
|
+
];
|
|
43635
|
+
// TODO export
|
|
43625
43636
|
const DEFAULT_SETTINGS = {
|
|
43637
|
+
default: ['seekbar'],
|
|
43638
|
+
left: ['playpause', 'playstop', 'position', 'duration', 'volume'],
|
|
43626
43639
|
right: [
|
|
43627
|
-
'
|
|
43628
|
-
'
|
|
43640
|
+
'*',
|
|
43641
|
+
// 'hd-indicator',
|
|
43629
43642
|
'fullscreen',
|
|
43630
|
-
|
|
43631
|
-
|
|
43632
|
-
|
|
43633
|
-
'vr',
|
|
43634
|
-
]};
|
|
43643
|
+
],
|
|
43644
|
+
seekEnabled: true,
|
|
43645
|
+
};
|
|
43635
43646
|
const INITIAL_SETTINGS = {
|
|
43636
43647
|
left: [],
|
|
43637
43648
|
right: [],
|
|
@@ -43639,14 +43650,6 @@ const INITIAL_SETTINGS = {
|
|
|
43639
43650
|
seekEnabled: false,
|
|
43640
43651
|
};
|
|
43641
43652
|
const T$k = 'plugins.media_control';
|
|
43642
|
-
const LEFT_ORDER = [
|
|
43643
|
-
'playpause',
|
|
43644
|
-
'playstop',
|
|
43645
|
-
'volume',
|
|
43646
|
-
'position',
|
|
43647
|
-
'duration',
|
|
43648
|
-
'dvr',
|
|
43649
|
-
];
|
|
43650
43653
|
/**
|
|
43651
43654
|
* Extended events for the {@link MediaControl} plugin
|
|
43652
43655
|
* @beta
|
|
@@ -43657,25 +43660,21 @@ var ExtendedEvents;
|
|
|
43657
43660
|
ExtendedEvents["MEDIACONTROL_MENU_COLLAPSE"] = "mediacontrol:menu:collapse";
|
|
43658
43661
|
})(ExtendedEvents || (ExtendedEvents = {}));
|
|
43659
43662
|
const { Config, Fullscreen, formatTime: formatTime$1, extend, removeArrayItem } = Utils;
|
|
43660
|
-
function orderByOrderPattern(arr, order) {
|
|
43661
|
-
const arrWithoutDuplicates = [...new Set(arr)];
|
|
43662
|
-
const ordered = order.filter((item) => arrWithoutDuplicates.includes(item));
|
|
43663
|
-
const rest = arrWithoutDuplicates.filter((item) => !order.includes(item));
|
|
43664
|
-
return [...ordered, ...rest];
|
|
43665
|
-
}
|
|
43666
43663
|
/**
|
|
43667
|
-
* `PLUGIN` that provides
|
|
43664
|
+
* `PLUGIN` that provides framework for building media control UI.
|
|
43668
43665
|
* @beta
|
|
43669
43666
|
* @remarks
|
|
43670
43667
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
43671
43668
|
*
|
|
43672
|
-
* Configuration options
|
|
43669
|
+
* Configuration options (root level)
|
|
43670
|
+
*
|
|
43671
|
+
* - `hideMediaControlDelay`: number - specifies the delay in milliseconds before the media control UI is hidden after the last user interaction
|
|
43673
43672
|
*
|
|
43674
|
-
* - `mediaControl`: {@link MediaControlSettings} - specifies the
|
|
43673
|
+
* - `mediaControl`: {@link MediaControlSettings} - specifies the media control dashboard layout
|
|
43675
43674
|
*
|
|
43676
43675
|
* - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
|
|
43677
43676
|
*
|
|
43678
|
-
* - `chromeless`: boolean
|
|
43677
|
+
* - `chromeless`: boolean - `common` option, hides the media control UI
|
|
43679
43678
|
*/
|
|
43680
43679
|
class MediaControl extends UICorePlugin {
|
|
43681
43680
|
// private advertisementPlaying = false
|
|
@@ -43683,7 +43682,7 @@ class MediaControl extends UICorePlugin {
|
|
|
43683
43682
|
currentDurationValue = 0;
|
|
43684
43683
|
currentPositionValue = 0;
|
|
43685
43684
|
currentSeekBarPercentage = 0;
|
|
43686
|
-
disabledClickableList = []
|
|
43685
|
+
// private disabledClickableList: DisabledClickable[] = []
|
|
43687
43686
|
displayedDuration = null;
|
|
43688
43687
|
displayedPosition = null;
|
|
43689
43688
|
displayedSeekBarPercentage = null;
|
|
@@ -43708,7 +43707,6 @@ class MediaControl extends UICorePlugin {
|
|
|
43708
43707
|
verticalVolume = false;
|
|
43709
43708
|
$duration = null;
|
|
43710
43709
|
$fullscreenToggle = null;
|
|
43711
|
-
$multiCameraSelector = null;
|
|
43712
43710
|
$playPauseToggle = null;
|
|
43713
43711
|
$playStopToggle = null;
|
|
43714
43712
|
$position = null;
|
|
@@ -43736,6 +43734,46 @@ class MediaControl extends UICorePlugin {
|
|
|
43736
43734
|
get supportedVersion() {
|
|
43737
43735
|
return { min: CLAPPR_VERSION$1 };
|
|
43738
43736
|
}
|
|
43737
|
+
/**
|
|
43738
|
+
* @returns Default media control layout settings
|
|
43739
|
+
* @remark
|
|
43740
|
+
* The method can be used to change the default dashboard layout, for example, removing the standard UI elements
|
|
43741
|
+
* @example
|
|
43742
|
+
* ```ts
|
|
43743
|
+
* const settings = MediaControl.defaultSettings()
|
|
43744
|
+
* settings.left = settings.filter(item => item !== 'playpause' && item !== 'playstop')
|
|
43745
|
+
* ...
|
|
43746
|
+
* new Player({
|
|
43747
|
+
* mediaControl: settings,
|
|
43748
|
+
* })
|
|
43749
|
+
* ```
|
|
43750
|
+
*/
|
|
43751
|
+
static defaultSettings() {
|
|
43752
|
+
return $.extend(true, {}, DEFAULT_SETTINGS);
|
|
43753
|
+
}
|
|
43754
|
+
/**
|
|
43755
|
+
* Extend the default media control layout settings
|
|
43756
|
+
* @param settings - Additional settings
|
|
43757
|
+
* @returns The extended settings
|
|
43758
|
+
* @remarks
|
|
43759
|
+
* This method allows adding custom elements to the media control dashboard.
|
|
43760
|
+
* The default settings are not modified.
|
|
43761
|
+
* @example
|
|
43762
|
+
* ```ts
|
|
43763
|
+
* new Player({
|
|
43764
|
+
* mediaControl: MediaControl.extendSettings({
|
|
43765
|
+
* left: ['*'], // add all custom elements to the left panel
|
|
43766
|
+
* }),
|
|
43767
|
+
* })
|
|
43768
|
+
* ```
|
|
43769
|
+
*/
|
|
43770
|
+
static extendSettings(settings) {
|
|
43771
|
+
return {
|
|
43772
|
+
left: mergeElements(DEFAULT_SETTINGS.left, settings.left ?? []),
|
|
43773
|
+
right: mergeElements(DEFAULT_SETTINGS.right, settings.right ?? []),
|
|
43774
|
+
default: mergeElements(DEFAULT_SETTINGS.default, settings.default ?? []),
|
|
43775
|
+
};
|
|
43776
|
+
}
|
|
43739
43777
|
get disabled() {
|
|
43740
43778
|
const playbackIsNOOP = this.core.activeContainer &&
|
|
43741
43779
|
this.core.activeContainer.getPlaybackType() === Playback.NO_OP;
|
|
@@ -43999,9 +44037,7 @@ class MediaControl extends UICorePlugin {
|
|
|
43999
44037
|
this.applyButtonStyle(this.$volumeIcon);
|
|
44000
44038
|
}
|
|
44001
44039
|
changeTogglePlay() {
|
|
44002
|
-
// assert.ok(this.$playPauseToggle, 'play/pause toggle must be present');
|
|
44003
44040
|
this.$playPauseToggle?.html('');
|
|
44004
|
-
// assert.ok(this.$playStopToggle, 'play/stop toggle must be present');
|
|
44005
44041
|
this.$playStopToggle?.html('');
|
|
44006
44042
|
if (this.container && this.container.isPlaying()) {
|
|
44007
44043
|
this.$playPauseToggle?.append(pauseIcon);
|
|
@@ -44367,36 +44403,32 @@ class MediaControl extends UICorePlugin {
|
|
|
44367
44403
|
}
|
|
44368
44404
|
}
|
|
44369
44405
|
updateSettings() {
|
|
44370
|
-
|
|
44406
|
+
// TODO use this.options.mediaControl to additionally filter the settings
|
|
44407
|
+
const container = $.extend(true, {
|
|
44371
44408
|
left: [],
|
|
44372
44409
|
default: [],
|
|
44373
44410
|
right: [],
|
|
44374
44411
|
}, this.core.activeContainer.settings);
|
|
44375
|
-
|
|
44376
|
-
|
|
44377
|
-
newSettings.left = orderByOrderPattern([...newSettings.left, 'volume', 'clips'], LEFT_ORDER);
|
|
44378
|
-
if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
|
|
44379
|
-
this.core.activePlayback.dvrEnabled) {
|
|
44380
|
-
newSettings.left.push('dvr');
|
|
44381
|
-
}
|
|
44382
|
-
// actual order of the items appear rendered is controlled by CSS
|
|
44383
|
-
newSettings.right = DEFAULT_SETTINGS.right; // TODO get from the options
|
|
44412
|
+
container.left.push('volume');
|
|
44413
|
+
const setup = this.options.mediaControl ?? DEFAULT_SETTINGS;
|
|
44384
44414
|
if ((!this.fullScreenOnVideoTagSupported && !fullscreenEnabled()) ||
|
|
44385
44415
|
this.options.fullscreenDisable) {
|
|
44386
44416
|
// remove fullscreen from settings if it is not available
|
|
44387
|
-
removeArrayItem(
|
|
44388
|
-
removeArrayItem(
|
|
44389
|
-
removeArrayItem(
|
|
44417
|
+
removeArrayItem(container.default, 'fullscreen');
|
|
44418
|
+
removeArrayItem(container.left, 'fullscreen');
|
|
44419
|
+
removeArrayItem(container.right, 'fullscreen');
|
|
44390
44420
|
}
|
|
44391
|
-
removeArrayItem(newSettings.default, 'hd-indicator');
|
|
44392
|
-
removeArrayItem(newSettings.left, 'hd-indicator');
|
|
44393
44421
|
// TODO get from container's settings
|
|
44394
44422
|
if (this.core.activePlayback.name === 'html5_video') {
|
|
44395
|
-
|
|
44423
|
+
container.seekEnabled = this.isSeekEnabledForHtml5Playback();
|
|
44424
|
+
// TODO remove seekbar if seek is disabled?
|
|
44396
44425
|
}
|
|
44397
|
-
|
|
44426
|
+
container.left = evalSettings(container.left, setup.left);
|
|
44427
|
+
container.right = evalSettings(container.right, setup.right);
|
|
44428
|
+
container.default = evalSettings(container.default, setup.default);
|
|
44429
|
+
const settingsChanged = !isEqualSettings(this.settings, container);
|
|
44398
44430
|
if (settingsChanged) {
|
|
44399
|
-
this.settings =
|
|
44431
|
+
this.settings = container;
|
|
44400
44432
|
this.hasUpdate = true;
|
|
44401
44433
|
this.render();
|
|
44402
44434
|
}
|
|
@@ -44422,15 +44454,37 @@ class MediaControl extends UICorePlugin {
|
|
|
44422
44454
|
this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]');
|
|
44423
44455
|
this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]');
|
|
44424
44456
|
this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]');
|
|
44425
|
-
this.$multiCameraSelector = this.$el.find('.media-control-multicamera[data-multicamera]');
|
|
44426
44457
|
this.resetIndicators();
|
|
44427
44458
|
this.initializeIcons();
|
|
44428
44459
|
}
|
|
44429
44460
|
/**
|
|
44430
|
-
*
|
|
44461
|
+
* Mount a media control to its configured location
|
|
44431
44462
|
* @param name - The name of the media control element
|
|
44432
44463
|
* @param element - The DOM node/fragment to mount
|
|
44433
|
-
* @
|
|
44464
|
+
* @remarks
|
|
44465
|
+
* Media controls layout is configured via {@link MediaControlSettings}.
|
|
44466
|
+
* A plugin implementing custom elements on the media control dashboard,
|
|
44467
|
+
* should use this method to mount the element to the correct location.
|
|
44468
|
+
* The actual location is defined by the occurence of the element token in the `left`, `right` or `default` section
|
|
44469
|
+
* of the {@link MediaControlSettings}.
|
|
44470
|
+
* @example
|
|
44471
|
+
* ```ts
|
|
44472
|
+
* class MyPlugin extends UICorePlugin {
|
|
44473
|
+
* override render() {
|
|
44474
|
+
* // mount the element where it is configured in the layout
|
|
44475
|
+
* this.core.getPlugin('media_control').slot('my-element', this.$el)
|
|
44476
|
+
* }
|
|
44477
|
+
* }
|
|
44478
|
+
* ...
|
|
44479
|
+
* Player.registerPlugin(MyPlugin)
|
|
44480
|
+
* ...
|
|
44481
|
+
* // Configuration of the media control layout
|
|
44482
|
+
* new Player({
|
|
44483
|
+
* mediaControl: {
|
|
44484
|
+
* left: ['my-element'], // the element will be mounted to the left panel
|
|
44485
|
+
* },
|
|
44486
|
+
* })
|
|
44487
|
+
* ```
|
|
44434
44488
|
*/
|
|
44435
44489
|
slot(name, element) {
|
|
44436
44490
|
const panel = this.getElementLocation(name);
|
|
@@ -44650,7 +44704,6 @@ class MediaControl extends UICorePlugin {
|
|
|
44650
44704
|
return this;
|
|
44651
44705
|
}
|
|
44652
44706
|
const timeout = this.options.hideMediaControlDelay || 2000;
|
|
44653
|
-
trace(`${T$k} render`, { settings: this.settings });
|
|
44654
44707
|
this.$el.html(MediaControl.template({ settings: this.settings }));
|
|
44655
44708
|
// const style = Styler.getStyleFor(mediaControlStyle, { baseUrl: this.options.baseUrl });
|
|
44656
44709
|
// this.$el.append(style[0]);
|
|
@@ -44747,22 +44800,6 @@ class MediaControl extends UICorePlugin {
|
|
|
44747
44800
|
}
|
|
44748
44801
|
return 0;
|
|
44749
44802
|
}
|
|
44750
|
-
/**
|
|
44751
|
-
* Enable the user interaction disabled earlier
|
|
44752
|
-
*/
|
|
44753
|
-
enableControlButton() {
|
|
44754
|
-
this.disabledClickableList.forEach((element) => {
|
|
44755
|
-
element.el.css({ 'pointer-events': element.pointerEventValue });
|
|
44756
|
-
});
|
|
44757
|
-
}
|
|
44758
|
-
/**
|
|
44759
|
-
* Disable the user interaction for the control buttons
|
|
44760
|
-
*/
|
|
44761
|
-
disabledControlButton() {
|
|
44762
|
-
this.disabledClickableList.forEach((element) => {
|
|
44763
|
-
element.el.css({ 'pointer-events': 'none' });
|
|
44764
|
-
});
|
|
44765
|
-
}
|
|
44766
44803
|
// TODO drop
|
|
44767
44804
|
isSeekEnabledForHtml5Playback() {
|
|
44768
44805
|
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
@@ -44771,13 +44808,14 @@ class MediaControl extends UICorePlugin {
|
|
|
44771
44808
|
return isFinite(this.core.activePlayback.getDuration());
|
|
44772
44809
|
}
|
|
44773
44810
|
getElementLocation(name) {
|
|
44774
|
-
if (this.settings.
|
|
44775
|
-
return this.getRightPanel();
|
|
44776
|
-
}
|
|
44777
|
-
if (this.settings.left?.includes(name)) {
|
|
44811
|
+
if (this.settings.left.includes(name) || this.settings.left.includes('*')) {
|
|
44778
44812
|
return this.getLeftPanel();
|
|
44779
44813
|
}
|
|
44780
|
-
if (this.settings.
|
|
44814
|
+
if (this.settings.right.includes(name) ||
|
|
44815
|
+
this.settings.right.includes('*')) {
|
|
44816
|
+
return this.getRightPanel();
|
|
44817
|
+
}
|
|
44818
|
+
if (this.settings.default.includes(name)) {
|
|
44781
44819
|
return this.getCenterPanel();
|
|
44782
44820
|
}
|
|
44783
44821
|
return null;
|
|
@@ -44795,7 +44833,8 @@ MediaControl.extend = function (properties) {
|
|
|
44795
44833
|
return extend(MediaControl, properties);
|
|
44796
44834
|
};
|
|
44797
44835
|
function serializeSettings(s) {
|
|
44798
|
-
return s.left
|
|
44836
|
+
return s.left
|
|
44837
|
+
.slice()
|
|
44799
44838
|
.sort()
|
|
44800
44839
|
.concat(s.right.slice().sort())
|
|
44801
44840
|
.concat(s.default.slice().sort())
|
|
@@ -44810,6 +44849,25 @@ function mountTo(parent, element) {
|
|
|
44810
44849
|
parent.append(element);
|
|
44811
44850
|
}
|
|
44812
44851
|
}
|
|
44852
|
+
function isStandardMediaControl(name) {
|
|
44853
|
+
return STANDARD_MEDIA_CONTROL_ELEMENTS.includes(name);
|
|
44854
|
+
}
|
|
44855
|
+
function evalSettings(container, setup) {
|
|
44856
|
+
return setup.filter((item) => {
|
|
44857
|
+
if (isStandardMediaControl(item)) {
|
|
44858
|
+
return container.includes(item);
|
|
44859
|
+
}
|
|
44860
|
+
return true;
|
|
44861
|
+
});
|
|
44862
|
+
}
|
|
44863
|
+
function mergeElements(a, b) {
|
|
44864
|
+
return b.reduce((acc, item) => {
|
|
44865
|
+
if (!acc.includes(item)) {
|
|
44866
|
+
acc.push(item);
|
|
44867
|
+
}
|
|
44868
|
+
return acc;
|
|
44869
|
+
}, a);
|
|
44870
|
+
}
|
|
44813
44871
|
|
|
44814
44872
|
const VERSION$7 = '2.22.4';
|
|
44815
44873
|
const T$j = 'plugins.audiotracks';
|
|
@@ -48490,11 +48548,12 @@ function buildSvg(clips, duration, barWidth) {
|
|
|
48490
48548
|
return svg;
|
|
48491
48549
|
}
|
|
48492
48550
|
|
|
48493
|
-
const clipsHTML = "<div class=\"
|
|
48551
|
+
const clipsHTML = "<div class=\"gplayer-mc-clips-text\" id=\"gplayer-mc-clips-text\"></div>";
|
|
48494
48552
|
|
|
48495
48553
|
const T$e = 'plugins.clips';
|
|
48496
48554
|
const VERSION$5 = '2.22.16';
|
|
48497
48555
|
const CLAPPR_VERSION = '0.11.4';
|
|
48556
|
+
const COMPACT_WIDTH = 495;
|
|
48498
48557
|
/**
|
|
48499
48558
|
* `PLUGIN` that allows marking up the timeline of the video
|
|
48500
48559
|
* @beta
|
|
@@ -48524,7 +48583,7 @@ class Clips extends UICorePlugin {
|
|
|
48524
48583
|
*/
|
|
48525
48584
|
get attributes() {
|
|
48526
48585
|
return {
|
|
48527
|
-
class: 'media-control-clips',
|
|
48586
|
+
class: 'media-control-clips gplayer-mc-clips',
|
|
48528
48587
|
};
|
|
48529
48588
|
}
|
|
48530
48589
|
get version() {
|
|
@@ -48592,6 +48651,7 @@ class Clips extends UICorePlugin {
|
|
|
48592
48651
|
onContainerChanged() {
|
|
48593
48652
|
trace(`${T$e} onContainerChanged`);
|
|
48594
48653
|
// TODO figure out the conditions of changing the container (without destroying the previous one)
|
|
48654
|
+
// probably it is the case with the MultiCamera plugin
|
|
48595
48655
|
if (this.oldContainer) {
|
|
48596
48656
|
this.stopListening(this.oldContainer, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
48597
48657
|
}
|
|
@@ -48601,12 +48661,24 @@ class Clips extends UICorePlugin {
|
|
|
48601
48661
|
this.svgMask = null;
|
|
48602
48662
|
}
|
|
48603
48663
|
this.listenTo(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
48664
|
+
this.toggleCompact();
|
|
48604
48665
|
}
|
|
48605
48666
|
playerResize() {
|
|
48606
48667
|
const duration = this.core.activeContainer.getDuration();
|
|
48668
|
+
// TODO check
|
|
48607
48669
|
if (duration) {
|
|
48608
48670
|
this.makeSvg(duration);
|
|
48609
48671
|
}
|
|
48672
|
+
this.toggleCompact();
|
|
48673
|
+
}
|
|
48674
|
+
toggleCompact() {
|
|
48675
|
+
const elText = this.$el.find('#gplayer-mc-clips-text');
|
|
48676
|
+
if (this.core.activeContainer.el.clientWidth <= COMPACT_WIDTH) {
|
|
48677
|
+
elText.addClass('compact');
|
|
48678
|
+
}
|
|
48679
|
+
else {
|
|
48680
|
+
elText.removeClass('compact');
|
|
48681
|
+
}
|
|
48610
48682
|
}
|
|
48611
48683
|
onTimeUpdate(event) {
|
|
48612
48684
|
if (!this.svgMask) {
|
|
@@ -48644,7 +48716,7 @@ class Clips extends UICorePlugin {
|
|
|
48644
48716
|
}
|
|
48645
48717
|
setClipText(text) {
|
|
48646
48718
|
if (text) {
|
|
48647
|
-
this.$el.show().find('#clips-text').text(text);
|
|
48719
|
+
this.$el.show().find('#gplayer-mc-clips-text').text(text);
|
|
48648
48720
|
}
|
|
48649
48721
|
else {
|
|
48650
48722
|
this.$el.hide();
|
|
@@ -48863,7 +48935,7 @@ class DvrControls extends UICorePlugin {
|
|
|
48863
48935
|
// TODO -> to MediaControl (auto hide)
|
|
48864
48936
|
mediaControl.toggleElement('duration', false);
|
|
48865
48937
|
mediaControl.toggleElement('position', false);
|
|
48866
|
-
mediaControl.
|
|
48938
|
+
mediaControl.slot('dvr', this.$el); // TODO use independent mount point
|
|
48867
48939
|
}
|
|
48868
48940
|
onDvrStateChanged(dvrInUse) {
|
|
48869
48941
|
this.toggleState(dvrInUse);
|
package/dist/player.d.ts
CHANGED
|
@@ -575,6 +575,7 @@ export declare class Clips extends UICorePlugin {
|
|
|
575
575
|
private onMcRender;
|
|
576
576
|
private onContainerChanged;
|
|
577
577
|
private playerResize;
|
|
578
|
+
private toggleCompact;
|
|
578
579
|
private onTimeUpdate;
|
|
579
580
|
private parseClips;
|
|
580
581
|
private makeSvg;
|
|
@@ -912,6 +913,7 @@ export declare class DvrControls extends UICorePlugin {
|
|
|
912
913
|
*/
|
|
913
914
|
get attributes(): {
|
|
914
915
|
class: string;
|
|
916
|
+
'data-dvr': string;
|
|
915
917
|
};
|
|
916
918
|
/**
|
|
917
919
|
* @internal
|
|
@@ -1177,25 +1179,26 @@ export declare class Logo extends UIContainerPlugin {
|
|
|
1177
1179
|
export { LogTracer }
|
|
1178
1180
|
|
|
1179
1181
|
/**
|
|
1180
|
-
* `PLUGIN` that provides
|
|
1182
|
+
* `PLUGIN` that provides framework for building media control UI.
|
|
1181
1183
|
* @beta
|
|
1182
1184
|
* @remarks
|
|
1183
1185
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
1184
1186
|
*
|
|
1185
|
-
* Configuration options
|
|
1187
|
+
* Configuration options (root level)
|
|
1186
1188
|
*
|
|
1187
|
-
* - `
|
|
1189
|
+
* - `hideMediaControlDelay`: number - specifies the delay in milliseconds before the media control UI is hidden after the last user interaction
|
|
1190
|
+
*
|
|
1191
|
+
* - `mediaControl`: {@link MediaControlSettings} - specifies the media control dashboard layout
|
|
1188
1192
|
*
|
|
1189
1193
|
* - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
|
|
1190
1194
|
*
|
|
1191
|
-
* - `chromeless`: boolean
|
|
1195
|
+
* - `chromeless`: boolean - `common` option, hides the media control UI
|
|
1192
1196
|
*/
|
|
1193
1197
|
export declare class MediaControl extends UICorePlugin {
|
|
1194
1198
|
private buttonsColor;
|
|
1195
1199
|
private currentDurationValue;
|
|
1196
1200
|
private currentPositionValue;
|
|
1197
1201
|
private currentSeekBarPercentage;
|
|
1198
|
-
private disabledClickableList;
|
|
1199
1202
|
private displayedDuration;
|
|
1200
1203
|
private displayedPosition;
|
|
1201
1204
|
private displayedSeekBarPercentage;
|
|
@@ -1220,7 +1223,6 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
1220
1223
|
private verticalVolume;
|
|
1221
1224
|
private $duration;
|
|
1222
1225
|
private $fullscreenToggle;
|
|
1223
|
-
private $multiCameraSelector;
|
|
1224
1226
|
private $playPauseToggle;
|
|
1225
1227
|
private $playStopToggle;
|
|
1226
1228
|
private $position;
|
|
@@ -1246,6 +1248,42 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
1246
1248
|
get supportedVersion(): {
|
|
1247
1249
|
min: string;
|
|
1248
1250
|
};
|
|
1251
|
+
/**
|
|
1252
|
+
* @returns Default media control layout settings
|
|
1253
|
+
* @remark
|
|
1254
|
+
* The method can be used to change the default dashboard layout, for example, removing the standard UI elements
|
|
1255
|
+
* @example
|
|
1256
|
+
* ```ts
|
|
1257
|
+
* const settings = MediaControl.defaultSettings()
|
|
1258
|
+
* settings.left = settings.filter(item => item !== 'playpause' && item !== 'playstop')
|
|
1259
|
+
* ...
|
|
1260
|
+
* new Player({
|
|
1261
|
+
* mediaControl: settings,
|
|
1262
|
+
* })
|
|
1263
|
+
* ```
|
|
1264
|
+
*/
|
|
1265
|
+
static defaultSettings(): any;
|
|
1266
|
+
/**
|
|
1267
|
+
* Extend the default media control layout settings
|
|
1268
|
+
* @param settings - Additional settings
|
|
1269
|
+
* @returns The extended settings
|
|
1270
|
+
* @remarks
|
|
1271
|
+
* This method allows adding custom elements to the media control dashboard.
|
|
1272
|
+
* The default settings are not modified.
|
|
1273
|
+
* @example
|
|
1274
|
+
* ```ts
|
|
1275
|
+
* new Player({
|
|
1276
|
+
* mediaControl: MediaControl.extendSettings({
|
|
1277
|
+
* left: ['*'], // add all custom elements to the left panel
|
|
1278
|
+
* }),
|
|
1279
|
+
* })
|
|
1280
|
+
* ```
|
|
1281
|
+
*/
|
|
1282
|
+
static extendSettings(settings: Partial<MediaControlSettings>): {
|
|
1283
|
+
left: string[];
|
|
1284
|
+
right: string[];
|
|
1285
|
+
default: string[];
|
|
1286
|
+
};
|
|
1249
1287
|
private get disabled();
|
|
1250
1288
|
/**
|
|
1251
1289
|
* Use in mediacontrol-based plugins to access the active container
|
|
@@ -1379,23 +1417,54 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
1379
1417
|
private onHdUpdate;
|
|
1380
1418
|
private createCachedElements;
|
|
1381
1419
|
/**
|
|
1382
|
-
*
|
|
1420
|
+
* Mount a media control to its configured location
|
|
1383
1421
|
* @param name - The name of the media control element
|
|
1384
|
-
* @
|
|
1422
|
+
* @param element - The DOM node/fragment to mount
|
|
1423
|
+
* @remarks
|
|
1424
|
+
* Media controls layout is configured via {@link MediaControlSettings}.
|
|
1425
|
+
* A plugin implementing custom elements on the media control dashboard,
|
|
1426
|
+
* should use this method to mount the element to the correct location.
|
|
1427
|
+
* The actual location is defined by the occurence of the element token in the `left`, `right` or `default` section
|
|
1428
|
+
* of the {@link MediaControlSettings}.
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* class MyPlugin extends UICorePlugin {
|
|
1432
|
+
* override render() {
|
|
1433
|
+
* // mount the element where it is configured in the layout
|
|
1434
|
+
* this.core.getPlugin('media_control').slot('my-element', this.$el)
|
|
1435
|
+
* }
|
|
1436
|
+
* }
|
|
1437
|
+
* ...
|
|
1438
|
+
* Player.registerPlugin(MyPlugin)
|
|
1439
|
+
* ...
|
|
1440
|
+
* // Configuration of the media control layout
|
|
1441
|
+
* new Player({
|
|
1442
|
+
* mediaControl: {
|
|
1443
|
+
* left: ['my-element'], // the element will be mounted to the left panel
|
|
1444
|
+
* },
|
|
1445
|
+
* })
|
|
1446
|
+
* ```
|
|
1447
|
+
*/
|
|
1448
|
+
slot(name: MediaControlElement, element: ZeptoResult): void;
|
|
1449
|
+
/**
|
|
1450
|
+
* Mounts a media control element at a specific location
|
|
1451
|
+
* @param name - The location to mount the element
|
|
1452
|
+
* @param element - The element to mount
|
|
1385
1453
|
* @remarks
|
|
1386
1454
|
* Use this method to render custom media control UI in a plugin
|
|
1387
1455
|
* @example
|
|
1388
1456
|
* ```ts
|
|
1389
1457
|
* class MyPlugin extends UICorePlugin {
|
|
1390
1458
|
* override render() {
|
|
1391
|
-
* this.$el.html('<div
|
|
1392
|
-
* this.core.getPlugin('media_control').mount('
|
|
1459
|
+
* this.$el.html('<div id="my-element" class="my-class">Here we go</div>')
|
|
1460
|
+
* this.core.getPlugin('media_control').mount('left', this.$el)
|
|
1393
1461
|
* return this
|
|
1394
1462
|
* }
|
|
1395
1463
|
* }
|
|
1396
1464
|
* ```
|
|
1397
1465
|
*/
|
|
1398
|
-
mount(name:
|
|
1466
|
+
mount(name: MediaControlSlotMountPoint, element: ZeptoResult): void;
|
|
1467
|
+
private getMountParent;
|
|
1399
1468
|
/**
|
|
1400
1469
|
* Toggle the visibility of a media control element
|
|
1401
1470
|
* @param name - The name of the media control element
|
|
@@ -1430,54 +1499,43 @@ export declare class MediaControl extends UICorePlugin {
|
|
|
1430
1499
|
private hideControllAds;
|
|
1431
1500
|
private static getPageX;
|
|
1432
1501
|
private static getPageY;
|
|
1433
|
-
/**
|
|
1434
|
-
* Enable the user interaction disabled earlier
|
|
1435
|
-
*/
|
|
1436
|
-
enableControlButton(): void;
|
|
1437
|
-
/**
|
|
1438
|
-
* Disable the user interaction for the control buttons
|
|
1439
|
-
*/
|
|
1440
|
-
disabledControlButton(): void;
|
|
1441
1502
|
private isSeekEnabledForHtml5Playback;
|
|
1442
1503
|
private getElementLocation;
|
|
1443
1504
|
private onDvrStateChanged;
|
|
1444
1505
|
}
|
|
1445
1506
|
|
|
1446
1507
|
/**
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1449
|
-
*/
|
|
1450
|
-
export declare type MediaControlElement = MediaControlLeftElement | MediaControlLayerElement | MediaControlRightElement;
|
|
1451
|
-
|
|
1452
|
-
/**
|
|
1453
|
-
* Media control elements that appear in main layer, spanning the entire width of the player.
|
|
1508
|
+
* Media control element.
|
|
1509
|
+
* Each element's token in the media control layout settings determines where the element is rendered.
|
|
1454
1510
|
* @beta
|
|
1511
|
+
* @remarks
|
|
1512
|
+
* Standard media control elements are defined in the {@link StandardMediaControlElement} type.
|
|
1513
|
+
* Custom media control elements can be identified by a unique token.
|
|
1455
1514
|
*/
|
|
1456
|
-
export declare type
|
|
1515
|
+
export declare type MediaControlElement = string;
|
|
1457
1516
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
*/
|
|
1462
|
-
export declare type MediaControlLeftElement = 'clipText' | 'duration' | 'dvr' | 'playpause' | 'playstop' | 'position' | 'volume' | 'clips';
|
|
1517
|
+
export declare type MediaControlPluginSettings = {
|
|
1518
|
+
hideMediaControlDelay?: number;
|
|
1519
|
+
};
|
|
1463
1520
|
|
|
1464
1521
|
/**
|
|
1465
|
-
*
|
|
1522
|
+
* Specifies the layout of media control elements.
|
|
1523
|
+
* Actual elements will be rendered according to the playback settings. Custom elements rendered by the plugins
|
|
1524
|
+
* will be mounted at the specified locations.
|
|
1466
1525
|
* @beta
|
|
1467
1526
|
*/
|
|
1468
|
-
export declare type
|
|
1527
|
+
export declare type MediaControlSettings = {
|
|
1528
|
+
left: MediaControlElement[];
|
|
1529
|
+
right: MediaControlElement[];
|
|
1530
|
+
default: MediaControlElement[];
|
|
1531
|
+
seekEnabled: boolean;
|
|
1532
|
+
};
|
|
1469
1533
|
|
|
1470
1534
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
* Can be used to restrict rendered media control elements.
|
|
1535
|
+
* Identifies a location for mounting custom media control elements.
|
|
1473
1536
|
* @beta
|
|
1474
1537
|
*/
|
|
1475
|
-
export declare type
|
|
1476
|
-
left: MediaControlLeftElement[];
|
|
1477
|
-
right: MediaControlRightElement[];
|
|
1478
|
-
default: MediaControlLayerElement[];
|
|
1479
|
-
seekEnabled: boolean;
|
|
1480
|
-
};
|
|
1538
|
+
export declare type MediaControlSlotMountPoint = 'root' | 'base' | 'left' | 'right' | 'center' | 'seekbar';
|
|
1481
1539
|
|
|
1482
1540
|
/**
|
|
1483
1541
|
* @beta
|
|
@@ -2878,6 +2936,12 @@ export declare interface StallEventData {
|
|
|
2878
2936
|
time: number;
|
|
2879
2937
|
}
|
|
2880
2938
|
|
|
2939
|
+
/**
|
|
2940
|
+
* Built-in media control elements.
|
|
2941
|
+
* @beta
|
|
2942
|
+
*/
|
|
2943
|
+
export declare type StandardMediaControlElement = 'duration' | 'fullscreen' | 'hd-indicator' | 'playpause' | 'playstop' | 'position' | 'seekbar' | 'volume';
|
|
2944
|
+
|
|
2881
2945
|
/**
|
|
2882
2946
|
* Telemetry start event data
|
|
2883
2947
|
* @beta
|