@gcorevideo/player 2.20.11 → 2.20.13

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 (66) hide show
  1. package/dist/core.js +26 -2
  2. package/dist/index.css +953 -953
  3. package/dist/index.js +61 -55
  4. package/dist/player.d.ts +47 -15
  5. package/dist/plugins/index.css +1475 -1475
  6. package/dist/plugins/index.js +36 -49
  7. package/docs/api/player.contextmenupluginsettings.md +1 -1
  8. package/docs/api/player.favicon.md +4 -174
  9. package/docs/api/{player.favicon.bindevents.md → player.faviconpluginsettings.faviconcolor.md} +5 -7
  10. package/docs/api/{player.favicon._constructor_.md → player.faviconpluginsettings.md} +17 -8
  11. package/docs/api/player.md +15 -4
  12. package/docs/api/{player.favicon.disable.md → player.mediacontrol.getcenterpanel.md} +4 -4
  13. package/docs/api/{player.favicon.configure.md → player.mediacontrol.getleftpanel.md} +8 -4
  14. package/docs/api/player.mediacontrol.md +30 -11
  15. package/docs/api/player.playbackerror.md +2 -2
  16. package/docs/api/player.playbackerror.origin.md +1 -1
  17. package/docs/api/player.playbackerror.scope.md +1 -1
  18. package/docs/api/player.poster.md +1 -1
  19. package/docs/api/player.sourcecontroller.md +2 -33
  20. package/lib/Player.js +1 -1
  21. package/lib/playback/HTML5Video.d.ts +5 -0
  22. package/lib/playback/HTML5Video.d.ts.map +1 -1
  23. package/lib/playback/HTML5Video.js +21 -0
  24. package/lib/playback/hls-playback/HlsPlayback.d.ts +2 -2
  25. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  26. package/lib/playback/hls-playback/HlsPlayback.js +4 -0
  27. package/lib/playback.types.d.ts +2 -2
  28. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  29. package/lib/plugins/click-to-pause/ClickToPause.js +0 -4
  30. package/lib/plugins/context-menu/ContextMenu.d.ts +1 -1
  31. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
  32. package/lib/plugins/dvr-controls/DvrControls.js +0 -1
  33. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
  34. package/lib/plugins/error-screen/ErrorScreen.js +0 -1
  35. package/lib/plugins/favicon/Favicon.d.ts +30 -3
  36. package/lib/plugins/favicon/Favicon.d.ts.map +1 -1
  37. package/lib/plugins/favicon/Favicon.js +28 -35
  38. package/lib/plugins/media-control/MediaControl.d.ts +1 -8
  39. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  40. package/lib/plugins/media-control/MediaControl.js +2 -9
  41. package/lib/plugins/poster/Poster.d.ts +2 -0
  42. package/lib/plugins/poster/Poster.d.ts.map +1 -1
  43. package/lib/plugins/poster/Poster.js +3 -3
  44. package/lib/plugins/source-controller/SourceController.d.ts +3 -0
  45. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
  46. package/lib/plugins/source-controller/SourceController.js +3 -0
  47. package/package.json +1 -1
  48. package/src/Player.ts +1 -1
  49. package/src/playback/HTML5Video.ts +29 -1
  50. package/src/playback/__tests__/HTML5Video.test.ts +47 -0
  51. package/src/playback/hls-playback/HlsPlayback.ts +5 -1
  52. package/src/playback.types.ts +2 -2
  53. package/src/plugins/click-to-pause/ClickToPause.ts +0 -5
  54. package/src/plugins/context-menu/ContextMenu.ts +1 -1
  55. package/src/plugins/dvr-controls/DvrControls.ts +0 -1
  56. package/src/plugins/error-screen/ErrorScreen.ts +0 -1
  57. package/src/plugins/favicon/Favicon.ts +38 -41
  58. package/src/plugins/media-control/MediaControl.ts +2 -9
  59. package/src/plugins/poster/Poster.ts +4 -3
  60. package/src/plugins/source-controller/SourceController.ts +3 -0
  61. package/temp/player.api.json +101 -246
  62. package/tsconfig.tsbuildinfo +1 -1
  63. package/docs/api/player.favicon.destroy.md +0 -18
  64. package/docs/api/player.favicon.name.md +0 -14
  65. package/docs/api/player.favicon.supportedversion.md +0 -16
  66. package/docs/api/player.sourcecontroller._constructor_.md +0 -50
