@gcorevideo/player 2.20.12 → 2.20.14

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 (53) hide show
  1. package/assets/error-screen/error_screen.ejs +1 -1
  2. package/dist/core.js +26 -2
  3. package/dist/index.css +1191 -1191
  4. package/dist/index.js +35 -20
  5. package/dist/player.d.ts +8 -10
  6. package/dist/plugins/index.css +1606 -1606
  7. package/dist/plugins/index.js +10 -14
  8. package/docs/api/player.md +1 -1
  9. package/docs/api/player.mediacontrol.md +2 -11
  10. package/docs/api/player.playbackerror.md +2 -2
  11. package/docs/api/player.playbackerror.origin.md +1 -1
  12. package/docs/api/player.playbackerror.scope.md +1 -1
  13. package/docs/api/player.poster.md +1 -1
  14. package/docs/api/player.sourcecontroller.md +2 -33
  15. package/lib/Player.js +1 -1
  16. package/lib/playback/HTML5Video.d.ts +5 -0
  17. package/lib/playback/HTML5Video.d.ts.map +1 -1
  18. package/lib/playback/HTML5Video.js +21 -0
  19. package/lib/playback/hls-playback/HlsPlayback.d.ts +2 -2
  20. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  21. package/lib/playback/hls-playback/HlsPlayback.js +4 -0
  22. package/lib/playback.types.d.ts +2 -2
  23. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  24. package/lib/plugins/click-to-pause/ClickToPause.js +0 -4
  25. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
  26. package/lib/plugins/dvr-controls/DvrControls.js +0 -1
  27. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
  28. package/lib/plugins/error-screen/ErrorScreen.js +1 -0
  29. package/lib/plugins/media-control/MediaControl.d.ts +1 -8
  30. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  31. package/lib/plugins/media-control/MediaControl.js +2 -9
  32. package/lib/plugins/poster/Poster.d.ts +2 -0
  33. package/lib/plugins/poster/Poster.d.ts.map +1 -1
  34. package/lib/plugins/poster/Poster.js +3 -3
  35. package/lib/plugins/source-controller/SourceController.d.ts +3 -0
  36. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
  37. package/lib/plugins/source-controller/SourceController.js +3 -0
  38. package/package.json +1 -1
  39. package/src/Player.ts +1 -1
  40. package/src/playback/HTML5Video.ts +29 -1
  41. package/src/playback/__tests__/HTML5Video.test.ts +47 -0
  42. package/src/playback/hls-playback/HlsPlayback.ts +5 -1
  43. package/src/playback.types.ts +2 -2
  44. package/src/plugins/click-to-pause/ClickToPause.ts +0 -5
  45. package/src/plugins/dvr-controls/DvrControls.ts +0 -1
  46. package/src/plugins/error-screen/ErrorScreen.ts +1 -0
  47. package/src/plugins/error-screen/__tests__/__snapshots__/ErrorScreen.test.ts.snap +1 -1
  48. package/src/plugins/media-control/MediaControl.ts +2 -9
  49. package/src/plugins/poster/Poster.ts +4 -3
  50. package/src/plugins/source-controller/SourceController.ts +3 -0
  51. package/temp/player.api.json +6 -40
  52. package/tsconfig.tsbuildinfo +1 -1
  53. package/docs/api/player.sourcecontroller._constructor_.md +0 -50
@@ -504,7 +504,7 @@ export default class HlsPlayback extends BasePlayback {
504
504
  this.trigger(Events.PLAYBACK_READY, this.name)
505
505
  }
506
506
 
