@gcorevideo/player 2.22.28 → 2.22.29

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
@@ -43303,7 +43303,7 @@ class Player {
43303
43303
  }
43304
43304
  }
43305
43305
 
43306
- var version$1 = "2.22.28";
43306
+ var version$1 = "2.22.29";
43307
43307
 
43308
43308
  var packages = {
43309
43309
  "node_modules/@clappr/core": {
@@ -50552,15 +50552,18 @@ function formatLevelLabel(level) {
50552
50552
  return `${h}p`;
50553
50553
  }
50554
50554
 
50555
- const seekTimeHTML = "<span data-seek-time id=\"mc-seek-time\"></span>\n<span data-duration id=\"mc-duration\"></span>\n\n";
50555
+ const seekTimeHTML = "<span id=\"mc-seek-time\" class=\"seek-time__pos\"></span>\n<span id=\"mc-duration\" class=\"seek-time__duration\"></span>\n\n";
50556
50556
 
50557
50557
  // Copyright 2014 Globo.com Player authors. All rights reserved.
50558
50558
  // Use of this source code is governed by a BSD-style
50559
50559
  // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE
50560
50560
  const { formatTime } = Utils;
50561
+ // const T = 'plugins.seek_time'
50561
50562
  /**
50562
- * `PLUGIN` that adds a seek time indicator to the media control UI.
50563
+ * `PLUGIN` that adds a seek time indicator when the mouse pointer is over the seek bar.
50563
50564
  * @beta
50565
+ * @remarks
50566
+ * Configuration options - {@link SeekTimeSettings}
50564
50567
  */
50565
50568
  class SeekTime extends UICorePlugin {
50566
50569
  get name() {
@@ -50573,7 +50576,6 @@ class SeekTime extends UICorePlugin {
50573
50576
  get attributes() {
50574
50577
  return {
50575
50578
  class: 'seek-time',
50576
- 'data-seek-time': '',
50577
50579
  };
50578
50580
  }
50579
50581
  get isLiveStreamWithDvr() {
@@ -50581,23 +50583,21 @@ class SeekTime extends UICorePlugin {
50581
50583
  this.core.activeContainer.getPlaybackType() === Playback.LIVE &&
50582
50584
  this.core.activeContainer.isDvrEnabled());
50583
50585
  }
50584
- get durationShown() {
50585
- return !this.isLiveStreamWithDvr;
50586
+ get showDuration() {
50587
+ return (this.core.options.seekTime?.duration === true &&
50588
+ this.core.activeContainer?.getPlaybackType() !== Playback.LIVE);
50586
50589
  }
50587
50590
  hoveringOverSeekBar = false;
50588
50591
  hoverPosition = 0;
50589
50592
  displayedDuration = null;
50590
50593
  displayedSeekTime = null;
50591
50594
  duration = 0;
50592
- // private firstFragDateTime = 0;
50593
- rendered = false;
50594
- $durationEl = null;
50595
- $seekTimeEl = null;
50596
50595
  /**
50597
50596
  * @internal
50598
50597
  */
50599
50598
  bindEvents() {
50600
50599
  this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
50600
+ this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
50601
50601
  }
50602
50602
  onCoreReady() {
50603
50603
  const mediaControl = this.core.getPlugin('media_control');
@@ -50605,11 +50605,6 @@ class SeekTime extends UICorePlugin {
50605
50605
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mount);
50606
50606
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.showTime);
50607
50607
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this.hideTime);
50608
- this.listenTo(mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.onContainerChanged);
50609
- if (this.core.activeContainer) {
50610
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
50611
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
50612
- }
50613
50608
  }
50614
50609
  onContainerChanged() {
50615
50610
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
@@ -50635,41 +50630,37 @@ class SeekTime extends UICorePlugin {
50635
50630
  this.hoverPosition = Math.min(1, Math.max(offset / mediaControl.$seekBarContainer.width(), 0));
50636
50631
  }
50637
50632
  getSeekTime() {
50638
- const seekTime = this.isLiveStreamWithDvr
50633
+ return this.isLiveStreamWithDvr
50639
50634
  ? this.duration - this.hoverPosition * this.duration
50640
50635
  : this.hoverPosition * this.duration;
50641
- return { seekTime };
50642
50636
  }
50643
50637
  update() {
50644
- if (!this.rendered) {
50645
- // update() is always called after a render
50646
- return;
50647
- }
50648
50638
  if (!this.shouldBeVisible()) {
50649
50639
  this.$el.hide();
50650
50640
  this.$el.css('left', '-100%');
50651
50641
  return;
50652
50642
  }
50653
50643
  const seekTime = this.getSeekTime();
50654
- let currentSeekTime = formatTime(seekTime.seekTime, false);
50644
+ let currentSeekTime = formatTime(seekTime, false);
50655
50645
  if (this.isLiveStreamWithDvr) {
50656
50646
  currentSeekTime = `-${currentSeekTime}`;
50657
50647
  }
50658
50648
  // only update dom if necessary, ie time actually changed
50659
50649
  if (currentSeekTime !== this.displayedSeekTime) {
50660
- this.$seekTimeEl.text(currentSeekTime);
50650
+ this.$el.find('#mc-seek-time').text(currentSeekTime);
50661
50651
  this.displayedSeekTime = currentSeekTime;
50662
50652
  }
50663
- if (this.durationShown) {
50664
- this.$durationEl.show();
50653
+ const $durationEl = this.$el.find('#mc-duration');
50654
+ if (this.showDuration) {
50655
+ $durationEl.show();
50665
50656
  const currentDuration = formatTime(this.duration, false);
50666
50657
  if (currentDuration !== this.displayedDuration) {
50667
- this.$durationEl.text(currentDuration);
50658
+ $durationEl.text(currentDuration);
50668
50659
  this.displayedDuration = currentDuration;
50669
50660
  }
50670
50661
  }
50671
50662
  else {
50672
- this.$durationEl.hide();
50663
+ $durationEl.hide();
50673
50664
  }
50674
50665
  // the element must be unhidden before its width is requested, otherwise it's width will be reported as 0
50675
50666
  this.$el.show();
@@ -50692,16 +50683,10 @@ class SeekTime extends UICorePlugin {
50692
50683
  * @internal
50693
50684
  */
50694
50685
  render() {
50695
- this.rendered = true;
50696
50686
  this.displayedDuration = null;
50697
50687
  this.displayedSeekTime = null;
50698
50688
  this.$el.html(SeekTime.template());
50699
50689
  this.$el.hide();
50700
- // this.mediaControl.$el.append(this.el);
50701
- this.$seekTimeEl = this.$el.find('#mc-seek-time');
50702
- this.$durationEl = this.$el.find('#mc-duration');
50703
- this.$durationEl.hide();
50704
- this.update();
50705
50690
  return this;
50706
50691
  }
50707
50692
  mount() {
@@ -1,9 +1,22 @@
1
1
  import { UICorePlugin } from '@clappr/core';
2
2
  import '../../../assets/seek-time/seek-time.scss';
3
3
  /**
4
- * `PLUGIN` that adds a seek time indicator to the media control UI.
4
+ * Configuration options for the SeekTime plugin.
5
5
  * @beta
6
6
  */
7
+ export type SeekTimeSettings = {
8
+ /**
9
+ * Whether to show the duration of the video. Applies only to the VOD streams.
10
+ * @beta
11
+ */
12
+ duration?: boolean;
13
+ };
14
+ /**
15
+ * `PLUGIN` that adds a seek time indicator when the mouse pointer is over the seek bar.
16
+ * @beta
17
+ * @remarks
18
+ * Configuration options - {@link SeekTimeSettings}
19
+ */
7
20
  export declare class SeekTime extends UICorePlugin {
8
21
  get name(): string;
9
22
  get supportedVersion(): {
@@ -12,18 +25,14 @@ export declare class SeekTime extends UICorePlugin {
12
25
  private static readonly template;
13
26
  get attributes(): {
14
27
  class: string;
15
- 'data-seek-time': string;
16
28
  };
17
29
  private get isLiveStreamWithDvr();
18
- private get durationShown();
30
+ private get showDuration();
19
31
  private hoveringOverSeekBar;
20
32
  private hoverPosition;
21
33
  private displayedDuration;
22
34
  private displayedSeekTime;
23
35
  private duration;
24
- private rendered;
25
- private $durationEl;
26
- private $seekTimeEl;
27
36
  /**
28
37
  * @internal
29
38
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SeekTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/seek-time/SeekTime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,YAAY,EAAmB,MAAM,cAAc,CAAA;AAM9E,OAAO,0CAA0C,CAAA;AAMjD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD,IAAa,UAAU;;;MAKtB;IAED,OAAO,KAAK,mBAAmB,GAM9B;IAED,OAAO,KAAK,aAAa,GAExB;IAED,OAAO,CAAC,mBAAmB,CAAQ;IAEnC,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAI;IAGpB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,WAAW,CAA2B;IAE9C;;OAEG;IACM,UAAU;IAInB,OAAO,CAAC,WAAW;IAoCnB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,MAAM;IAgDd,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACM,MAAM;IAcf,OAAO,CAAC,KAAK;CAGd"}
1
+ {"version":3,"file":"SeekTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/seek-time/SeekTime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,YAAY,EAAmB,MAAM,cAAc,CAAA;AAO9E,OAAO,0CAA0C,CAAA;AAEjD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAMD;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD,IAAa,UAAU;;MAItB;IAED,OAAO,KAAK,mBAAmB,GAM9B;IAED,OAAO,KAAK,YAAY,GAKvB;IAED,OAAO,CAAC,mBAAmB,CAAQ;IAEnC,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAI;IAEpB;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,MAAM;IA6Cd,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACM,MAAM;IAQf,OAAO,CAAC,KAAK;CAGd"}
@@ -2,14 +2,17 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE
4
4
  import { Events, Playback, UICorePlugin, Utils, template } from '@clappr/core';
5
+ import assert from 'assert';
5
6
  import { CLAPPR_VERSION } from '../../build.js';
6
7
  import seekTimeHTML from '../../../assets/seek-time/seek-time.html';
7
8
  import '../../../assets/seek-time/seek-time.scss';
8
- import assert from 'assert';
9
9
  const { formatTime } = Utils;
10
+ // const T = 'plugins.seek_time'
10
11
  /**
11
- * `PLUGIN` that adds a seek time indicator to the media control UI.
12
+ * `PLUGIN` that adds a seek time indicator when the mouse pointer is over the seek bar.
12
13
  * @beta
14
+ * @remarks
15
+ * Configuration options - {@link SeekTimeSettings}
13
16
  */
14
17
  export class SeekTime extends UICorePlugin {
15
18
  get name() {
@@ -22,7 +25,6 @@ export class SeekTime extends UICorePlugin {
22
25
  get attributes() {
23
26
  return {
24
27
  class: 'seek-time',
25
- 'data-seek-time': '',
26
28
  };
27
29
  }
28
30
  get isLiveStreamWithDvr() {
@@ -30,23 +32,21 @@ export class SeekTime extends UICorePlugin {
30
32
  this.core.activeContainer.getPlaybackType() === Playback.LIVE &&
31
33
  this.core.activeContainer.isDvrEnabled());
32
34
  }
33
- get durationShown() {
34
- return !this.isLiveStreamWithDvr;
35
+ get showDuration() {
36
+ return (this.core.options.seekTime?.duration === true &&
37
+ this.core.activeContainer?.getPlaybackType() !== Playback.LIVE);
35
38
  }
36
39
  hoveringOverSeekBar = false;
37
40
  hoverPosition = 0;
38
41
  displayedDuration = null;
39
42
  displayedSeekTime = null;
40
43
  duration = 0;
41
- // private firstFragDateTime = 0;
42
- rendered = false;
43
- $durationEl = null;
44
- $seekTimeEl = null;
45
44
  /**
46
45
  * @internal
47
46
  */
48
47
  bindEvents() {
49
48
  this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
49
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
50
50
  }
51
51
  onCoreReady() {
52
52
  const mediaControl = this.core.getPlugin('media_control');
@@ -54,11 +54,6 @@ export class SeekTime extends UICorePlugin {
54
54
  this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.mount);
55
55
  this.listenTo(mediaControl, Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.showTime);
56
56
  this.listenTo(mediaControl, Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this.hideTime);
57
- this.listenTo(mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.onContainerChanged);
58
- if (this.core.activeContainer) {
59
- this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
60
- this.listenTo(this.core.activeContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
61
- }
62
57
  }
63
58
  onContainerChanged() {
64
59
  this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
@@ -84,41 +79,37 @@ export class SeekTime extends UICorePlugin {
84
79
  this.hoverPosition = Math.min(1, Math.max(offset / mediaControl.$seekBarContainer.width(), 0));
85
80
  }
86
81
  getSeekTime() {
87
- const seekTime = this.isLiveStreamWithDvr
82
+ return this.isLiveStreamWithDvr
88
83
  ? this.duration - this.hoverPosition * this.duration
89
84
  : this.hoverPosition * this.duration;
90
- return { seekTime };
91
85
  }
92
86
  update() {
93
- if (!this.rendered) {
94
- // update() is always called after a render
95
- return;
96
- }
97
87
  if (!this.shouldBeVisible()) {
98
88
  this.$el.hide();
99
89
  this.$el.css('left', '-100%');
100
90
  return;
101
91
  }
102
92
  const seekTime = this.getSeekTime();
103
- let currentSeekTime = formatTime(seekTime.seekTime, false);
93
+ let currentSeekTime = formatTime(seekTime, false);
104
94
  if (this.isLiveStreamWithDvr) {
105
95
  currentSeekTime = `-${currentSeekTime}`;
106
96
  }
107
97
  // only update dom if necessary, ie time actually changed
108
98
  if (currentSeekTime !== this.displayedSeekTime) {
109
- this.$seekTimeEl.text(currentSeekTime);
99
+ this.$el.find('#mc-seek-time').text(currentSeekTime);
110
100
  this.displayedSeekTime = currentSeekTime;
111
101
  }
112
- if (this.durationShown) {
113
- this.$durationEl.show();
102
+ const $durationEl = this.$el.find('#mc-duration');
103
+ if (this.showDuration) {
104
+ $durationEl.show();
114
105
  const currentDuration = formatTime(this.duration, false);
115
106
  if (currentDuration !== this.displayedDuration) {
116
- this.$durationEl.text(currentDuration);
107
+ $durationEl.text(currentDuration);
117
108
  this.displayedDuration = currentDuration;
118
109
  }
119
110
  }
120
111
  else {
121
- this.$durationEl.hide();
112
+ $durationEl.hide();
122
113
  }
123
114
  // the element must be unhidden before its width is requested, otherwise it's width will be reported as 0
124
115
  this.$el.show();
@@ -141,16 +132,10 @@ export class SeekTime extends UICorePlugin {
141
132
  * @internal
142
133
  */
143
134
  render() {
144
- this.rendered = true;
145
135
  this.displayedDuration = null;
146
136
  this.displayedSeekTime = null;
147
137
  this.$el.html(SeekTime.template());
148
138
  this.$el.hide();
149
- // this.mediaControl.$el.append(this.el);
150
- this.$seekTimeEl = this.$el.find('#mc-seek-time');
151
- this.$durationEl = this.$el.find('#mc-duration');
152
- this.$durationEl.hide();
153
- this.update();
154
139
  return this;
155
140
  }
156
141
  mount() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.22.28",
3
+ "version": "2.22.29",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -3,20 +3,35 @@
3
3
  // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE
4
4
 
5
5
  import { Events, Playback, UICorePlugin, Utils, template } from '@clappr/core'
6
- import { TimePosition } from '../../playback.types.js'
6
+ import assert from 'assert'
7
7
 
8
+ import { TimePosition } from '../../playback.types.js'
8
9
  import { CLAPPR_VERSION } from '../../build.js'
9
10
 
10
11
  import seekTimeHTML from '../../../assets/seek-time/seek-time.html'
11
12
  import '../../../assets/seek-time/seek-time.scss'
12
- import { ZeptoResult } from '../../types.js'
13
- import assert from 'assert'
13
+
14
+ /**
15
+ * Configuration options for the SeekTime plugin.
16
+ * @beta
17
+ */
18
+ export type SeekTimeSettings = {
19
+ /**
20
+ * Whether to show the duration of the video. Applies only to the VOD streams.
21
+ * @beta
22
+ */
23
+ duration?: boolean
24
+ }
14
25
 
15
26
  const { formatTime } = Utils
16
27
 
28
+ // const T = 'plugins.seek_time'
29
+
17
30
  /**
18
- * `PLUGIN` that adds a seek time indicator to the media control UI.
31
+ * `PLUGIN` that adds a seek time indicator when the mouse pointer is over the seek bar.
19
32
  * @beta
33
+ * @remarks
34
+ * Configuration options - {@link SeekTimeSettings}
20
35
  */
21
36
  export class SeekTime extends UICorePlugin {
22
37
  get name() {
@@ -32,7 +47,6 @@ export class SeekTime extends UICorePlugin {
32
47
  override get attributes() {
33
48
  return {
34
49
  class: 'seek-time',
35
- 'data-seek-time': '',
36
50
  }
37
51
  }
38
52
 
@@ -44,8 +58,11 @@ export class SeekTime extends UICorePlugin {
44
58
  )
45
59
  }
46
60
 
47
- private get durationShown() {
48
- return !this.isLiveStreamWithDvr
61
+ private get showDuration() {
62
+ return (
63
+ this.core.options.seekTime?.duration === true &&
64
+ this.core.activeContainer?.getPlaybackType() !== Playback.LIVE
65
+ )
49
66
  }
50
67
 
51
68
  private hoveringOverSeekBar = false
@@ -57,19 +74,17 @@ export class SeekTime extends UICorePlugin {
57
74
  private displayedSeekTime: string | null = null
58
75
 
59
76
  private duration = 0
60
- // private firstFragDateTime = 0;
61
-
62
- private rendered = false
63
-
64
- private $durationEl: ZeptoResult | null = null
65
-
66
- private $seekTimeEl: ZeptoResult | null = null
67
77
 
68
78
  /**
69
79
  * @internal
70
80
  */
71
81
  override bindEvents() {
72
82
  this.listenTo(this.core, Events.CORE_READY, this.onCoreReady)
83
+ this.listenTo(
84
+ this.core,
85
+ Events.CORE_ACTIVE_CONTAINER_CHANGED,
86
+ this.onContainerChanged,
87
+ )
73
88
  }
74
89
 
75
90
  private onCoreReady() {
@@ -89,23 +104,6 @@ export class SeekTime extends UICorePlugin {
89
104
  Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR,
90
105
  this.hideTime,
91
106
  )
92
- this.listenTo(
93
- mediaControl,
94
- Events.MEDIACONTROL_CONTAINERCHANGED,
95
- this.onContainerChanged,
96
- )
97
- if (this.core.activeContainer) {
98
- this.listenTo(
99
- this.core.activeContainer,
100
- Events.CONTAINER_PLAYBACKDVRSTATECHANGED,
101
- this.update,
102
- )
103
- this.listenTo(
104
- this.core.activeContainer,
105
- Events.CONTAINER_TIMEUPDATE,
106
- this.onTimeUpdate,
107
- )
108
- }
109
107
  }
110
108
 
111
109
  private onContainerChanged() {
@@ -149,18 +147,12 @@ export class SeekTime extends UICorePlugin {
149
147
  }
150
148
 
151
149
  private getSeekTime() {
152
- const seekTime = this.isLiveStreamWithDvr
150
+ return this.isLiveStreamWithDvr
153
151
  ? this.duration - this.hoverPosition * this.duration
154
152
  : this.hoverPosition * this.duration
155
-
156
- return { seekTime }
157
153
  }
158
154
 
159
155
  private update() {
160
- if (!this.rendered) {
161
- // update() is always called after a render
162
- return
163
- }
164
156
  if (!this.shouldBeVisible()) {
165
157
  this.$el.hide()
166
158
  this.$el.css('left', '-100%')
@@ -168,7 +160,7 @@ export class SeekTime extends UICorePlugin {
168
160
  }
169
161
 
170
162
  const seekTime = this.getSeekTime()
171
- let currentSeekTime = formatTime(seekTime.seekTime, false)
163
+ let currentSeekTime = formatTime(seekTime, false)
172
164
 
173
165
  if (this.isLiveStreamWithDvr) {
174
166
  currentSeekTime = `-${currentSeekTime}`
@@ -176,20 +168,21 @@ export class SeekTime extends UICorePlugin {
176
168
 
177
169
  // only update dom if necessary, ie time actually changed
178
170
  if (currentSeekTime !== this.displayedSeekTime) {
179
- this.$seekTimeEl.text(currentSeekTime)
171
+ this.$el.find('#mc-seek-time').text(currentSeekTime)
180
172
  this.displayedSeekTime = currentSeekTime
181
173
  }
182
174
 
183
- if (this.durationShown) {
184
- this.$durationEl.show()
175
+ const $durationEl = this.$el.find('#mc-duration')
176
+ if (this.showDuration) {
177
+ $durationEl.show()
185
178
  const currentDuration = formatTime(this.duration, false)
186
179
 
187
180
  if (currentDuration !== this.displayedDuration) {
188
- this.$durationEl.text(currentDuration)
181
+ $durationEl.text(currentDuration)
189
182
  this.displayedDuration = currentDuration
190
183
  }
191
184
  } else {
192
- this.$durationEl.hide()
185
+ $durationEl.hide()
193
186
  }
194
187
 
195
188
  // the element must be unhidden before its width is requested, otherwise it's width will be reported as 0
@@ -218,16 +211,10 @@ export class SeekTime extends UICorePlugin {
218
211
  * @internal
219
212
  */
220
213
  override render() {
221
- this.rendered = true
222
214
  this.displayedDuration = null
223
215
  this.displayedSeekTime = null
224
216
  this.$el.html(SeekTime.template())
225
217
  this.$el.hide()
226
- // this.mediaControl.$el.append(this.el);
227
- this.$seekTimeEl = this.$el.find('#mc-seek-time')
228
- this.$durationEl = this.$el.find('#mc-duration')
229
- this.$durationEl.hide()
230
- this.update()
231
218
  return this
232
219
  }
233
220