@gcorevideo/player 2.22.29 → 2.22.31

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.
Files changed (54) hide show
  1. package/assets/media-control/container.scss +2 -3
  2. package/assets/poster/poster.ejs +3 -1
  3. package/assets/poster/poster.scss +3 -3
  4. package/assets/skip-time/skip-time.ejs +4 -4
  5. package/assets/skip-time/style.scss +4 -4
  6. package/assets/style/main.scss +1 -1
  7. package/dist/core.js +1 -1
  8. package/dist/index.css +573 -574
  9. package/dist/index.js +225 -230
  10. package/dist/player.d.ts +63 -33
  11. package/docs/api/{player.seektime.bindevents.md → player.clapprstats.clearmetrics.md} +3 -3
  12. package/docs/api/player.clapprstats.md +14 -0
  13. package/docs/api/player.extendedevents.md +14 -0
  14. package/docs/api/player.md +13 -2
  15. package/docs/api/player.seektime.attributes.md +0 -1
  16. package/docs/api/player.seektime.md +6 -197
  17. package/docs/api/{player.seektime.render.md → player.seektimesettings.md} +7 -7
  18. package/docs/api/player.skiptime.md +3 -184
  19. package/lib/plugins/poster/Poster.d.ts +24 -14
  20. package/lib/plugins/poster/Poster.d.ts.map +1 -1
  21. package/lib/plugins/poster/Poster.js +67 -97
  22. package/lib/plugins/skip-time/SkipTime.d.ts +25 -11
  23. package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -1
  24. package/lib/plugins/skip-time/SkipTime.js +43 -17
  25. package/lib/testUtils.d.ts +13 -39
  26. package/lib/testUtils.d.ts.map +1 -1
  27. package/lib/testUtils.js +14 -65
  28. package/package.json +1 -1
  29. package/src/plugins/poster/Poster.ts +91 -110
  30. package/src/plugins/poster/__tests__/Poster.test.ts +119 -0
  31. package/src/plugins/poster/__tests__/__snapshots__/Poster.test.ts.snap +8 -0
  32. package/src/plugins/skip-time/SkipTime.ts +52 -25
  33. package/src/plugins/source-controller/__tests__/SourceController.test.ts +1 -2
  34. package/src/testUtils.ts +14 -86
  35. package/temp/player.api.json +295 -829
  36. package/tsconfig.tsbuildinfo +1 -1
  37. package/docs/api/player.seektime.durationshown.md +0 -14
  38. package/docs/api/player.seektime.getseektime.md +0 -20
  39. package/docs/api/player.seektime.islivestreamwithdvr.md +0 -14
  40. package/docs/api/player.seektime.mediacontrol.md +0 -14
  41. package/docs/api/player.seektime.mediacontrolcontainer.md +0 -14
  42. package/docs/api/player.seektime.shouldbevisible.md +0 -18
  43. package/docs/api/player.seektime.template.md +0 -14
  44. package/docs/api/player.seektime.update.md +0 -18
  45. package/docs/api/player.skiptime.attributes.md +0 -17
  46. package/docs/api/player.skiptime.bindevents.md +0 -18
  47. package/docs/api/player.skiptime.events.md +0 -18
  48. package/docs/api/player.skiptime.handlerewindclicks.md +0 -18
  49. package/docs/api/player.skiptime.render.md +0 -18
  50. package/docs/api/player.skiptime.setback.md +0 -18
  51. package/docs/api/player.skiptime.setforward.md +0 -18
  52. package/docs/api/player.skiptime.setmidclick.md +0 -18
  53. package/docs/api/player.skiptime.template.md +0 -14
  54. package/docs/api/player.skiptime.togglefullscreen.md +0 -18
@@ -7,14 +7,14 @@
7
7
  > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
8
  >
9
9
 
10
- `PLUGIN` that adds skip controls to the media control UI.
10
+ `PLUGIN` that allows skipping time by tapping on the left or right side of the video.
11
11
 
12
12
  **Signature:**
13
13
 
14
14
  ```typescript
15
- export declare class SkipTime extends UICorePluginOriginal
15
+ export declare class SkipTime extends UICorePlugin
16
16
  ```