package/dist/index.js CHANGED
@@ -42266,6 +42266,10 @@ class HlsPlayback extends BasePlayback {
42266
42266
  details: data.details,
42267
42267
  });
42268
42268
  error.level = PlayerError.Levels.WARN;
42269
+ // TODO check
42270
+ // if (data.error instanceof MediaError && data.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
42271
+ // error.code = PlaybackErrorCode.MediaSourceUnavailable
42272
+ // }
42269
42273
  this._recover(evt, data, error);
42270
42274
  break;
42271
42275
  default:
@@ -42617,6 +42621,26 @@ HlsPlayback.canPlay = function (resource, mimeType) {
42617
42621
  };
42618
42622
 
42619
42623
  class HTML5Video extends BasePlayback {
42624
+ /**
42625
+ * @internal
42626
+ */
42627
+ createError(errorData, options) {
42628
+ const i18n = this.i18n ||
42629
+ // @ts-ignore
42630
+ (this.core && this.core.i18n) ||
42631
+ // @ts-ignore
42632
+ (this.container && this.container.i18n);
42633
+ if (i18n &&
42634
+ !errorData.UI &&
42635
+ errorData.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
42636
+ errorData.UI = {
42637
+ title: i18n.t('no_broadcast'),
42638
+ message: errorData.message,
42639
+ };
42640
+ errorData.code = PlaybackErrorCode.MediaSourceUnavailable;
42641
+ }
42642
+ return super.createError(errorData, { ...options, useCodePrefix: false });
42643
+ }
42620
42644
  }
42621
42645
 
42622
42646
  // TODO consider allowing the variation of the order of playback modules
@@ -42722,7 +42746,7 @@ class Player {
42722
42746
  const coreOpts = this.buildCoreOptions(playerElement);
42723
42747
  const { core, container } = Player.getRegisteredPlugins();
42724
42748
  trace(`${T$g} init`, {
42725
- registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
42749
+ registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.prototype.name),
42726
42750
  });
42727
42751
  coreOpts.plugins = {
42728
42752
  core: Object.values(core),
@@ -43090,7 +43114,7 @@ class Player {
43090
43114
  }
43091
43115
  }
43092
43116
 
43093
- var version$1 = "2.20.11";
43117
+ var version$1 = "2.20.13";
43094
43118
 
