@gcorevideo/player 2.22.28 → 2.22.30

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.
@@ -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() {
@@ -1,7 +1,7 @@
1
1
  import { UICorePlugin } from '@clappr/core';
2
2
  import '../../../assets/skip-time/style.scss';
3
3
  /**
4
- * `PLUGIN` that adds skip controls to the media control UI.
4
+ * `PLUGIN` that allows skipping time by tapping on the left or right side of the video.
5
5
  * @beta
6
6
  */
7
7
  export declare class SkipTime extends UICorePlugin {
@@ -10,23 +10,37 @@ export declare class SkipTime extends UICorePlugin {
10
10
  min: string;
11
11
  };
12
12
  get container(): any;
13
- get template(): any;
13
+ private static readonly template;
14
+ /**
15
+ * @internal
16
+ */
14
17
  get attributes(): {
15
18
  class: string;
16
- 'data-skip-time': string;
17
19
  };
18
20
  private position;
21
+ /**
22
+ * @internal
23
+ */
19
24
  get events(): {
20
- 'click [data-skip-left]': string;
21
- 'click [data-skip-mid]': string;
22
- 'click [data-skip-right]': string;
25
+ 'click #mc-skip-left': string;
26
+ 'click #mc-skip-mid': string;
27
+ 'click #mc-skip-right': string;
23
28
  };
29
+ /**
30
+ * @internal
31
+ */
24
32
  bindEvents(): void;
25
- setBack(): void;
26
- handleRewindClicks(): void;
27
- setMidClick(): void;
28
- setForward(): void;
29
- toggleFullscreen(): void;
33
+ private onContainerChanged;
34
+ private setBack;
35
+ private handleRewindClicks;
36
+ private handleSkip;
37
+ private setMidClick;
38
+ private setForward;
39
+ private toggleFullscreen;
40
+ /**
41
+ * @internal
42
+ */
30
43
  render(): this;
44
+ private mount;
31
45
  }
32
46
  //# sourceMappingURL=SkipTime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SkipTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/skip-time/SkipTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAKhF,OAAO,sCAAsC,CAAA;AAI7C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,SAAS,QAEZ;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,QAAQ,CAAkB;IAElC,IAAa,MAAM;;;;MAMlB;IAEQ,UAAU;IAYnB,OAAO;IAIP,kBAAkB;IA+BlB,WAAW;IAIX,UAAU;IAIV,gBAAgB;IAMP,MAAM;CAWhB"}
1
+ {"version":3,"file":"SkipTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/skip-time/SkipTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAMhF,OAAO,sCAAsC,CAAA;AAM7C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,SAAS,QAEZ;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,OAAO,CAAC,QAAQ,CAAkB;IAElC;;OAEG;IACH,IAAa,MAAM;;;;MAMlB;IAED;;OAEG;IACM,UAAU;IAKnB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACM,MAAM;IAOf,OAAO,CAAC,KAAK;CAId"}
@@ -1,9 +1,11 @@
1
1
  import { UICorePlugin, Browser, Playback, Events, template } from '@clappr/core';
2
+ import { trace } from '@gcorevideo/utils';
2
3
  import { CLAPPR_VERSION } from '../../build.js';
3
4
  import pluginHtml from '../../../assets/skip-time/skip-time.ejs';
4
5
  import '../../../assets/skip-time/style.scss';
6
+ const T = 'plugins.skip_time';
5
7
  /**
6
- * `PLUGIN` that adds skip controls to the media control UI.
8
+ * `PLUGIN` that allows skipping time by tapping on the left or right side of the video.
7
9
  * @beta
8
10
  */
9
11
  export class SkipTime extends UICorePlugin {
@@ -16,39 +18,56 @@ export class SkipTime extends UICorePlugin {
16
18
  get container() {
17
19
  return this.core && this.core.activeContainer;
18
20
  }
19
- get template() {
20
- return template(pluginHtml);
21
- }
21
+ static template = template(pluginHtml);
22
+ /**
23
+ * @internal
24
+ */
22
25
  get attributes() {
23
26
  return {
24
- class: this.name + '_plugin',
25
- 'data-skip-time': '',
27
+ class: 'mc-skip-time',
26
28
  };
27
29
  }
28
30
  position = 'mid';
31
+ /**
32
+ * @internal
33
+ */
29
34
  get events() {
30
35
  return {
31
- 'click [data-skip-left]': 'setBack',
32
- 'click [data-skip-mid]': 'setMidClick',
33
- 'click [data-skip-right]': 'setForward',
36
+ 'click #mc-skip-left': 'setBack',
37
+ 'click #mc-skip-mid': 'setMidClick',
38
+ 'click #mc-skip-right': 'setForward',
34
39
  };
35
40
  }
41
+ /**
42
+ * @internal
43
+ */
36
44
  bindEvents() {
37
45
  this.listenTo(this.core, Events.CORE_READY, this.render);
38
- if (!this.container) {
39
- return;
40
- }
46
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
47
+ }
48
+ onContainerChanged() {
41
49
  this.listenTo(this.container, Events.CONTAINER_DBLCLICK, this.handleRewindClicks);
50
+ this.mount();
42
51
  }
43
52
  setBack() {
53
+ trace(`${T} setBack`);
44
54
  this.position = 'left';
45
55
  }
46
56
  handleRewindClicks() {
57
+ trace(`${T} handleRewindClicks`, {
58
+ position: this.position,
59
+ });
47
60
  if (this.core.getPlaybackType() === Playback.LIVE &&
48
61
  !this.container.isDvrEnabled()) {
49
62
  this.toggleFullscreen();
50
63
  return;
51
64
  }
65
+ this.handleSkip();
66
+ }
67
+ handleSkip() {
68
+ trace(`${T} handleSkip`, {
69
+ position: this.position,
70
+ });
52
71
  if (Browser.isMobile) {
53
72
  if (this.position === 'left') {
54
73
  const seekPos = this.container.getCurrentTime() - 10;
@@ -70,22 +89,29 @@ export class SkipTime extends UICorePlugin {
70
89
  }
71
90
  }
72
91
  setMidClick() {
92
+ trace(`${T} setMidClick`);
73
93
  this.position = 'mid';
74
94
  }
75
95
  setForward() {
96
+ trace(`${T} setForward`);
76
97
  this.position = 'right';
77
98
  }
78
99
  toggleFullscreen() {
100
+ trace(`${T} toggleFullscreen`);
79
101
  this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name);
80
102
  this.container.fullscreen();
81
103
  this.core.toggleFullscreen();
82
104
  }
105
+ /**
106
+ * @internal
107
+ */
83
108
  render() {
84
- this.$el.html(template(pluginHtml));
85
- if (this.core.activeContainer) {
86
- this.core.activeContainer.$el.append(this.el);
87
- }
88
- this.bindEvents();
109
+ trace(`${T} render`);
110
+ this.$el.html(SkipTime.template());
89
111
  return this;
90
112
  }
113
+ mount() {
114
+ trace(`${T} mount`);
115
+ this.core.activeContainer.$el.append(this.el);
116
+ }
91
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.22.28",
3
+ "version": "2.22.30",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -246,7 +246,7 @@ exports[`MediaControl > rendering timing > once metadata is loaded > should wait
246
246
  <span class="drawer-text" data-volume=""></span>
247
247
  </div>
248
248
 
249
- <div class="bar-container" data-volume="">
249
+ <div class="bar-container volume-bar-hide" data-volume="">
250
250
  <div class="bar-background" data-volume="">
251
251
  <div class="bar-fill-1 gcore-skin-main-color" data-volume="" style="width: 100%;"></div>
252
252
  </div>
@@ -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