17
- **Extends:** UICorePluginOriginal
17
+ **Extends:** UICorePlugin
18
18
 
19
19
  ## Properties
20
20
 
@@ -41,27 +41,6 @@ Description
41
41
  </th></tr></thead>
42
42
  <tbody><tr><td>
43
43
 
44
- [attributes](./player.skiptime.attributes.md)
45
-
46
-
47
- </td><td>
48
-
49
- `readonly`
50
-
51
-
52
- </td><td>
53
-
54
- { class: string; 'data-skip-time': string; }
55
-
56
-
57
- </td><td>
58
-
59
- **_(BETA)_**
60
-
61
-
62
- </td></tr>
63
- <tr><td>
64
-
65
44
  [container](./player.skiptime.container.md)
66
45
 
67
46
 
@@ -80,27 +59,6 @@ any
80
59
  **_(BETA)_**
81
60
 
82
61
 
83
- </td></tr>
84
- <tr><td>
85
-
86
- [events](./player.skiptime.events.md)
87
-
88
-
89
- </td><td>
90
-
91
- `readonly`
92
-
93
-
94
- </td><td>
95
-
96
- { 'click \[data-skip-left\]': string; 'click \[data-skip-mid\]': string; 'click \[data-skip-right\]': string; }
97
-
98
-
99
- </td><td>
100
-
101
- **_(BETA)_**
102
-
103
-
104
62
  </td></tr>
105
63
  <tr><td>
106
64
 
@@ -143,144 +101,5 @@ string
143
101
  **_(BETA)_**
144
102
 
145
103
 
146
- </td></tr>
147
- <tr><td>
148
-
149
- [template](./player.skiptime.template.md)
150
-
151
-
152
- </td><td>
153
-
154
- `readonly`
155
-
156
-
157
- </td><td>
158
-
159
- any
160
-
161
-
162
- </td><td>
163
-
164
- **_(BETA)_**
165
-
166
-
167
- </td></tr>
168
- </tbody></table>
169
-
170
- ## Methods
171
-
172
- <table><thead><tr><th>
173
-
174
- Method
175
-
176
-
177
- </th><th>
178
-
179
- Modifiers
180
-
181
-
182
- </th><th>
183
-
184
- Description
185
-
186
-
187
- </th></tr></thead>
188
- <tbody><tr><td>
189
-
190
- [bindEvents()](./player.skiptime.bindevents.md)
191
-
192
-
193
- </td><td>
194
-
195
-
196
- </td><td>
197
-
198
- **_(BETA)_**
199
-
200
-
201
- </td></tr>
202
- <tr><td>
203
-
204
- [handleRewindClicks()](./player.skiptime.handlerewindclicks.md)
205
-
206
-
207
- </td><td>
208
-
209
-
210
- </td><td>
211
-
212
- **_(BETA)_**
213
-
214
-
215
- </td></tr>
216
- <tr><td>
217
-
218
- [render()](./player.skiptime.render.md)
219
-
220
-
221
- </td><td>
222
-
223
-
224
- </td><td>
225
-
226
- **_(BETA)_**
227
-
228
-
229
- </td></tr>
230
- <tr><td>
231
-
232
- [setBack()](./player.skiptime.setback.md)
233
-
234
-
235
- </td><td>
236
-
237
-
238
- </td><td>
239
-
240
- **_(BETA)_**
241
-
242
-
243
- </td></tr>
244
- <tr><td>
245
-
246
- [setForward()](./player.skiptime.setforward.md)
247
-
248
-
249
- </td><td>
250
-
251
-
252
- </td><td>
253
-
254
- **_(BETA)_**
255
-
256
-
257
- </td></tr>
258
- <tr><td>
259
-
260
- [setMidClick()](./player.skiptime.setmidclick.md)
261
-
262
-
263
- </td><td>
264
-
265
-
266
- </td><td>
267
-
268
- **_(BETA)_**
269
-
270
-
271
- </td></tr>
272
- <tr><td>
273
-
274
- [toggleFullscreen()](./player.skiptime.togglefullscreen.md)
275
-
276
-
277
- </td><td>
278
-
279
-
280
- </td><td>
281
-
282
- **_(BETA)_**
283
-
284
-
285
104
  </td></tr>