43095
43119
  var packages = {
43096
43120
  "node_modules/@clappr/core": {
@@ -43879,17 +43903,10 @@ function orderByOrderPattern(arr, order) {
43879
43903
  return [...ordered, ...rest];
43880
43904
  }
43881
43905
  /**
43882
- * `PLUGIN` that provides a foundation for developing custom media controls UI.
43906
+ * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
43883
43907
  * @beta
43884
43908
  * @remarks
43885
43909
  * The methods exposed are to be used by the other plugins that extend the media control UI.
43886
- * The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
43887
- * @example
43888
- * ```ts
43889
- * Player.registerPlugin(MediaControl) // <--- This must go first
43890
- * Player.registerPlugin(LevelSelector) // a media control plugin
43891
- * Player.registerPlugin(NerdStats) // another media control plugin
43892
- * ```
43893
43910
  */
43894
43911
  class MediaControl extends UICorePlugin {
43895
43912
  advertisementPlaying = false;
@@ -44822,7 +44839,6 @@ class MediaControl extends UICorePlugin {
44822
44839
  return super.destroy();
44823
44840
  }
44824
44841
  configure() {
44825
- // this.advertisementPlaying ? this.disable() : this.enable()
44826
44842
  this.trigger(Events$1.MEDIACONTROL_OPTIONS_CHANGE);
44827
44843
  }
44828
44844
  /**
@@ -47883,10 +47899,6 @@ class ClickToPause extends ContainerPlugin {
47883
47899
  settingsUpdate() {
47884
47900
  const isLivePlayback = this.container.getPlaybackType() === Playback.LIVE;
47885
47901
  const pointerEnabled = !isLivePlayback || this.container.isDvrEnabled();
47886
- trace(`${T$c} settingsUpdate`, {
47887
- isLivePlayback,
47888
- pointerEnabled,
47889
- });
47890
47902
  if (pointerEnabled === this.pointerEnabled) {
47891
47903
  return;
47892
47904
  }
@@ -48273,7 +48285,6 @@ class DvrControls extends UICorePlugin {
48273
48285
  container.seek(container.getDuration());
48274
48286
  }
48275
48287
  settingsUpdate() {
48276
- trace(`${T$b} settingsUpdate`);
48277
48288
  this.core.getPlugin('media_control').$el.removeClass('live');
48278
48289
  this.render();
48279
48290
  }
@@ -48411,7 +48422,6 @@ class ErrorScreen extends UICorePlugin {
48411
48422
  ...this.err,
48412
48423
  reloadIcon: this.options.errorScreen?.noReload ? null : reloadIcon,
48413
48424
  }));
48414
- // TODO append to container instead of core?
48415
48425
  if (!this.el.parentElement) {
48416
48426
  this.core.$el.append(this.el);
48417
48427
  }
@@ -48421,26 +48431,32 @@ class ErrorScreen extends UICorePlugin {
48421
48431
 
48422
48432
  const FAVICON_COLOR = '#567';
48423
48433
  const FAVICON_SELECTOR = 'link[rel="shortcut icon"]';
48424
- // const oldIcon = $(FAVICON_SELECTOR);
48425
48434
  /**
48426
- * `PLUGIN` that adds custom favicon to the player's tab.
48435
+ * `PLUGIN` that changes the favicon according to the player's state.
48427
48436
  * @beta
48437
+ * @remarks
48438
+ * There are three states: stopped, playing and paused.
48428
48439
  */
48429
48440
  class Favicon extends CorePlugin {
48430
- _container = null;
48431
48441
  oldIcon;
48432
48442
  playIcon = null;
48433
48443
  pauseIcon = null;
48434
48444
  stopIcon = null;
48445
+ /**
48446
+ * @internal
48447
+ */
48435
48448
  get name() {
48436
48449
  return 'favicon';
48437
48450
  }
48451
+ /**
48452
+ * @internal
48453
+ */
48438
48454
  get supportedVersion() {
48439
48455
  return { min: CLAPPR_VERSION };
48440
48456
  }
48441
- // get oldIcon() {
48442
- // return oldIcon;
48443
- // }
48457
+ /**
48458
+ * @internal
48459
+ */
48444
48460
  constructor(core) {
48445
48461
  super(core);
48446
48462
  this.oldIcon = $(FAVICON_SELECTOR);
@@ -48448,41 +48464,31 @@ class Favicon extends CorePlugin {
48448
48464
  this.stopIcon = this.createIcon(stopIcon);
48449
48465
  this.changeIcon(this.stopIcon);
48450
48466
  }
48451
- this.configure();
48452
- }
48453
- configure() {
48454
- if (this.core.options.changeFavicon) {
48455
- if (!this.enabled) {
48456
- // @ts-ignore
48457
- this.stopListening(this.core, Events$1.CORE_OPTIONS_CHANGE);
48458
- this.enable();
48459
- }
48460
- }
48461
- else if (this.enabled) {
48462
- this.disable();
48463
- this.listenTo(this.core, Events$1.CORE_OPTIONS_CHANGE, this.configure);
48464
- }
48465
48467
  }
48468
+ /**
48469
+ * @internal
48470
+ */
48466
48471
  bindEvents() {
48467
- this.listenTo(this.core, Events$1.CORE_OPTIONS_CHANGE, this.configure);
48468
48472
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.containerChanged);
48469
- this.core.activeContainer && this.containerChanged();
48470
48473
  }
48471
48474
  containerChanged() {
48472
- // @ts-ignore
48473
- this._container && this.stopListening(this._container);
48474
- this._container = this.core.activeContainer;
48475
- this.listenTo(this._container, Events$1.CONTAINER_PLAY, this.setPlayIcon);
48476
- this.listenTo(this._container, Events$1.CONTAINER_PAUSE, this.setPauseIcon);
48477
- this.listenTo(this._container, Events$1.CONTAINER_STOP, this.resetIcon);
48478
- this.listenTo(this._container, Events$1.CONTAINER_ENDED, this.resetIcon);
48479
- this.listenTo(this._container, Events$1.CONTAINER_ERROR, this.resetIcon);
48475
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAY, this.setPlayIcon);
48476
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PAUSE, this.setPauseIcon);
48477
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_STOP, this.resetIcon);
48478
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_ENDED, this.resetIcon);
48479
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_ERROR, this.resetIcon);
48480
48480
  this.resetIcon();
