@gcorevideo/player 2.16.17 → 2.17.0

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 (37) hide show
  1. package/README.md +68 -19
  2. package/dist/index.js +93 -19
  3. package/dist/player.d.ts +82 -51
  4. package/docs/api/index.md +1 -1
  5. package/docs/api/player.md +2 -2
  6. package/docs/api/player.playbackerrorcode.md +4 -4
  7. package/docs/api/player.player.attachto.md +26 -0
  8. package/docs/api/player.player.configure.md +6 -2
  9. package/docs/api/player.player.destroy.md +1 -1
  10. package/docs/api/player.player.getcurrenttime.md +6 -2
  11. package/docs/api/player.player.getduration.md +4 -0
  12. package/docs/api/player.player.getvolume.md +22 -0
  13. package/docs/api/player.player.isdvrenabled.md +20 -0
  14. package/docs/api/player.player.isplaying.md +20 -0
  15. package/docs/api/player.player.md +62 -8
  16. package/docs/api/player.player.mute.md +1 -1
  17. package/docs/api/player.player.off.md +1 -1
  18. package/docs/api/player.player.registerplugin.md +14 -1
  19. package/docs/api/player.player.resize.md +4 -0
  20. package/docs/api/player.player.seek.md +1 -1
  21. package/docs/api/player.player.setvolume.md +56 -0
  22. package/docs/api/player.player.unmute.md +1 -1
  23. package/docs/api/player.player.unregisterplugin.md +2 -2
  24. package/lib/Player.d.ts +79 -14
  25. package/lib/Player.d.ts.map +1 -1
  26. package/lib/Player.js +91 -14
  27. package/lib/index.d.ts +2 -3
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +2 -3
  30. package/package.json +1 -1
  31. package/rollup.config.js +1 -1
  32. package/src/Player.ts +95 -15
  33. package/src/__tests__/Player.test.ts +9 -3
  34. package/src/index.ts +2 -3
  35. package/src/utils/__tests__/mediaSources.test.ts +8 -2
  36. package/temp/player.api.json +162 -21
  37. package/tsconfig.tsbuildinfo +1 -1
@@ -162,7 +162,7 @@
162
162
  },
163
163
  "kind": "Package",
164
164
  "canonicalReference": "@gcorevideo/player!",
165
- "docComment": "/**\n * Video player for the GCore streaming platform\n *\n * @remarks\n *\n * This package provides a video player for the GCore streaming platform. It is built on top of the Clappr library and provides a framework for building custom integrations.\n *\n * @packageDocumentation\n */\n",
165
+ "docComment": "/**\n * Video player for the Gcore streaming platform\n *\n * @remarks\n *\n * This package provides a video player for the Gcore streaming platform. It is built on top of the Clappr library and provides a framework for building custom integrations.\n *\n * @packageDocumentation\n */\n",
166
166
  "name": "@gcorevideo/player",
167
167
  "preserveMemberOrder": false,
168
168
  "members": [
@@ -447,16 +447,16 @@
447
447
  },
448
448
  {
449
449
  "kind": "EnumMember",
450
- "canonicalReference": "@gcorevideo/player!PlaybackErrorCode.MediaSourceUnavailable:member",
450
+ "canonicalReference": "@gcorevideo/player!PlaybackErrorCode.MediaSourceAccessDenied:member",
451
451
  "docComment": "",
452
452
  "excerptTokens": [
453
453
  {
454
454
  "kind": "Content",
455
- "text": "MediaSourceUnavailable = "
455
+ "text": "MediaSourceAccessDenied = "
456
456
  },
457
457
  {
458
458
  "kind": "Content",
459
- "text": "1"
459
+ "text": "3"
460
460
  }
461
461
  ],
462
462
  "initializerTokenRange": {
@@ -464,20 +464,20 @@
464
464
  "endIndex": 2
465
465
  },
466
466
  "releaseTag": "Beta",
467
- "name": "MediaSourceUnavailable"
467
+ "name": "MediaSourceAccessDenied"
468
468
  },
469
469
  {
470
470
  "kind": "EnumMember",
471
- "canonicalReference": "@gcorevideo/player!PlaybackErrorCode.QualityLevelUnavailable:member",
471
+ "canonicalReference": "@gcorevideo/player!PlaybackErrorCode.MediaSourceUnavailable:member",
472
472
  "docComment": "",
473
473
  "excerptTokens": [
474
474
  {
475
475
  "kind": "Content",
476
- "text": "QualityLevelUnavailable = "
476
+ "text": "MediaSourceUnavailable = "
477
477
  },
478
478
  {
479
479
  "kind": "Content",
480
- "text": "2"
480
+ "text": "1"
481
481
  }
482
482
  ],
483
483
  "initializerTokenRange": {
@@ -485,7 +485,7 @@
485
485
  "endIndex": 2
486
486
  },
487
487
  "releaseTag": "Beta",
488
- "name": "QualityLevelUnavailable"
488
+ "name": "MediaSourceUnavailable"
489
489
  }