286
105
  </tbody></table>
@@ -1,22 +1,34 @@
1
1
  import { UIContainerPlugin } from '@clappr/core';
2
2
  import '../../../assets/poster/poster.scss';
3
+ export type PosterPluginSettings = {
4
+ /**
5
+ * Custom CSS background
6
+ */
7
+ custom?: string;
8
+ /**
9
+ * Whether to show the poster image when the playback is noop (i.e., when there is no appropriate video playback engine for current media sources set or the media sources are not set at all)
10
+ */
11
+ showForNoOp?: boolean;
12
+ /**
13
+ * Poster image URL
14
+ */
15
+ url?: string;
16
+ /**
17
+ * Whether to show the poster after playback has ended @default true
18
+ */
19
+ showOnVideoEnd?: boolean;
20
+ };
3
21
  /**
4
22
  * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
5
23
  * @beta
6
24
  * @remarks
7
- * When the playback is stopped, media control UI is disabled.
25
+ * When the playback is stopped or not yet started, the media control UI is disabled and hidden.
26
+ * Media control gets activated once the metadata is loaded after playback is initiated.
27
+ * This plugin displays a big play button on top of the poster image to allow user to start playback.
8
28
  * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
9
29
  * HTML5-video-based playback module.
10
30
  *
11
- * Configuration options:
12
- *
13
- * - `poster.custom` - custom CSS background
14
- *
15
- * - `poster.showForNoOp` - whether to show the poster when the playback is not started
16
- *
17
- * - `poster.url` - the URL of the poster image
18
- *
19
- * - `poster.showOnVideoEnd` - whether to show the poster when the playback is ended
31
+ * Configuration options - {@link PosterPluginSettings}
20
32
  *
21
33
  * @example
22
34
  * ```ts
@@ -31,10 +43,9 @@ import '../../../assets/poster/poster.scss';
31
43
  */
