@gcorevideo/player 2.22.1 → 2.22.2

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 (81) hide show
  1. package/assets/media-control/container.scss +1 -1
  2. package/assets/spinner-three-bounce/spinner.scss +1 -1
  3. package/dist/core.js +1 -1
  4. package/dist/index.css +1114 -1114
  5. package/dist/index.js +110 -33
  6. package/dist/player.d.ts +238 -93
  7. package/dist/plugins/index.css +545 -545
  8. package/dist/plugins/index.js +110 -33
  9. package/docs/api/player.bottomgear.additem.md +95 -0
  10. package/docs/api/player.bottomgear.md +63 -19
  11. package/docs/api/player.bottomgear.refresh.md +5 -1
  12. package/docs/api/player.clapprnerdstats.md +0 -2
  13. package/docs/api/player.clicktopause.md +1 -1
  14. package/docs/api/player.closedcaptions.md +2 -2
  15. package/docs/api/player.closedcaptionspluginsettings.md +5 -0
  16. package/docs/api/player.errorscreen.md +18 -4
  17. package/docs/api/player.errorscreenpluginsettings.md +1 -4
  18. package/docs/api/player.errorscreensettings.md +15 -0
  19. package/docs/api/{player.mediacontrolevents.md → player.gearevents.md} +7 -7
  20. package/docs/api/player.levelselector.events.md +0 -1
  21. package/docs/api/player.levelselector.md +1 -1
  22. package/docs/api/player.md +33 -36
  23. package/docs/api/{player.bottomgear.setcontent.md → player.mediacontrol.handlecustomarea.md} +5 -9
  24. package/docs/api/player.mediacontrol.md +15 -1
  25. package/docs/api/player.mediacontrol.putelement.md +2 -2
  26. package/docs/api/player.mediacontrol.toggleelement.md +2 -4
  27. package/docs/api/player.mediacontrolelement.md +1 -1
  28. package/docs/api/player.playbackrate.md +22 -3
  29. package/docs/api/{player.gearoptionsitem.md → player.playbackrateoption.md} +6 -4
  30. package/docs/api/player.playbackratesettings.md +20 -0
  31. package/docs/api/player.sourcecontroller._constructor_.md +49 -0
  32. package/docs/api/player.sourcecontroller.md +70 -7
  33. package/docs/api/player.spinnerevents.md +1 -4
  34. package/docs/api/player.spinnerthreebounce._constructor_.md +0 -3
  35. package/docs/api/player.spinnerthreebounce.hide.md +0 -3
  36. package/docs/api/player.spinnerthreebounce.md +5 -8
  37. package/docs/api/player.spinnerthreebounce.show.md +2 -5
  38. package/lib/internal.types.d.ts +5 -0
  39. package/lib/internal.types.d.ts.map +1 -1
  40. package/lib/playback.types.d.ts +0 -5
  41. package/lib/playback.types.d.ts.map +1 -1
  42. package/lib/plugins/bottom-gear/BottomGear.d.ts +35 -13
  43. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  44. package/lib/plugins/bottom-gear/BottomGear.js +35 -3
  45. package/lib/plugins/click-to-pause/ClickToPause.d.ts +1 -1
  46. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  47. package/lib/plugins/click-to-pause/ClickToPause.js +3 -2
  48. package/lib/plugins/error-screen/ErrorScreen.d.ts +29 -4
  49. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
  50. package/lib/plugins/error-screen/ErrorScreen.js +17 -2
  51. package/lib/plugins/media-control/MediaControl.d.ts +0 -11
  52. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  53. package/lib/plugins/media-control/MediaControl.js +0 -12
  54. package/lib/plugins/source-controller/SourceController.d.ts +40 -4
  55. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
  56. package/lib/plugins/source-controller/SourceController.js +41 -4
  57. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +8 -6
  58. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
  59. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +10 -6
  60. package/lib/plugins/subtitles/ClosedCaptions.d.ts +7 -7
  61. package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
  62. package/lib/plugins/subtitles/ClosedCaptions.js +2 -2
  63. package/package.json +1 -1
  64. package/src/internal.types.ts +6 -0
  65. package/src/playback.types.ts +0 -5
  66. package/src/plugins/bottom-gear/BottomGear.ts +35 -16
  67. package/src/plugins/click-to-pause/ClickToPause.ts +3 -2
  68. package/src/plugins/error-screen/ErrorScreen.ts +30 -4
  69. package/src/plugins/media-control/MediaControl.ts +0 -12
  70. package/src/plugins/source-controller/SourceController.ts +41 -4
  71. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +10 -6
  72. package/src/plugins/subtitles/ClosedCaptions.ts +8 -9
  73. package/temp/player.api.json +260 -299
  74. package/tsconfig.tsbuildinfo +1 -1
  75. package/docs/api/player.bottomgear.getelement.md +0 -56
  76. package/docs/api/player.gearitemelement.md +0 -18
  77. package/docs/api/player.subtitlespluginsettings.md +0 -18
  78. package/docs/api/player.texttrackitem.id.md +0 -11
  79. package/docs/api/player.texttrackitem.md +0 -87
  80. package/docs/api/player.texttrackitem.name.md +0 -11
  81. package/docs/api/player.texttrackitem.track.md +0 -11