48481
48481
  }
48482
+ /**
48483
+ * @internal
48484
+ */
48482
48485
  disable() {
48483
48486
  super.disable();
48484
48487
  this.resetIcon();
48485
48488
  }
48489
+ /**
48490
+ * @internal
48491
+ */
48486
48492
  destroy() {
48487
48493
  super.destroy();
48488
48494
  this.resetIcon();
@@ -48513,15 +48519,12 @@ class Favicon extends CorePlugin {
48513
48519
  this.changeIcon(this.pauseIcon);
48514
48520
  }
48515
48521
  resetIcon() {
48516
- $(FAVICON_SELECTOR).remove();
48517
48522
  const icon = this.oldIcon.length > 0 ? this.oldIcon : this.stopIcon;
48518
48523
  this.changeIcon(icon);
48519
48524
  }
48520
48525
  changeIcon(icon) {
48521
- if (icon) {
48522
- $('link[rel="shortcut icon"]').remove();
48523
- $('head').append(icon);
48524
- }
48526
+ $('link[rel="shortcut icon"]').remove();
48527
+ $('head').append(icon);
48525
48528
  }
48526
48529
  }
48527
48530
 
@@ -49852,6 +49855,8 @@ const T$5 = 'plugins.poster';
49852
49855
  * @beta
49853
49856
  * @remarks
49854
49857
  * When the playback is stopped, media control UI is disabled.
49858
+ * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
49859
+ * HTML5-video-based playback module.
49855
49860
  *
49856
49861
  * Configuration options:
49857
49862
  *