32
44
  export declare class Poster extends UIContainerPlugin {
33
45
  private hasFatalError;
34
- private hasStartedPlaying;
46
+ private playing;
35
47
  private playRequested;
36
48
  private $playButton;
37
- private $playWrapper;
38
49
  /**
39
50
  * @internal
40
51
  */
@@ -47,12 +58,12 @@ export declare class Poster extends UIContainerPlugin {
47
58
  };
48
59
  private static readonly template;
49
60
  private get shouldRender();
61
+ private get isNoOp();
50
62
  /**
51
63
  * @internal
52
64
  */
53
65
  get attributes(): {
54
66
  class: string;
55
- 'data-poster': string;
56
67
  };
57
68
  /**
58
69
  * @internal
@@ -60,7 +71,6 @@ export declare class Poster extends UIContainerPlugin {
60
71
  get events(): {
61
72
  click: string;
62
73
  };
63
- private get showOnVideoEnd();
64
74
  /**
65
75
  * @internal
66
76
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAO3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,MAAO,SAAQ,iBAAiB;IAG3C,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,YAAY,CAA2B;IAE/C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD,OAAO,KAAK,YAAY,GAUvB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED,OAAO,KAAK,cAAc,GAEzB;IAED;;OAEG;IACM,UAAU;IAiBnB;;OAEG;IACM,MAAM;IAMf;;OAEG;IACM,OAAO;IAOhB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAYlB;;OAEG;IACM,MAAM;IAuCf;;OAEG;IACM,OAAO;CAIjB"}
1
+ {"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAK3C,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,MAAO,SAAQ,iBAAiB;IAG3C,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,WAAW,CAA2B;IAE9C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD,OAAO,KAAK,YAAY,GASvB;IAED,OAAO,KAAK,MAAM,GAEjB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAuBnB;;OAEG;IACM,MAAM;IAOf;;OAEG;IACM,OAAO;IAOhB,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACM,MAAM;IAgCf;;OAEG;IACM,OAAO;CAIjB"}
@@ -1,7 +1,7 @@
1
1
  //Copyright 2014 Globo.com Player authors. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
- import { Events, Playback, PlayerError, UIContainerPlugin, template, $, } from '@clappr/core';
4
+ import { Events, Playback, PlayerError, UIContainerPlugin, template, } from '@clappr/core';
5
5
  import { trace } from '@gcorevideo/utils';
6
6
  import { CLAPPR_VERSION } from '../../build.js';
7
7
  import '../../../assets/poster/poster.scss';
@@ -12,19 +12,13 @@ const T = 'plugins.poster';
12
12
  * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
13
13
  * @beta
14
14
  * @remarks
15
- * When the playback is stopped, media control UI is disabled.
15
+ * When the playback is stopped or not yet started, the media control UI is disabled and hidden.
16
+ * Media control gets activated once the metadata is loaded after playback is initiated.
17
+ * This plugin displays a big play button on top of the poster image to allow user to start playback.
16
18
  * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
17
19
  * HTML5-video-based playback module.
18
20
  *
19
- * Configuration options:
20
- *
21
- * - `poster.custom` - custom CSS background
22
- *
23
- * - `poster.showForNoOp` - whether to show the poster when the playback is not started
24
- *
25
- * - `poster.url` - the URL of the poster image
26
- *
27
- * - `poster.showOnVideoEnd` - whether to show the poster when the playback is ended
21
+ * Configuration options - {@link PosterPluginSettings}
28
22
  *
29
23
  * @example
30
24
  * ```ts
@@ -40,10 +34,9 @@ const T = 'plugins.poster';
40
34
  export class Poster extends UIContainerPlugin {
41
35
  // TODO merge non-poster related functionality into the ClickToPause plugin
42
36
  hasFatalError = false;
43
- hasStartedPlaying = false;
37
+ playing = false;
44
38
  playRequested = false;
45
39
  $playButton = null;
46
- $playWrapper = null;
47
40
  /**
48
41
  * @internal
49
42
  */
@@ -63,8 +56,10 @@ export class Poster extends UIContainerPlugin {
63
56
  }
64
57
  const showForNoOp = !!this.options.poster?.showForNoOp;
65
58
  return (this.container.playback.name !== 'html_img' &&
66
- (this.container.playback.getPlaybackType() !== Playback.NO_OP ||
67
- showForNoOp));
59
+ (!this.isNoOp || showForNoOp));
60
+ }
61
+ get isNoOp() {
62
+ return this.container.playback.getPlaybackType() === Playback.NO_OP;
68
63
  }
69
64
  /**
70
65
  * @internal
@@ -72,7 +67,6 @@ export class Poster extends UIContainerPlugin {
72
67
  get attributes() {
73
68
  return {
74
69
  class: 'player-poster',
75
- 'data-poster': '',
76
70
  };
77
71
  }
78
72
  /**
@@ -83,9 +77,6 @@ export class Poster extends UIContainerPlugin {
83
77
  click: 'clicked',
84
78
  };
85
79
  }
86
- get showOnVideoEnd() {
87
- return this.options.poster?.showOnVideoEnd !== false;
88
- }
89
80
  /**
90
81
  * @internal
91
82
  */
@@ -94,19 +85,22 @@ export class Poster extends UIContainerPlugin {
94
85
  this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
95
86
  this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.update);
96
87
  this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.update);
97
- this.listenTo(this.container, Events.CONTAINER_OPTIONS_CHANGE, this.render);
88
+ this.listenTo(this.container, Events.CONTAINER_OPTIONS_CHANGE, this.update);
98
89
  this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
99
- this.showOnVideoEnd &&
90
+ // TODO check if this event is always accompanied with the CONTAINER_STOP
91
+ if (this.options.poster?.showOnVideoEnd !== false) {
100
92
  this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop);
93
+ }
101
94
  this.listenTo(this.container, Events.CONTAINER_READY, this.render);
102
- this.listenTo(this.container, Events.PLAYBACK_PLAY_INTENT, this.onPlayIntent);
95
+ this.listenTo(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.onPlayIntent);
103
96
  }