package/dist/index.js CHANGED
@@ -43299,7 +43299,7 @@ class Player {
43299
43299
  }
43300
43300
  }
43301
43301
 
43302
- var version$1 = "2.22.1";
43302
+ var version$1 = "2.22.2";
43303
43303
 
43304
43304
  var packages = {
43305
43305
  "node_modules/@clappr/core": {
@@ -43665,16 +43665,24 @@ const gearHdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\
43665
43665
 
43666
43666
  const VERSION$5 = '2.19.12';
43667
43667
  const T$f = 'plugins.bottom_gear';
43668
+ /**
43669
+ * Events triggered by the plugin
43670
+ * @beta
43671
+ */
43668
43672
  var GearEvents;
43669
43673
  (function (GearEvents) {
43674
+ /**
43675
+ * Use this event to accurately attach an item to the gear menu
43676
+ */
43670
43677
  GearEvents["RENDERED"] = "rendered";
43671
43678
  })(GearEvents || (GearEvents = {}));
43672
43679
  // TODO disabled if no items added
43673
43680
  /**
43674
- * `PLUGIN` that adds the gear button with an extra options menu on the right side of the {@link MediaControl | media control} UI
43681
+ * `PLUGIN` that adds a button to extend the media controls UI with extra options.
43675
43682
  * @beta
43676
43683
  * @remarks
43677
- * The plugins provides a base for attaching custom settings UI in the gear menu
43684
+ * The plugin renders small gear icon to the right of the media controls.
43685
+ * It provides a base for attaching custom settings UI in the gear menu
43678
43686
  *
43679
43687
  * Depends on:
43680
43688
  *
@@ -43781,6 +43789,28 @@ class BottomGear extends UICorePlugin {
43781
43789
  this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
43782
43790
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
43783
43791
  }
43792
+ /**
43793
+ * Adds a custom option to the gear menu
43794
+ * @param name - A unique name of the option
43795
+ * @param $subMenu - The submenu to attach to the option
43796
+ * @returns The added item placeholder to attach custom markup
43797
+ * @remarks
43798
+ * When called with $submenu param, a click on the added item will toggle the submenu visibility.
43799
+ *
43800
+ * When added without submenu, it's responsibility of the caller to handle the click event however needed.
43801
+ * @example
43802
+ * ```ts
43803
+ * class MyPlugin extends UICorePlugin {
43804
+ * override render() {
43805
+ * this.$el.html('<div class="my-awesome-settings">...</div>')
43806
+ * this.core.getPlugin('bottom_gear')
43807
+ * ?.addItem('custom', this.$el)
43808
+ * .html($('<button>Custom settings</button>'))
43809
+ * return this
43810
+ * }
43811
+ * }
43812
+ * ```
43813
+ */
43784
43814
  addItem(name, $subMenu) {
43785
43815
  const $existingItem = this.$el.find(`#gear-options li[data-${name}`);
43786
43816
  if ($existingItem.length) {
@@ -43840,7 +43870,9 @@ class BottomGear extends UICorePlugin {
43840
43870
  return this;
43841
43871
  }
43842
43872
  /**
43843
- * Collapses any submenu open back to the gear menu
43873
+ * Collapses any submenu open back to the gear menu.
43874
+ * @remarks
43875
+ * Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
43844
43876
  */
43845
43877
  refresh() {
43846
43878
  this.$el.find('.gear-sub-menu-wrapper').hide();
@@ -46624,12 +46656,13 @@ class ClapprStats extends ContainerPlugin {
46624
46656
  // ClapprStats.REPORT_EVENT = 'clappr:stats:report';
46625
46657
  // ClapprStats.PERCENTAGE_EVENT = 'clappr:stats:percentage';
46626
46658
 
46627
- //Copyright 2014 Globo.com Player authors. All rights reserved.
46659
+ // This work is based on the original work of the following authors:
46660
+ // Copyright 2014 Globo.com Player authors. All rights reserved.
46628
46661
  // Use of this source code is governed by a BSD-style
46629
46662
  // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE.
46630
46663
  const T$d = 'plugins.click_to_pause_custom';
46631
46664
  /**
46632
- * `PLUGIN` that adds a behavior of toggling the playback state on click over the container
46665
+ * A small `PLUGIN` that toggles the playback state on click over the video container
46633
46666
  * @beta
46634
46667
  */
46635
46668
  class ClickToPause extends ContainerPlugin {
@@ -47133,8 +47166,23 @@ const templateHtml = "<div class=\"player-error-screen__content\" data-error-scr
47133
47166
 
47134
47167
  const T$b = 'plugins.error_screen';
47135
47168
  /**
47136
- * `PLUGIN` that displays errors nicely in the overlay on top of the player.
47137
- * @beta
47169
+ * `PLUGIN` that displays fatal errors nicely in the overlay on top of the player.
47170
+ * @public
47171
+ * @remarks
47172
+ * A fatal error is an error that prevents the player from playing the content.
47173
+ * It's usually a network error that persists after multiple retries.
47174
+ *
47175
+ * The error screen should not be confused with the content stub that is shown when no media sources are available.
47176
+ * This can happen due to the lack of the support of the given sources type or because the sources are misconfigured (e.g., omitted).
47177
+ *
47178
+ * Configuration options - {@link ErrorScreenPluginSettings}
47179
+ *
47180
+ * @example
47181
+ * ```ts
47182
+ * import { ErrorScreen, Player } from '@gcorevideo/player'
47183
+ *
47184
+ * Player.registerPlugin(ErrorScreen)
47185
+ * ```
47138
47186
  */
47139
47187
  class ErrorScreen extends UICorePlugin {
47140
47188
  err = null;
@@ -48178,18 +48226,6 @@ const DEFAULT_SETTINGS = {
48178
48226
  default: [],
48179
48227
  seekEnabled: true,
48180
48228
  };
48181
- /**
48182
- * Custom events emitted by the plugins to communicate with one another
48183
- * @beta
48184
- * @deprecated
48185
- */
48186
- var MediaControlEvents;
48187
- (function (MediaControlEvents) {
48188
- /**
48189
- * Emitted when the gear menu is rendered
48190
- */
48191
- MediaControlEvents["MEDIACONTROL_GEAR_RENDERED"] = "mediacontrol:gear:rendered";
48192
- })(MediaControlEvents || (MediaControlEvents = {}));
48193
48229
  const T$9 = 'plugins.media_control';
48194
48230
  const LEFT_ORDER = [
48195
48231
  'playpause',
@@ -50686,27 +50722,29 @@ class SkipTime extends UICorePlugin {
50686
50722
 
50687
50723
  const spinnerHTML = "<div data-bounce1></div>\n<div data-bounce2></div>\n<div data-bounce3></div>\n";
50688
50724
 
50725
+ // This work is based on the original work of Globo.com
50689
50726
  // Copyright 2014 Globo.com Player authors. All rights reserved.
50690
50727
  // Use of this source code is governed by a BSD-style
50691
50728
  // license that can be found in the LICENSE file.
50729
+ // https://github.com/clappr/clappr-plugins/blob/ffaa9d27005fa5a8a7c243ffc47eb5655b84b371/LICENSE
50692
50730
  const T$4 = 'plugins.spinner';
50693
50731
  /**
50694
50732
  * Custom events emitted by the plugin
50695
- * @beta
50733
+ * @public
50696
50734
  */
50697
50735
  var SpinnerEvents;
50698
50736
  (function (SpinnerEvents) {
50699
50737
  /**
50700
50738
  * Emitted at the end of the spinner animation cycle to facilitate smooth UI updates,
50701
- * e.g. {@link SourceController} listens to this event to reload the source when the spinner is hidden
50739
+ * for instance, {@link SourceController} listens to this event to reload the source when the spinner is hidden
50702
50740
  */
50703
50741
  SpinnerEvents["SYNC"] = "plugins:spinner:sync";
50704
50742
  })(SpinnerEvents || (SpinnerEvents = {}));
50705
50743
  /**
50706
- * `PLUGIN` that shows a pending operation indicator when playback is buffering or in a similar state
50707
- * @beta
50744
+ * `PLUGIN` that shows a pending operation indicator when playback is buffering or in a similar state.
50745
+ * @public
50708
50746
  * @remarks
50709
- * Events emitted- {@link SpinnerEvents}
50747
+ * Events emitted - {@link SpinnerEvents}
50710
50748
  * Other plugins can use {@link SpinnerThreeBounce.show | show} and {@link SpinnerThreeBounce.hide | hide} methods to
50711
50749
  * implement custom pending/progress indication scenarios.
50712
50750
  */
@@ -50779,7 +50817,9 @@ class SpinnerThreeBounce extends UIContainerPlugin {
50779
50817
  /**
50780
50818
  * Shows the spinner.
50781
50819
  *
50782
- * When called, the spinner will not hide (due to its built-in logic) until {@link SpinnerThreeBounce.hide} is called
50820
+ * The method call prevents spinner's built-in logic from automatically hiding it until {@link SpinnerThreeBounce.hide} is called
50821
+ *
50822
+ * @param delay - The delay in milliseconds before the spinner is shown.
50783
50823
  */
50784
50824
  show(delay = 300) {
50785
50825
  trace(`${T$4} show`);
@@ -50846,11 +50886,47 @@ function noSync(cb) {
50846
50886
  queueMicrotask(cb);
50847
50887
  }
50848
50888
  /**
50849
- * `PLUGIN` that is responsible for managing the automatic failover between sources.
50850
- * @beta
50889
+ * `PLUGIN` that is managing the automatic failover between media sources.
50890
+ * @public
50851
50891
  * @remarks
50852
50892
  * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details
50853
- * on how sources ordering and selection works.
50893
+ * on how sources ordering and selection works. Below is a simplified diagram:
50894
+ *
50895
+ * ```markdown
50896
+ * sources_list:
50897
+ * - a.mpd | +--------------------+
50898
+ * - b.m3u8 |--->| init |
50899
+ * - ... | |--------------------|
50900
+ * | current_source = 0 |
50901
+ * +--------------------+
50902
+ * |
50903
+ * | source = a.mpd
50904
+ * | playback = dash.js
50905
+ * v
50906
+ * +------------------+
50907
+ * +-->| load source |
50908
+ * | +---------|--------+
50909
+ * | v
50910
+ * | +------------------+
50911
+ * | | play |
50912
+ * | +---------|--------+
50913
+ * | |
50914
+ * | v
50915
+ * | +-----------------------+
50916
+ * | | on playback_error |
50917
+ * | |-----------------------|
50918
+ * | | current_source = |
50919
+ * | | (current_source + 1) |
50920
+ * | | % len sources_list |
50921
+ * | | |
50922
+ * | | delay 1..3s |
50923
+ * | +---------------|-------+
50924
+ * | |
50925
+ * | source=b.m3u8 |
50926
+ * | playback=hls.js |
50927
+ * +-------------------+
50928
+ *
50929
+ * ```
50854
50930
  *
50855
50931
  * This plugin does not expose any public methods apart from required by the Clappr plugin interface.
50856
50932
  * It is supposed to work autonomously.
@@ -50900,6 +50976,7 @@ class SourceController extends CorePlugin {
50900
50976
  * | playback=hls.js |
50901
50977
  * +-------------------+
50902
50978
  *
50979
+ * As can be seen from the diagram, the plugin will endless try to load the next sources rotating between them in round-robin manner.
50903
50980
  */
50904
50981
  sourcesList = [];
50905
50982
  currentSourceIndex = 0;
@@ -50920,7 +50997,7 @@ class SourceController extends CorePlugin {
50920
50997
  return { min: CLAPPR_VERSION };
50921
50998
  }
50922
50999
  /**
50923
- * @internal
51000
+ * @param core - The Clappr core instance.
50924
51001
  */
50925
51002
  constructor(core) {
50926
51003
  super(core);
@@ -51064,7 +51141,7 @@ const T$2 = 'plugins.cc';
51064
51141
  * @beta
51065
51142
  *
51066
51143
  * @remarks
51067
- * The plugin is activated when closed captions tracks are provided with the media source.
51144
+ * The plugin is activated when closed captions tracks are detected in the media source.
51068
51145
  * It shows a familiar "CC" button with a dropdown menu to select the subtitles language.
51069
51146
  *
51070
51147
  * Depends on:
@@ -51081,7 +51158,7 @@ const T$2 = 'plugins.cc';
51081
51158
  * new Player({
51082
51159
  * ...
51083
51160
  * cc: {
51084
- * language: 'en',
51161
+ * language: 'pt-BR',
51085
51162
  * },
51086
51163
  * })
51087
51164
  * ```
@@ -52234,4 +52311,4 @@ class VolumeFade extends UICorePlugin {
52234
52311
  }
52235
52312
  }
52236
52313
 
52237
- export { AudioSelector, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, LevelSelector, LogTracer, Logger, Logo, MediaControl, MediaControlEvents, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };
52314
+ export { AudioSelector, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, LevelSelector, LogTracer, Logger, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };