@gcorevideo/player 2.21.4 → 2.22.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/dist/index.js CHANGED
@@ -43300,7 +43300,7 @@ class Player {
43300
43300
  }
43301
43301
  }
43302
43302
 
43303
- var version$1 = "2.21.4";
43303
+ var version$1 = "2.22.0";
43304
43304
 
43305
43305
  var packages = {
43306
43306
  "node_modules/@clappr/core": {
@@ -43921,7 +43921,7 @@ function getPageX(event) {
43921
43921
  return 0;
43922
43922
  }
43923
43923
 
43924
- 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\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 (setting === \"fullscreen\") {\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";
43924
+ 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\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";
43925
43925
 
43926
43926
  const playIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_28_1564)\">\n <path d=\"M6 3V20L19.3571 11.5L6 3Z\" fill=\"#C9C9C9\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_28_1564\">\n <rect width=\"24\" height=\"24\" fill=\"white\"/>\n </clipPath>\n </defs>\n</svg>\n";
43927
43927
 
@@ -43940,6 +43940,12 @@ const fullscreenOnIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"
43940
43940
  // Copyright 2014 Globo.com Player authors. All rights reserved.
43941
43941
  // Use of this source code is governed by a BSD-style
43942
43942
  // license that can be found in the {@link https://github.com/clappr/clappr-plugins/blob/master/LICENSE | LICENSE}.
43943
+ const DEFAULT_SETTINGS = {
43944
+ left: [],
43945
+ right: [],
43946
+ default: [],
43947
+ seekEnabled: true,
43948
+ };
43943
43949
  /**
43944
43950
  * Custom events emitted by the plugins to communicate with one another
43945
43951
  * @beta
@@ -43955,7 +43961,8 @@ const T$e = 'plugins.media_control';
43955
43961
  const LEFT_ORDER = [
43956
43962
  'playpause',
43957
43963
  'playstop',
43958
- 'live',
43964
+ // 'live',
43965
+ 'dvr',
43959
43966
  'volume',
43960
43967
  'position',
43961
43968
  'duration',
@@ -43989,14 +43996,13 @@ class MediaControl extends UICorePlugin {
43989
43996
  hideId = null;
43990
43997
  hideVolumeId = null;
43991
43998
  intendedVolume = 100;
43992
- isHD = false;
43993
43999
  keepVisible = false;
43994
44000
  kibo;
43995
44001
  lastMouseX = 0;
43996
44002
  lastMouseY = 0;
43997
44003
  persistConfig;
43998
44004
  rendered = false;
43999
- settings = {}; // TODO & seekEnabled: boolean, ...
44005
+ settings = DEFAULT_SETTINGS;
44000
44006
  userDisabled = false;
44001
44007
  userKeepVisible = false;
44002
44008
  verticalVolume = false;
@@ -44140,8 +44146,6 @@ class MediaControl extends UICorePlugin {
44140
44146
  * @internal
44141
44147
  */
44142
44148
  bindEvents() {
44143
- // @ts-ignore
44144
- this.stopListening();
44145
44149
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
44146
44150
  this.listenTo(this.core, Events$1.CORE_MOUSE_MOVE, this.show);
44147
44151
  this.listenTo(this.core, Events$1.CORE_MOUSE_LEAVE, () => this.hide(this.options.hideMediaControlDelay));
@@ -44178,8 +44182,8 @@ class MediaControl extends UICorePlugin {
44178
44182
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
44179
44183
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PROGRESS, this.updateProgressBar);
44180
44184
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_SETTINGSUPDATE, this.updateSettings);
44181
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.updateSettings);
44182
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
44185
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.onDvrStateChanged);
44186
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_HIGHDEFINITIONUPDATE, this.onHdUpdate);
44183
44187
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_MEDIACONTROL_DISABLE, this.disable);
44184
44188
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_MEDIACONTROL_ENABLE, this.enable);
44185
44189
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_ENDED, this.ended);
@@ -44227,7 +44231,13 @@ class MediaControl extends UICorePlugin {
44227
44231
  // see https://github.com/clappr/clappr/issues/1127
44228
44232
  if (!Fullscreen.fullscreenEnabled() && video.webkitSupportsFullscreen) {
44229
44233
  this.fullScreenOnVideoTagSupported = true;
44230
- this.updateSettings();
44234
+ }
44235
+ this.updateSettings();
44236
+ if (this.core.activeContainer.getPlaybackType() === Playback.LIVE) {
44237
+ this.$el.addClass('live');
44238
+ }
44239
+ else {
44240
+ this.$el.removeClass('live');
44231
44241
  }
44232
44242
  }
44233
44243
  updateVolumeUI() {
@@ -44236,8 +44246,6 @@ class MediaControl extends UICorePlugin {
44236
44246
  return;
44237
44247
  }
44238
44248
  assert.ok(this.$volumeBarContainer, 'volume bar container must be present');
44239
- // update volume bar scrubber/fill on bar mode
44240
- // this.$volumeBarContainer.find('.bar-fill-2').css({});
44241
44249
  const containerWidth = this.$volumeBarContainer.width();
44242
44250
  assert.ok(this.$volumeBarBackground, 'volume bar background must be present');
44243
44251
  const barWidth = this.$volumeBarBackground.width();
@@ -44426,17 +44434,18 @@ class MediaControl extends UICorePlugin {
44426
44434
  // if the container is not ready etc
44427
44435
  this.intendedVolume = value;
44428
44436
  this.persistConfig && !isInitialVolume && Config.persist('volume', value);
44437
+ // TODO
44429
44438
  const setWhenContainerReady = () => {
44430
- if (this.container && this.container.isReady) {
44431
- this.container.setVolume(value);
44439
+ if (this.core.activeContainer && this.core.activeContainer.isReady) {
44440
+ this.core.activeContainer.setVolume(value);
44432
44441
  }
44433
44442
  else {
44434
- this.listenToOnce(this.container, Events$1.CONTAINER_READY, () => {
44435
- this.container.setVolume(value);
44443
+ this.listenToOnce(this.core.activeContainer, Events$1.CONTAINER_READY, () => {
44444
+ this.core.activeContainer.setVolume(value);
44436
44445
  });
44437
44446
  }
44438
44447
  };
44439
- if (!this.container) {
44448
+ if (!this.core.activeContainer) {
44440
44449
  this.listenToOnce(this, Events$1.MEDIACONTROL_CONTAINERCHANGED, () => setWhenContainerReady());
44441
44450
  }
44442
44451
  else {
@@ -44446,7 +44455,7 @@ class MediaControl extends UICorePlugin {
44446
44455
  toggleFullscreen() {
44447
44456
  if (!Browser.isMobile) {
44448
44457
  this.trigger(Events$1.MEDIACONTROL_FULLSCREEN, this.name);
44449
- this.container.fullscreen();
44458
+ this.core.activeContainer.fullscreen();
44450
44459
  this.core.toggleFullscreen();
44451
44460
  this.resetUserKeepVisible();
44452
44461
  }
@@ -44458,6 +44467,7 @@ class MediaControl extends UICorePlugin {
44458
44467
  this.changeTogglePlay();
44459
44468
  this.bindContainerEvents();
44460
44469
  this.updateSettings();
44470
+ // TODO remove
44461
44471
  this.core.activeContainer.trigger(Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.core.activeContainer.isDvrInUse());
44462
44472
  // TODO test
44463
44473
  if (this.core.activeContainer.mediaControlDisabled) {
@@ -44482,7 +44492,9 @@ class MediaControl extends UICorePlugin {
44482
44492
  seekTimePlugin?.$el.find('span').addClass('gcore-skin-text-color');
44483
44493
  }
44484
44494
  showVolumeBar() {
44485
- this.hideVolumeId && clearTimeout(this.hideVolumeId);
44495
+ if (this.hideVolumeId) {
44496
+ clearTimeout(this.hideVolumeId);
44497
+ }
44486
44498
  this.$volumeBarContainer?.removeClass('volume-bar-hide');
44487
44499
  }
44488
44500
  hideVolumeBar(timeout = 400) {
@@ -44528,9 +44540,9 @@ class MediaControl extends UICorePlugin {
44528
44540
  }
44529
44541
  // default to 100%
44530
44542
  this.currentSeekBarPercentage = 100;
44531
- if (this.container &&
44532
- (this.container.getPlaybackType() !== Playback.LIVE ||
44533
- this.container.isDvrInUse())) {
44543
+ if (this.core.activeContainer &&
44544
+ (this.core.activeContainer.getPlaybackType() !== Playback.LIVE ||
44545
+ this.core.activeContainer.isDvrInUse())) {
44534
44546
  this.currentSeekBarPercentage =
44535
44547
  (this.currentPositionValue / this.currentDurationValue) * 100;
44536
44548
  }
@@ -44557,16 +44569,10 @@ class MediaControl extends UICorePlugin {
44557
44569
  const offsetX = MediaControl.getPageX(event) - this.$seekBarContainer.offset().left;
44558
44570
  let pos = (offsetX / this.$seekBarContainer.width()) * 100;
44559
44571
  pos = Math.min(100, Math.max(pos, 0));
44560
- this.container && this.container.seekPercentage(pos);
44572
+ this.core.activeContainer && this.core.activeContainer.seekPercentage(pos);
44561
44573
  this.setSeekPercentage(pos);
44562
44574
  return false;
44563
44575
  }
44564
- setKeepVisible() {
44565
- this.keepVisible = true;
44566
- }
44567
- resetKeepVisible() {
44568
- this.keepVisible = false;
44569
- }
44570
44576
  setUserKeepVisible() {
44571
44577
  this.userKeepVisible = true;
44572
44578
  }
@@ -44644,7 +44650,12 @@ class MediaControl extends UICorePlugin {
44644
44650
  default: [],
44645
44651
  right: [],
44646
44652
  }, this.core.activeContainer.settings);
44653
+ // TODO make order controlled via CSS
44647
44654
  newSettings.left = orderByOrderPattern([...newSettings.left, 'clipsText', 'volume'], LEFT_ORDER);
44655
+ if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
44656
+ this.core.activePlayback.dvrEnabled) {
44657
+ newSettings.left.push('dvr');
44658
+ }
44648
44659
  // actual order of the items appear rendered is controlled by CSS
44649
44660
  newSettings.right = [
44650
44661
  'fullscreen',
@@ -44666,17 +44677,18 @@ class MediaControl extends UICorePlugin {
44666
44677
  }
44667
44678
  removeArrayItem(newSettings.default, 'hd-indicator');
44668
44679
  removeArrayItem(newSettings.left, 'hd-indicator');
44680
+ // TODO get from container's settings
44669
44681
  if (this.core.activePlayback.name === 'html5_video') {
44670
44682
  newSettings.seekEnabled = this.isSeekEnabledForHtml5Playback();
44671
44683
  }
44672
- const settingsChanged = JSON.stringify(this.settings) !== JSON.stringify(newSettings);
44684
+ const settingsChanged = serializeSettings(this.settings) !== serializeSettings(newSettings);
44673
44685
  if (settingsChanged) {
44674
44686
  this.settings = newSettings;
44675
44687
  this.render();
44676
44688
  }
44677
44689
  }
44678
- highDefinitionUpdate(isHD) {
44679
- this.isHD = isHD;
44690
+ onHdUpdate(isHD) {
44691
+ // TODO render?
44680
44692
  }
44681
44693
  createCachedElements() {
44682
44694
  const $layer = this.$el.find('.media-control-layer');
@@ -44739,7 +44751,7 @@ class MediaControl extends UICorePlugin {
44739
44751
  trace(`${T$e} putElement`, { name, panel: !!panel });
44740
44752
  if (panel) {
44741
44753
  const current = panel.find(`[data-${name}]`);
44742
- element.setAttribute(`data-${name}`, "");
44754
+ element.setAttribute(`data-${name}`, '');
44743
44755
  // TODO test
44744
44756
  if (current.length) {
44745
44757
  if (current[0] === element) {
@@ -44753,16 +44765,16 @@ class MediaControl extends UICorePlugin {
44753
44765
  }
44754
44766
  }
44755
44767
  /**
44756
- * Get the right panel area to append custom elements to
44757
- * @returns ZeptoSelector of the right panel element
44768
+ * Toggle the visibility of a media control element
44769
+ * @param name - The name of the media control element
44770
+ * @param show - Whether to show or hide the element
44758
44771
  */
44772
+ toggleElement(name, show) {
44773
+ this.$el.find(`[data-${name}]`).toggle(show);
44774
+ }
44759
44775
  getRightPanel() {
44760
44776
  return this.$el.find('.media-control-right-panel');
44761
44777
  }
44762
- /**
44763
- * Get the left panel area to append custom elements to
44764
- * @returns ZeptoSelector of the left panel element
44765
- */
44766
44778
  getLeftPanel() {
44767
44779
  return this.$el.find('.media-control-left-panel');
44768
44780
  }
@@ -44961,7 +44973,6 @@ class MediaControl extends UICorePlugin {
44961
44973
  this.hideVolumeBar(0);
44962
44974
  }, 0);
44963
44975
  this.parseColors();
44964
- this.highDefinitionUpdate(this.isHD);
44965
44976
  this.core.$el.append(this.el);
44966
44977
  this.rendered = true;
44967
44978
  this.updateVolumeUI();
@@ -45048,10 +45059,27 @@ class MediaControl extends UICorePlugin {
45048
45059
  }
45049
45060
  return null;
45050
45061
  }
45062
+ onDvrStateChanged(dvrInUse) {
45063
+ if (dvrInUse) {
45064
+ this.$el.addClass('dvr');
45065
+ }
45066
+ else {
45067
+ this.$el.removeClass('dvr');
45068
+ }
45069
+ }
45051
45070
  }
45052
45071
  MediaControl.extend = function (properties) {
45053
45072
  return extend(MediaControl, properties);
45054
45073
  };
45074
+ function serializeSettings(s) {
45075
+ return s.left
45076
+ .slice()
45077
+ .sort()
45078
+ .concat(s.right.slice().sort())
45079
+ .concat(s.default.slice().sort())
45080
+ .concat([s.seekEnabled])
45081
+ .join(',');
45082
+ }
45055
45083
 
45056
45084
  const VERSION$5 = '2.19.12';
45057
45085
  const T$d = 'plugins.bottom_gear';
@@ -48275,7 +48303,7 @@ class ContextMenu extends UIContainerPlugin {
48275
48303
  };
48276
48304
  }
48277
48305
 
48278
- const dvrHTML = "<div class=\"live-info\"><%= live %></div>\n<button type=\"button\" class=\"live-button\" aria-label=\"<%= backToLive %>\"><%= backToLive %></button>\n";
48306
+ const dvrHTML = "<div class=\"live-info\" id=\"media-control-live\"><%= i18n.t('live') %></div>\n<button type=\"button\" class=\"live-button\" aria-label=\"<%= i18n.t('back_to_live') %>\" id=\"media-control-back-to-live\"><%= i18n.t('back_to_live') %></button>\n";
48279
48307
 
48280
48308
  const T$b = 'plugins.dvr_controls';
48281
48309
  /**
@@ -48320,7 +48348,6 @@ class DvrControls extends UICorePlugin {
48320
48348
  get attributes() {
48321
48349
  return {
48322
48350
  class: 'dvr-controls',
48323
- 'data-dvr-controls': '',
48324
48351
  };
48325
48352
  }
48326
48353
  /**
@@ -48328,40 +48355,18 @@ class DvrControls extends UICorePlugin {
48328
48355
  */
48329
48356
  bindEvents() {
48330
48357
  this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
48331
- this.listenTo(this.core, Events$1.CORE_OPTIONS_CHANGE, this.render);
48332
48358
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.bindContainerEvents);
48333
48359
  }
48334
48360
  onCoreReady() {
48335
48361
  const mediaControl = this.core.getPlugin('media_control');
48336
48362
  assert(mediaControl, 'media_control plugin is required');
48337
- this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.settingsUpdate);
48338
- this.settingsUpdate();
48363
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.render);
48364
+ // MediaControl has been rendered
48365
+ this.render();
48339
48366
  }
48340
48367
  bindContainerEvents() {
48368
+ trace(`${T$b} bindContainerEvents`);
48341
48369
  this.listenToOnce(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.render);
48342
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.onDvrChanged);
48343
- }
48344
- onDvrChanged(dvrInUse) {
48345
- trace(`${T$b} onDvrChanged`, {
48346
- dvrInUse,
48347
- });
48348
- if (this.core.getPlaybackType() !== Playback.LIVE) {
48349
- return;
48350
- }
48351
- this.render();
48352
- const mediaControl = this.core.getPlugin('media_control');
48353
- mediaControl.$el.addClass('live');
48354
- if (dvrInUse) {
48355
- mediaControl.$el
48356
- .addClass('dvr')
48357
- .find(
48358
- // TODO add API, test
48359
- '.media-control-indicator[data-position], .media-control-indicator[data-duration]')
48360
- .hide();
48361
- }
48362
- else {
48363
- mediaControl.$el.removeClass('dvr');
48364
- }
48365
48370
  }
48366
48371
  click() {
48367
48372
  const container = this.core.activeContainer;
@@ -48370,13 +48375,8 @@ class DvrControls extends UICorePlugin {
48370
48375
  }
48371
48376
  container.seek(container.getDuration());
48372
48377
  }
48373
- settingsUpdate() {
48374
- this.core.getPlugin('media_control').$el.removeClass('live');
48375
- this.render();
48376
- }
48377
48378
  shouldRender() {
48378
- const useDvrControls = this.core.options.useDvrControls !== false;
48379
- return useDvrControls && this.core.getPlaybackType() === Playback.LIVE;
48379
+ return this.core.getPlaybackType() === Playback.LIVE;
48380
48380
  }
48381
48381
  /**
48382
48382
  * @internal
@@ -48386,16 +48386,19 @@ class DvrControls extends UICorePlugin {
48386
48386
  dvrEnabled: this.core.activePlayback?.dvrEnabled,
48387
48387
  playbackType: this.core.getPlaybackType(),
48388
48388
  });
48389
+ const mediaControl = this.core.getPlugin('media_control');
48390
+ if (!mediaControl) {
48391
+ return this;
48392
+ }
48389
48393
  if (!this.shouldRender()) {
48390
48394
  return this;
48391
48395
  }
48396
+ mediaControl.toggleElement('duration', false);
48397
+ mediaControl.toggleElement('position', false);
48392
48398
  this.$el.html(DvrControls.template({
48393
- live: this.core.i18n.t('live'),
48394
- backToLive: this.core.i18n.t('back_to_live'),
48399
+ i18n: this.core.i18n,
48395
48400
  }));
48396
- const mediaControl = this.core.getPlugin('media_control');
48397
- mediaControl.$el.addClass('live');
48398
- mediaControl.getLeftPanel().append(this.$el);
48401
+ mediaControl.putElement('dvr', this.el);
48399
48402
  return this;
48400
48403
  }
48401
48404
  }