104
97
  /**
105
98
  * Reenables earlier disabled plugin
106
99
  */
107
100
  enable() {
101
+ trace(`${T} enable`);
108
102
  super.enable();
109
- this.hasStartedPlaying = this.container.playback.isPlaying();
103
+ this.playing = this.container.playback.isPlaying();
110
104
  this.update();
111
105
  }
112
106
  /**
@@ -114,7 +108,7 @@ export class Poster extends UIContainerPlugin {
114
108
  */
115
109
  disable() {
116
110
  trace(`${T} disable`);
117
- this.hasStartedPlaying = false;
111
+ this.playing = false;
118
112
  this.playRequested = false;
119
113
  super.disable();
120
114
  }
@@ -123,17 +117,15 @@ export class Poster extends UIContainerPlugin {
123
117
  error,
124
118
  enabled: this.enabled,
125
119
  });
126
- this.hasFatalError = error.level === PlayerError.Levels.FATAL;
127
120
  if (this.hasFatalError) {
128
- this.hasStartedPlaying = false;
129
- if (!this.playRequested) {
130
- this.showPlayButton();
131
- }
121
+ return;
132
122
  }
123
+ this.hasFatalError = error.level === PlayerError.Levels.FATAL;
124
+ // this.hasFatalError is reset on container recreate
133
125
  }
134
126
  onPlay() {
135
127
  trace(`${T} onPlay`);
136
- this.hasStartedPlaying = true;
128
+ this.playing = true;
137
129
  this.playRequested = false;
138
130
  this.update();
139
131
  }
@@ -143,21 +135,21 @@ export class Poster extends UIContainerPlugin {
143
135
  this.update();
144
136
  }
145
137
  onStop() {
146
- trace(`${T} onStop`, {
147
- enabled: this.enabled,
148
- });
149
- this.hasStartedPlaying = false;
138
+ trace(`${T} onStop`);
139
+ this.playing = false;
150
140
  this.playRequested = false;
151
141
  this.update();
152
142
  }