@@ -49875,6 +49880,7 @@ const T$5 = 'plugins.poster';
49875
49880
  * ```
49876
49881
  */
49877
49882
  class Poster extends UIContainerPlugin {
49883
+ // TODO merge non-poster related functionality into the ClickToPause plugin
49878
49884
  hasFatalError = false;
49879
49885
  hasStartedPlaying = false;
49880
49886
  playRequested = false;
@@ -50030,9 +50036,6 @@ class Poster extends UIContainerPlugin {
50030
50036
  this.container.playback.play();
50031
50037
  }
50032
50038
  }
50033
- else {
50034
- this.container.trigger('container:start');
50035
- }
50036
50039
  return false;
50037
50040
  }
50038
50041
  shouldHideOnPlay() {
@@ -50738,6 +50741,9 @@ class SourceController extends CorePlugin {
50738
50741
  get supportedVersion() {
50739
50742
  return { min: CLAPPR_VERSION };
50740
50743
  }
50744
+ /**
50745
+ * @internal
50746
+ */
50741
50747
  constructor(core) {
50742
50748
  super(core);
50743
50749
  this.sourcesList = this.core.options.sources;
package/dist/player.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @remarks
5
5
  * This package provides a video player for the Gcore streaming platform.
6
- * It is built on top of the Clappr library and provides a framework for building custom integrations.
6
+ * It is built on top of the {@link https://github.com/clappr/clappr | Clappr} library and provides a framework for building custom integrations.
7
7
  * Start with {@link Player} for more information.
8
8
  *
9
9
  * Various plugins (marked with `PLUGIN` keyword) are available to extend the player with additional features.
@@ -561,7 +561,7 @@ export declare class ContextMenu extends UIContainerPlugin {
561
561
  }
562
562
 
563
563
  /**
564
- * The plugin adds a context menu to the player.
564
+ * Context menu plugin settings
565
565
  * @beta
566
566
  */
567
567
  export declare interface ContextMenuPluginSettings {
@@ -703,24 +703,42 @@ export declare type ErrorScreenPluginSettings = {
703
703
  };
704
704
 
705
705
  /**
706
- * `PLUGIN` that adds custom favicon to the player's tab.
706
+ * `PLUGIN` that changes the favicon according to the player's state.
707
707
  * @beta
708
+ * @remarks
709
+ * There are three states: stopped, playing and paused.
708
710
  */
709
711
  export declare class Favicon extends CorePlugin {
710
- private _container;
711
712
  private oldIcon;
712
713
  private playIcon;
713
714
  private pauseIcon;
714
715
  private stopIcon;
716
+ /**
717
+ * @internal
718
+ */
715
719
  get name(): string;
720
+ /**
721
+ * @internal
722
+ */
716
723
  get supportedVersion(): {
717
724
  min: string;
718
725
  };
726
+ /**
727
+ * @internal
728
+ */
719
729
  constructor(core: Core);
720
- configure(): void;
730
+ /**
731
+ * @internal
732
+ */
721
733
  bindEvents(): void;
722
734
  private containerChanged;
735
+ /**
736
+ * @internal
737
+ */
723
738
  disable(): void;
739
+ /**
740
+ * @internal
741
+ */
724
742
  destroy(): void;
725
743
  private createIcon;
726
744
  private setPlayIcon;
@@ -729,6 +747,16 @@ export declare class Favicon extends CorePlugin {
729
747
  private changeIcon;
730
748
  }
731
749
 
750
+ /**
751
+ * @beta
752
+ */
753
+ export declare interface FaviconPluginSettings {
754
+ /**
755
+ * CSS color of the favicon.
756
+ */
757
+ faviconColor?: string;
758
+ }
759
+
732
760
  /**
733
761
  * An element inside the gear menu
734
762
  * @beta
@@ -932,17 +960,10 @@ export declare class Logo extends UIContainerPlugin {
932
960
  export { LogTracer }
933
961
 
934
962
  /**
935
- * `PLUGIN` that provides a foundation for developing custom media controls UI.
963
+ * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
936
964
  * @beta
937
965
  * @remarks
938
966
  * The methods exposed are to be used by the other plugins that extend the media control UI.
939
- * The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
940
- * @example
941
- * ```ts
942
- * Player.registerPlugin(MediaControl) // <--- This must go first
943
- * Player.registerPlugin(LevelSelector) // a media control plugin
944
- * Player.registerPlugin(NerdStats) // another media control plugin
945
- * ```
946
967
  */
947
968
  export declare class MediaControl extends UICorePlugin {
948
969
  private advertisementPlaying;
@@ -1158,6 +1179,12 @@ export declare class MediaControl extends UICorePlugin {
1158
1179
  * @returns ZeptoSelector of the right panel element
1159
1180
  */
1160
1181
  getRightPanel(): any;
1182
+ /**
1183
+ * Get the left panel area to append custom elements to
1184
+ * @returns ZeptoSelector of the left panel element
1185
+ */
1186
+ getLeftPanel(): any;
1187
+ getCenterPanel(): any;
1161
1188
  private resetIndicators;
1162
1189
  private initializeIcons;
1163
1190
  private setSeekPercentage;
@@ -1378,7 +1405,7 @@ export declare interface PlaybackError {
1378
1405
  */
1379
1406
  message: string;
1380
1407
  /**
1381
- * Exact component that originated the error.
1408
+ * Name of the component that originated the error.
1382
1409
  * @example
1383
1410
  * - 'core'
1384
1411
  * - 'dash'
@@ -1386,7 +1413,7 @@ export declare interface PlaybackError {
1386
1413
  */
1387
1414
  origin: string;
1388
1415
  /**
1389
- * Component subsystem of the error origin
1416
+ * Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.
1390
1417
  */
1391
1418
  scope: PlayerComponentType;
1392
1419
  /**
@@ -1931,6 +1958,8 @@ export declare type PlayerPluginConstructor = CorePluginConstructor | ContainerP
1931
1958
  * @beta
1932
1959
  * @remarks
1933
1960
  * When the playback is stopped, media control UI is disabled.
1961
+ * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
1962
+ * HTML5-video-based playback module.
1934
1963
  *
1935
1964
  * Configuration options:
1936
1965
  *
@@ -2193,6 +2222,9 @@ export declare class SourceController extends CorePlugin {
2193
2222
  get supportedVersion(): {
2194
2223
  min: string;
2195
2224
  };
2225
+ /**
2226
+ * @internal
2227
+ */
2196
2228
  constructor(core: Core);
2197
2229
  /**
2198
2230
  * @internal