507
- _recover(evt: HlsEvents.ERROR, data: HlsErrorData, error: PlaybackError) {
507
+ private _recover(evt: HlsEvents.ERROR, data: HlsErrorData, error: PlaybackError) {
508
508
  assert(this._hls, 'Hls.js instance is not available')
509
509
  if (!this._recoveredDecodingError) {
510
510
  this._recoveredDecodingError = true
@@ -690,6 +690,10 @@ export default class HlsPlayback extends BasePlayback {
690
690
  details: data.details,
691
691
  })
692
692
  error.level = PlayerError.Levels.WARN
693
+ // TODO check
694
+ // if (data.error instanceof MediaError && data.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
695
+ // error.code = PlaybackErrorCode.MediaSourceUnavailable
696
+ // }
693
697
  this._recover(evt, data, error)
694
698
  break
695
699
  default:
@@ -109,7 +109,7 @@ export interface PlaybackError {
109
109
  */
110
110
  message: string
111
111
  /**
112
- * Exact component that originated the error.
112
+ * Name of the component that originated the error.
113
113
  * @example
114
114
  * - 'core'
115
115
  * - 'dash'
@@ -117,7 +117,7 @@ export interface PlaybackError {
117
117
  */
118
118
  origin: string
119
119
  /**
120
- * Component subsystem of the error origin
120
+ * Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.
121
121
  */
122
122
  scope: PlayerComponentType
123
123
 
@@ -70,11 +70,6 @@ export class ClickToPause extends ContainerPlugin {
70
70
  const isLivePlayback = this.container.getPlaybackType() === Playback.LIVE
71
71
  const pointerEnabled = !isLivePlayback || this.container.isDvrEnabled()
72
72
 
73
- trace(`${T} settingsUpdate`, {
74
- isLivePlayback,
75
- pointerEnabled,
76
- })
77
-
78
73
  if (pointerEnabled === this.pointerEnabled) {
79
74
  return
80
75
  }
@@ -129,7 +129,6 @@ export class DvrControls extends UICorePlugin {
129
129
  }
130
130
 
131
131
  private settingsUpdate() {
132
- trace(`${T} settingsUpdate`)
133
132
  this.core.getPlugin('media_control').$el.removeClass('live')
134
133
  this.render()
135
134
  }
@@ -151,6 +151,7 @@ export class ErrorScreen extends UICorePlugin {
151
151
  ErrorScreen.template({
152
152
  ...this.err,
153
153
  reloadIcon: this.options.errorScreen?.noReload ? null : reloadIcon,
154
+ i18n: this.core.i18n,
154
155
  }),
155
156
  )
156
157
 
@@ -10,7 +10,7 @@ exports[`ErrorScreen > on error > targeted at UI > should render 1`] = `
10
10
  <div class="player-error-screen__message" data-error-screen="">Lorem ipsum dolor sit amet</div>
11
11
 
12
12
 
13
- <div class="player-error-screen__code" data-error-screen="">Error code: foo</div>
13
+ <div class="player-error-screen__code" data-error-screen="">error_code: foo</div>
14
14
 
15
15
 
16
16
  <div class="player-error-screen__reload" data-error-screen="">/assets/icons/old/reload.svg</div>
@@ -19,6 +19,7 @@ import { reportError, trace } from '@gcorevideo/utils'
19
19
 
20
20
  import { type TimeProgress } from '../../playback.types.js'
21
21
 
22
+ // TODO replace Kibo with mousetrap
22
23
  import { Kibo } from '../kibo/index.js'
23
24
 
24
25
  import { CLAPPR_VERSION } from '../../build.js'
@@ -90,17 +91,10 @@ type DisabledClickable = {
90
91
  }
91
92
 
92
93
  /**
93
- * `PLUGIN` that provides a foundation for developing custom media controls UI.
94
+ * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
94
95
  * @beta
95
96
  * @remarks
96
97
  * The methods exposed are to be used by the other plugins that extend the media control UI.
97
- * The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
98
- * @example
99
- * ```ts
100
- * Player.registerPlugin(MediaControl) // <--- This must go first
101
- * Player.registerPlugin(LevelSelector) // a media control plugin
102
- * Player.registerPlugin(NerdStats) // another media control plugin
103
- * ```
104
98
  */
105
99
  export class MediaControl extends UICorePlugin {
106
100
  private advertisementPlaying = false
@@ -1316,7 +1310,6 @@ export class MediaControl extends UICorePlugin {
1316
1310
  }
1317
1311
 
1318
1312
  private configure() {
1319
- // this.advertisementPlaying ? this.disable() : this.enable()
1320
1313
  this.trigger(Events.MEDIACONTROL_OPTIONS_CHANGE)
1321
1314
  }
1322
1315
 
@@ -9,7 +9,6 @@ import {
9
9
  UIContainerPlugin,
10
10
  template,
11
11
  $,
12
- Container,
13
12
  } from '@clappr/core'
14
13
  import { trace } from '@gcorevideo/utils'
15
14
 
@@ -28,6 +27,8 @@ const T = 'plugins.poster'
28
27
  * @beta
29
28
  * @remarks
30
29
  * When the playback is stopped, media control UI is disabled.
30
+ * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
31
+ * HTML5-video-based playback module.
31
32
  *
32
33
  * Configuration options:
33
34
  *
@@ -51,6 +52,8 @@ const T = 'plugins.poster'
51
52
  * ```
52
53
  */
53
54
  export class Poster extends UIContainerPlugin {
55
+ // TODO merge non-poster related functionality into the ClickToPause plugin
56
+
54
57
  private hasFatalError = false
55
58
 
56
59
  private hasStartedPlaying = false
@@ -236,8 +239,6 @@ export class Poster extends UIContainerPlugin {
236
239
  this.container.playback.consent()
237
240
  this.container.playback.play()
238
241
  }
239
- } else {
240
- this.container.trigger('container:start')
241
242
  }
242
243
 
243
244
  return false
@@ -108,6 +108,9 @@ export class SourceController extends CorePlugin {
108
108
  return { min: CLAPPR_VERSION }
109
109
  }
110
110
 
111
+ /**
112
+ * @internal
113
+ */
111
114
  constructor(core: ClapprCore) {
112
115
  super(core)
113
116
  this.sourcesList = this.core.options.sources
@@ -2594,7 +2594,7 @@
2594
2594
  {
2595
2595
  "kind": "Class",
2596
2596
  "canonicalReference": "@gcorevideo/player!MediaControl:class",
2597
- "docComment": "/**\n * `PLUGIN` that provides a foundation for developing custom media controls UI.\n *\n * @remarks\n *\n * The methods exposed are to be used by the other plugins that extend the media control UI. The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.\n *\n * @example\n * ```ts\n * Player.registerPlugin(MediaControl) // <--- This must go first\n * Player.registerPlugin(LevelSelector) // a media control plugin\n * Player.registerPlugin(NerdStats) // another media control plugin\n * ```\n *\n * @beta\n */\n",
2597
+ "docComment": "/**\n * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.\n *\n * @remarks\n *\n * The methods exposed are to be used by the other plugins that extend the media control UI.\n *\n * @beta\n */\n",
2598
2598
  "excerptTokens": [
2599
2599
  {
2600
2600
  "kind": "Content",
@@ -3737,7 +3737,7 @@
3737
3737
  {
3738
3738
  "kind": "PropertySignature",
3739
3739
  "canonicalReference": "@gcorevideo/player!PlaybackError#origin:member",
3740
- "docComment": "/**\n * Exact component that originated the error.\n *\n * @example\n *\n * - 'core' - 'dash' - 'media_control'\n */\n",
3740
+ "docComment": "/**\n * Name of the component that originated the error.\n *\n * @example\n *\n * - 'core' - 'dash' - 'media_control'\n */\n",
3741
3741
  "excerptTokens": [
3742
3742
  {
3743
3743
  "kind": "Content",
@@ -3764,7 +3764,7 @@
3764
3764
  {
3765
3765
  "kind": "PropertySignature",
3766
3766
  "canonicalReference": "@gcorevideo/player!PlaybackError#scope:member",
3767
- "docComment": "/**\n * Component subsystem of the error origin\n */\n",
3767
+ "docComment": "/**\n * Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.\n */\n",
3768
3768
  "excerptTokens": [
3769
3769
  {
3770
3770
  "kind": "Content",
@@ -5998,7 +5998,7 @@
5998
5998
  {
5999
5999
  "kind": "Class",
6000
6000
  "canonicalReference": "@gcorevideo/player!Poster:class",
6001
- "docComment": "/**\n * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped\n *\n * @remarks\n *\n * When the playback is stopped, media control UI is disabled.\n *\n * Configuration options:\n *\n * - `poster.custom` - custom CSS background\n *\n * - `poster.showForNoOp` - whether to show the poster when the playback is not started\n *\n * - `poster.url` - the URL of the poster image\n *\n * - `poster.showOnVideoEnd` - whether to show the poster when the playback is ended\n *\n * @example\n * ```ts\n * new Player({\n * ...\n * poster: {\n * showForNoOp: true,\n * url: 'https://via.placeholder.com/150.png',\n * }\n * })\n * ```\n *\n * @beta\n */\n",
6001
+ "docComment": "/**\n * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped\n *\n * @remarks\n *\n * When the playback is stopped, media control UI is disabled. Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the HTML5-video-based playback module.\n *\n * Configuration options:\n *\n * - `poster.custom` - custom CSS background\n *\n * - `poster.showForNoOp` - whether to show the poster when the playback is not started\n *\n * - `poster.url` - the URL of the poster image\n *\n * - `poster.showOnVideoEnd` - whether to show the poster when the playback is ended\n *\n * @example\n * ```ts\n * new Player({\n * ...\n * poster: {\n * showForNoOp: true,\n * url: 'https://via.placeholder.com/150.png',\n * }\n * })\n * ```\n *\n * @beta\n */\n",
6002
6002
  "excerptTokens": [
6003
6003
  {
6004
6004
  "kind": "Content",
@@ -7659,7 +7659,7 @@
7659
7659
  {
7660
7660
  "kind": "Class",
7661
7661
  "canonicalReference": "@gcorevideo/player!SourceController:class",
7662
- "docComment": "/**\n * `PLUGIN` that is responsible for managing the automatic failover between sources.\n *\n * @remarks\n *\n * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details on how sources ordering and selection works.\n *\n * This plugin does not expose any public methods apart from required by the Clappr plugin interface. It is supposed to work autonomously.\n *\n * @example\n * ```ts\n * import { SourceController } from '@gcorevideo/player'\n *\n * Player.registerPlugin(SourceController)\n * ```\n *\n * @beta\n */\n",
7662
+ "docComment": "/**\n * `PLUGIN` that is responsible for managing the automatic failover between sources.\n *\n * @remarks\n *\n * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details on how sources ordering and selection works.\n *\n * This plugin does not expose any public methods apart from required by the Clappr plugin interface. It is supposed to work autonomously.\n *\n * The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SourceController` class.\n *\n * @example\n * ```ts\n * import { SourceController } from '@gcorevideo/player'\n *\n * Player.registerPlugin(SourceController)\n * ```\n *\n * @beta\n */\n",
7663
7663
  "excerptTokens": [
7664
7664
  {
7665
7665
  "kind": "Content",
@@ -7680,41 +7680,7 @@
7680
7680
  "isAbstract": false,
7681
7681
  "name": "SourceController",
7682
7682
  "preserveMemberOrder": false,
7683
- "members": [
7684
- {
7685
- "kind": "Constructor",
7686
- "canonicalReference": "@gcorevideo/player!SourceController:constructor(1)",
7687
- "docComment": "/**\n * Constructs a new instance of the `SourceController` class\n */\n",
7688
- "excerptTokens": [
7689
- {
7690
- "kind": "Content",
7691
- "text": "constructor(core: "
7692
- },
7693
- {
7694
- "kind": "Reference",
7695
- "text": "ClapprCore",
7696
- "canonicalReference": "@clappr/core!default:class"
7697
- },
7698
- {
7699
- "kind": "Content",
7700
- "text": ");"
7701
- }
7702
- ],
7703
- "releaseTag": "Beta",
7704
- "isProtected": false,
7705
- "overloadIndex": 1,
7706
- "parameters": [
7707
- {
7708
- "parameterName": "core",
7709
- "parameterTypeTokenRange": {
7710
- "startIndex": 1,
7711
- "endIndex": 2
7712
- },
7713
- "isOptional": false
7714
- }
7715
- ]
7716
- }
7717
- ],
7683
+ "members": [],
7718
7684
  "extendsTokenRange": {
7719
7685
  "startIndex": 1,
7720
7686
  "endIndex": 2