153
- updatePlayButton(show) {
154
- trace(`${T} updatePlayButton`, {
155
- show,
156
- chromeless: this.options.chromeless,
157
- allowUserInteraction: this.options.allowUserInteraction,
158
- });
159
- if (show &&
160
- (!this.options.chromeless || this.options.allowUserInteraction)) {
143
+ updatePlayButton() {
144
+ trace(`${T} updatePlayButton`);
145
+ const show = !this.isNoOp &&
146
+ !(this.options.chromeless && !this.options.allowUserInteraction) &&
147
+ !this.playRequested &&
148
+ !this.playing &&
149
+ !this.container.buffering &&
150
+ !this.hasFatalError &&
151
+ !this.options.disableMediaControl;
152
+ if (show) {
161
153
  this.showPlayButton();
162
154
  }
163
155
  else {
@@ -165,59 +157,42 @@ export class Poster extends UIContainerPlugin {
165
157
  }
166
158
  }
167
159
  showPlayButton() {
168
- if (this.options.disableMediaControl) {
169
- return;
170
- }
171
- if (this.hasFatalError && !this.options.disableErrorScreen) {
172
- return;
173
- }
174
- this.$playButton?.show();
160
+ trace(`${T} showPlayButton`);
161
+ this.$el.find('#poster-play').show();
175
162
  this.$el.addClass('clickable');
176
163
  this.container.$el.addClass('container-with-poster-clickable');
177
164
  }
178
165
  hidePlayButton() {
179
- this.$playButton.hide();
166
+ trace(`${T} hidePlayButton`);
167
+ this.$el.find('#poster-play').hide();
180
168
  this.$el.removeClass('clickable');
181
169
  }
182
- clicked() {
183
- trace(`${T} clicked`, {
184
- hasStartedPlaying: this.hasStartedPlaying,
185
- chromeless: this.options.chromeless,
186
- allowUserInteraction: this.options.allowUserInteraction,
187
- });
170
+ clicked(e) {
171
+ trace(`${T} clicked`);
172
+ e.preventDefault();
173
+ e.stopPropagation();
174
+ if (this.options.chromeless && !this.options.allowUserInteraction) {
175
+ return;
176
+ }
188
177
  // Let "click_to_pause" plugin handle click event if media has started playing
189
- if (!this.hasStartedPlaying) {
190
- if (!this.options.chromeless || this.options.allowUserInteraction) {
191
- this.playRequested = true;
192
- this.update();
193
- this.container.playback.consent();
194
- this.container.playback.play();
195
- }
178
+ if (!this.playing) {
179
+ this.playRequested = true;
180
+ this.update();
181
+ this.container.play();
196
182
  }
197
- return false;
198
183
  }
199
184
  shouldHideOnPlay() {
200
185
  // Audio broadcasts should keep the poster up; video should hide poster while playing.
201
186
  return !this.container.playback.isAudioOnly;
202
187
  }
203
188
  update() {
204
- trace(`${T} update`, {
205
- shouldRender: this.shouldRender,
206
- });
207
- if (!this.shouldRender) {
208
- return;
209
- }
210
- const showPlayButton = !this.playRequested &&
211
- !this.hasStartedPlaying &&
212
- !this.container.buffering;
213
- this.updatePlayButton(showPlayButton);
189
+ trace(`${T} update`);
190
+ this.updatePlayButton();
214
191
  this.updatePoster();
215
192
  }
216
193
  updatePoster() {
217
- trace(`${T} updatePoster`, {
218
- hasStartedPlaying: this.hasStartedPlaying,
219
- });
220
- if (!this.hasStartedPlaying) {
194
+ trace(`${T} updatePoster`);
195
+ if (!this.playing) {
221
196
  this.showPoster();
222
197
  }
223
198
  else {
@@ -229,9 +204,7 @@ export class Poster extends UIContainerPlugin {
229
204
  this.$el.show();
230
205
  }
231
206
  hidePoster() {
232
- trace(`${T} hidePoster`, {
233
- shouldHideOnPlay: this.shouldHideOnPlay(),
234
- });
207
+ trace(`${T} hidePoster`);
235
208
  if (!this.options.disableMediaControl) {
236
209
  this.container.enableMediaControl();
237
210
  }
@@ -247,27 +220,24 @@ export class Poster extends UIContainerPlugin {
247
220
  return this;
248
221
  }
249
222
  this.$el.html(Poster.template());
250
- const isRegularPoster = this.options.poster && this.options.poster.custom === undefined;
251
- if (isRegularPoster) {
252
- const posterUrl = this.options.poster.url || this.options.poster;
253
- this.$el.css({ 'background-image': 'url(' + posterUrl + ')' });
254
- }
255
- else if (this.options.poster) {
223
+ const isCustomPoster = this.options.poster?.custom !== undefined;
224
+ if (isCustomPoster) {
256
225
  this.$el.css({ background: this.options.poster.custom });
257
226
  }
227
+ else {
228
+ const posterUrl = typeof this.options.poster === 'string'
229
+ ? this.options.poster
230
+ : this.options.poster?.url;
231
+ if (posterUrl) {
232
+ this.$el.css({ 'background-image': 'url(' + posterUrl + ')' });
233
+ }
234
+ }
258
235
  this.container.$el.removeClass('container-with-poster-clickable');
259
236
  this.container.$el.append(this.el);
260
- this.$playWrapper = this.$el.find('.play-wrapper');
261
- this.$playWrapper.addClass('control-need-disable');
262
- this.$playButton = $("<div class='circle-poster gcore-skin-button-color gcore-skin-border-color'></div>");
263
- this.$playWrapper.append(this.$playButton);
264
- this.$playButton.append(playIcon);
265
- if (this.options.autoPlay) {
266
- this.$playButton.hide();
237
+ this.$el.find('#poster-play').append(playIcon);
238
+ if (this.options.autoPlay || this.isNoOp) {
239
+ this.$el.find('#poster-play').hide();
267
240
  }
268
- this.$playButton.addClass('poster-icon');
269
- this.$playButton.attr('data-poster', '');
270
- this.update();
271
241
  return this;
272
242
  }
273
243
  /**
@@ -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"}