490
490
  ]
491
491
  },
@@ -593,7 +593,7 @@
593
593
  {
594
594
  "kind": "Method",
595
595
  "canonicalReference": "@gcorevideo/player!Player#attachTo:member(1)",
596
- "docComment": "/**\n * Initializes the player at the given container element.\n *\n * @param playerElement - DOM element to host the player\n */\n",
596
+ "docComment": "/**\n * Initializes the player at the given container element.\n *\n * @remarks\n *\n * The player will be initialized and attached to the given element.\n *\n * All the core plugins will be initialized at this point.\n *\n * If no sources were configured, it will trigger an error.\n *\n * The player container will be initialized and then all the registered UI plugins.\n *\n * If the `autoPlay` option is set, then it will trigger playback immediately.\n *\n * It is an error to call this method twice. If you need to attache player to another DOM element, first call {@link Player.destroy} and then {@link Player.attachTo}.\n *\n * @param playerElement - DOM element to host the player\n *\n * @example\n * ```ts\n * const player = new Player({\n * sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],\n * })\n * document.addEventListener('DOMContentLoaded', () => {\n * player.attachTo(document.getElementById('video-container'))\n * })\n * ```\n *\n */\n",
597
597
  "excerptTokens": [
598
598
  {
599
599
  "kind": "Content",
@@ -642,7 +642,7 @@
642
642
  {
643
643
  "kind": "Method",
644
644
  "canonicalReference": "@gcorevideo/player!Player#configure:member(1)",
645
- "docComment": "/**\n * Configures the player.\n *\n * Can be called multiple times. Each consequent call extends the previous configuration. After a reconfiguration, if something significant has changed, the must be reinitialized (i.e, a `.destroy()` followed by an `.init()` call).\n *\n * @param config - complete or partial configuration\n */\n",
645
+ "docComment": "/**\n * Configures the player.\n *\n * @remarks\n *\n * Can be called multiple times. Each consequent call extends the previous configuration with only the new keys overridden.\n *\n * After a reconfiguration, if something significant has changed, it might make sense reinitialize the player (i.e, a `.destroy()` followed by an `.init()` call).\n *\n * @param config - complete or partial configuration\n */\n",
646
646
  "excerptTokens": [
647
647
  {
648
648
  "kind": "Content",
@@ -704,7 +704,7 @@
704
704
  {
705
705
  "kind": "Method",
706
706
  "canonicalReference": "@gcorevideo/player!Player#destroy:member(1)",
707
- "docComment": "/**\n * Destroys the player, releasing all resources and removing any DOM elements added.\n */\n",
707
+ "docComment": "/**\n * Destroys the player, releasing all resources and unmounting its UI from the DOM.\n */\n",
708
708
  "excerptTokens": [
709
709
  {
710
710
  "kind": "Content",
@@ -735,7 +735,7 @@
735
735
  {
736
736
  "kind": "Method",
737
737
  "canonicalReference": "@gcorevideo/player!Player#getCurrentTime:member(1)",
738
- "docComment": "/**\n * Current playback time in seconds, if appropriate.\n *\n * @returns For live streams, it returns the current time of the current segment.\n */\n",
738
+ "docComment": "/**\n * Current playback (time since the beginning of the stream), if appropriate.\n *\n * @remarks\n *\n * For live streams, it returns the current time within the current segment.\n *\n * @returns Time in seconds\n */\n",
739
739
  "excerptTokens": [
740
740
  {
741
741
  "kind": "Content",
@@ -766,7 +766,7 @@
766
766
  {
767
767
  "kind": "Method",
768
768
  "canonicalReference": "@gcorevideo/player!Player#getDuration:member(1)",
769
- "docComment": "/**\n * Duration of the current media in seconds, if appropriate.\n *\n * @returns For live streams, it returns the duration of the current segment.\n */\n",
769
+ "docComment": "/**\n * Duration of the current media in seconds, if appropriate.\n *\n * @remarks\n *\n * For live streams, it returns the duration of the current segment.\n *\n * @returns Time in seconds\n */\n",
770
770
  "excerptTokens": [
771
771
  {
772
772
  "kind": "Content",
@@ -794,10 +794,103 @@
794
794
  "isAbstract": false,
795
795
  "name": "getDuration"
796
796
  },
797
+ {
798
+ "kind": "Method",
799
+ "canonicalReference": "@gcorevideo/player!Player#getVolume:member(1)",
800
+ "docComment": "/**\n * Gets the current volume of the media content being played.\n *\n * @returns a number between 0 and 1\n */\n",
801
+ "excerptTokens": [
802
+ {
803
+ "kind": "Content",
804
+ "text": "getVolume(): "
805
+ },
806
+ {
807
+ "kind": "Content",
808
+ "text": "number"
809
+ },
810
+ {
811
+ "kind": "Content",
812
+ "text": ";"
813
+ }
814
+ ],
815
+ "isStatic": false,
816
+ "returnTypeTokenRange": {
817
+ "startIndex": 1,
818
+ "endIndex": 2
819
+ },
820
+ "releaseTag": "Beta",
821
+ "isProtected": false,
822
+ "overloadIndex": 1,
823
+ "parameters": [],
824
+ "isOptional": false,
825
+ "isAbstract": false,
826
+ "name": "getVolume"
827
+ },
828
+ {
829
+ "kind": "Method",
830
+ "canonicalReference": "@gcorevideo/player!Player#isDvrEnabled:member(1)",
831
+ "docComment": "/**\n * Indicates whether DVR is enabled.\n */\n",
832
+ "excerptTokens": [
833
+ {
834
+ "kind": "Content",
835
+ "text": "isDvrEnabled(): "
836
+ },
837
+ {
838
+ "kind": "Content",
839
+ "text": "boolean"
840
+ },
841
+ {
842
+ "kind": "Content",
843
+ "text": ";"
844
+ }
845
+ ],
846
+ "isStatic": false,
847
+ "returnTypeTokenRange": {
848
+ "startIndex": 1,
849
+ "endIndex": 2
850
+ },
851
+ "releaseTag": "Beta",
852
+ "isProtected": false,
853
+ "overloadIndex": 1,
854
+ "parameters": [],
855
+ "isOptional": false,
856
+ "isAbstract": false,
857
+ "name": "isDvrEnabled"
858
+ },
859
+ {
860
+ "kind": "Method",
861
+ "canonicalReference": "@gcorevideo/player!Player#isPlaying:member(1)",
862
+ "docComment": "/**\n * Indicates the playing state of the player.\n */\n",
863
+ "excerptTokens": [
864
+ {
865
+ "kind": "Content",
866
+ "text": "isPlaying(): "
867
+ },
868
+ {
869
+ "kind": "Content",
870
+ "text": "boolean"
871
+ },
872
+ {
873
+ "kind": "Content",
874
+ "text": ";"
875
+ }
876
+ ],
877
+ "isStatic": false,
878
+ "returnTypeTokenRange": {
879
+ "startIndex": 1,
880
+ "endIndex": 2
881
+ },
882
+ "releaseTag": "Beta",
883
+ "isProtected": false,
884
+ "overloadIndex": 1,
885
+ "parameters": [],
886
+ "isOptional": false,
887
+ "isAbstract": false,
888
+ "name": "isPlaying"
889
+ },
797
890
  {
798
891
  "kind": "Method",
799
892
  "canonicalReference": "@gcorevideo/player!Player#mute:member(1)",
800
- "docComment": "/**\n * Mutes the player.\n */\n",
893
+ "docComment": "/**\n * Mutes the sound of the video.\n */\n",
801
894
  "excerptTokens": [
802
895
  {
803
896
  "kind": "Content",
@@ -828,7 +921,7 @@
828
921
  {
829
922
  "kind": "Method",
830
923
  "canonicalReference": "@gcorevideo/player!Player#off:member(1)",
831
- "docComment": "/**\n * Removes a listener from a player event\n *\n * @param event - See {@link PlayerEvent}\n *\n * @param handler - See {@link PlayerEventHandler}\n */\n",
924
+ "docComment": "/**\n * Removes a previously added event listener\n *\n * @param event - See {@link PlayerEvent}\n *\n * @param handler - See {@link PlayerEventHandler}\n */\n",
832
925
  "excerptTokens": [
833
926
  {
834
927
  "kind": "Content",
@@ -1072,7 +1165,7 @@
1072
1165
  {
1073
1166
  "kind": "Method",
1074
1167
  "canonicalReference": "@gcorevideo/player!Player.registerPlugin:member(1)",
1075
- "docComment": "/**\n * Registers a plugin.\n *\n * @param plugin - plugin to register\n */\n",
1168
+ "docComment": "/**\n * Registers a plugin.\n *\n * @remarks\n *\n * Use this method to extend the player with custom behavior. The plugin class must inherit from one of the Clappr UIPlugin, UIContainerPlugin or CorePlugin classes. A core plugin will be initialized and attached to the player when the player is initialized. A UI plugin will be initialized and attached to the player container is initialized.\n *\n * @param plugin - a plugin class\n *\n * @example\n * ```ts\n * import MyPlugin from './MyPlugin.js'\n *\n * Player.registerPlugin(MyPlugin)\n * ```\n *\n * @see\n *\n * {@link https://github.com/clappr/clappr/wiki/Architecture}\n */\n",
1076
1169
  "excerptTokens": [
1077
1170
  {
1078
1171
  "kind": "Content",
@@ -1121,7 +1214,7 @@
1121
1214
  {
1122
1215
  "kind": "Method",
1123
1216
  "canonicalReference": "@gcorevideo/player!Player#resize:member(1)",
1124
- "docComment": "/**\n * Resizes the player container element and everything within it.\n *\n * @param newSize - new size of the player\n */\n",
1217
+ "docComment": "/**\n * Resizes the player container element and everything within it.\n *\n * @remarks\n *\n * Use this method when the player itself does not detect the change in size of its container element. It can be a case for orientation change on some mobile devices.\n *\n * @param newSize - new size of the player\n */\n",
1125
1218
  "excerptTokens": [
1126
1219
  {
1127
1220
  "kind": "Content",
@@ -1169,7 +1262,7 @@
1169
1262
  {
1170
1263
  "kind": "Method",
1171
1264
  "canonicalReference": "@gcorevideo/player!Player#seek:member(1)",
1172
- "docComment": "/**\n * Seeks to the given time.\n *\n * @param time - time to seek to in seconds\n */\n",
1265
+ "docComment": "/**\n * Seeks to the given time.\n *\n * @param time - time to seek to in seconds (since the beginning of the stream)\n */\n",
1173
1266
  "excerptTokens": [
1174
1267
  {
1175
1268
  "kind": "Content",
@@ -1214,6 +1307,54 @@
1214
1307
  "isAbstract": false,
1215
1308
  "name": "seek"
1216
1309
  },
1310
+ {
1311
+ "kind": "Method",
1312
+ "canonicalReference": "@gcorevideo/player!Player#setVolume:member(1)",
1313
+ "docComment": "/**\n * Sets the current volume of the media content being played.\n *\n * @param volume - a number between 0 and 1\n */\n",
1314
+ "excerptTokens": [
1315
+ {
1316
+ "kind": "Content",
1317
+ "text": "setVolume(volume: "
1318
+ },
1319
+ {
1320
+ "kind": "Content",
1321
+ "text": "number"
1322
+ },
1323
+ {
1324
+ "kind": "Content",
1325
+ "text": "): "
1326
+ },
1327
+ {
1328
+ "kind": "Content",
1329
+ "text": "void"
1330
+ },
1331
+ {
1332
+ "kind": "Content",
1333
+ "text": ";"
1334
+ }
1335
+ ],
1336
+ "isStatic": false,
1337
+ "returnTypeTokenRange": {
1338
+ "startIndex": 3,
1339
+ "endIndex": 4
1340
+ },
1341
+ "releaseTag": "Beta",
1342
+ "isProtected": false,
1343
+ "overloadIndex": 1,
1344
+ "parameters": [
1345
+ {
1346
+ "parameterName": "volume",
1347
+ "parameterTypeTokenRange": {
1348
+ "startIndex": 1,
1349
+ "endIndex": 2
1350
+ },
1351
+ "isOptional": false
1352
+ }
1353
+ ],
1354
+ "isOptional": false,
1355
+ "isAbstract": false,
1356
+ "name": "setVolume"
1357
+ },
1217
1358
  {
1218
1359
  "kind": "Method",
1219
1360
  "canonicalReference": "@gcorevideo/player!Player#stop:member(1)",
@@ -1248,7 +1389,7 @@
1248
1389
  {
1249
1390
  "kind": "Method",
1250
1391
  "canonicalReference": "@gcorevideo/player!Player#unmute:member(1)",
1251
- "docComment": "/**\n * Unmutes the player.\n */\n",
1392
+ "docComment": "/**\n * Unmutes the video sound.\n */\n",
1252
1393
  "excerptTokens": [
1253
1394
  {
1254
1395
  "kind": "Content",
@@ -1279,7 +1420,7 @@
1279
1420
  {
1280
1421
  "kind": "Method",
1281
1422
  "canonicalReference": "@gcorevideo/player!Player.unregisterPlugin:member(1)",
1282
- "docComment": "/**\n * Unregisters a plugin.\n *\n * @param plugin - plugin to unregister\n */\n",
1423
+ "docComment": "/**\n * Unregisters a plugin registered earlier with {@link Player.registerPlugin}.\n *\n * @param plugin - a plugin class\n */\n",
1283
1424
  "excerptTokens": [
1284
1425
  {
1285
1426
  "kind": "Content",