@gcorevideo/player 2.22.29 → 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,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.29",
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>
@@ -1,4 +1,5 @@
1
1
  import { UICorePlugin, Browser, Playback, Events, template } from '@clappr/core'
2
+ import { trace } from '@gcorevideo/utils'
2
3
 
3
4
  import { CLAPPR_VERSION } from '../../build.js'
4
5
 
@@ -7,8 +8,10 @@ import '../../../assets/skip-time/style.scss'
7
8
 
8
9
  type Position = 'mid' | 'left' | 'right'
9
10
 
11
+ const T = 'plugins.skip_time'
12
+
10
13
  /**
11
- * `PLUGIN` that adds skip controls to the media control UI.
14
+ * `PLUGIN` that allows skipping time by tapping on the left or right side of the video.
12
15
  * @beta
13
16
  */
14
17
  export class SkipTime extends UICorePlugin {
@@ -24,52 +27,70 @@ export class SkipTime extends UICorePlugin {
24
27
  return this.core && this.core.activeContainer
25
28
  }
26
29
 
27
- get template() {
28
- return template(pluginHtml)
29
- }
30
+ private static readonly template = template(pluginHtml)
30
31
 
32
+ /**
33
+ * @internal
34
+ */
31
35
  override get attributes() {
32
36
  return {
33
- class: this.name + '_plugin',
34
- 'data-skip-time': '',
37
+ class: 'mc-skip-time',
35
38
  }
36
39
  }
37
40
 
38
41
  private position: Position = 'mid'
39
42
 
43
+ /**
44
+ * @internal
45
+ */
40
46
  override get events() {
41
47
  return {
42
- 'click [data-skip-left]': 'setBack',
43
- 'click [data-skip-mid]': 'setMidClick',
44
- 'click [data-skip-right]': 'setForward',
48
+ 'click #mc-skip-left': 'setBack',
49
+ 'click #mc-skip-mid': 'setMidClick',
50
+ 'click #mc-skip-right': 'setForward',
45
51
  }
46
52
  }
47
53
 
54
+ /**
55
+ * @internal
56
+ */
48
57
  override bindEvents() {
49
58
  this.listenTo(this.core, Events.CORE_READY, this.render)
50
- if (!this.container) {
51
- return
52
- }
59
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged)
60
+ }
61
+
62
+ private onContainerChanged() {
53
63
  this.listenTo(
54
64
  this.container,
55
65
  Events.CONTAINER_DBLCLICK,
56
66
  this.handleRewindClicks,
57
67
  )
68
+ this.mount()
58
69
  }
59
70
 
60
- setBack() {
71
+ private setBack() {
72
+ trace(`${T} setBack`)
61
73
  this.position = 'left'
62
74
  }
63
75
 
64
- handleRewindClicks() {
76
+ private handleRewindClicks() {
77
+ trace(`${T} handleRewindClicks`, {
78
+ position: this.position,
79
+ })
65
80
  if (
66
81
  this.core.getPlaybackType() === Playback.LIVE &&
67
82
  !this.container.isDvrEnabled()
68
83
  ) {
69
84
  this.toggleFullscreen()
70
-
71
85
  return
72
86
  }
87
+ this.handleSkip()
88
+ }
89
+
90
+ private handleSkip() {
91
+ trace(`${T} handleSkip`, {
92
+ position: this.position,
93
+ })
73
94
  if (Browser.isMobile) {
74
95
  if (this.position === 'left') {
75
96
  const seekPos = this.container.getCurrentTime() - 10
@@ -92,29 +113,35 @@ export class SkipTime extends UICorePlugin {
92
113
  }
93
114
  }
94
115
 
95
- setMidClick() {
116
+ private setMidClick() {
117
+ trace(`${T} setMidClick`)
96
118
  this.position = 'mid'
97
119
  }
98
120
 
99
- setForward() {
121
+ private setForward() {
122
+ trace(`${T} setForward`)
100
123
  this.position = 'right'
101
124
  }
102
125
 
103
- toggleFullscreen() {
126
+ private toggleFullscreen() {
127
+ trace(`${T} toggleFullscreen`)
104
128
  this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name)
105
129
  this.container.fullscreen()
106
130
  this.core.toggleFullscreen()
107
131
  }
108
132
 
133
+ /**
134
+ * @internal
135
+ */
109
136
  override render() {
110
- this.$el.html(template(pluginHtml))
111
-
112
- if (this.core.activeContainer) {
113
- this.core.activeContainer.$el.append(this.el)
114
- }
115
-
116
- this.bindEvents()
137
+ trace(`${T} render`)
138
+ this.$el.html(SkipTime.template())
117
139
 
118
140
  return this
119
141
  }
142
+
143
+ private mount() {
144
+ trace(`${T} mount`)
145
+ this.core.activeContainer.$el.append(this.el)
146
+ }
120
147
  }