@gcorevideo/player 2.30.0 → 2.30.1

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 (34) hide show
  1. package/dist/core.js +65 -21
  2. package/dist/index.css +314 -314
  3. package/dist/index.embed.js +64 -22
  4. package/dist/index.js +65 -23
  5. package/docs/api/player.md +37 -0
  6. package/docs/api/player.player.getplugin.md +59 -0
  7. package/docs/api/player.player.md +14 -0
  8. package/docs/api/player.tokenrefreshoptions.gettoken.md +13 -0
  9. package/docs/api/player.tokenrefreshoptions.ipbound.md +13 -0
  10. package/docs/api/player.tokenrefreshoptions.md +115 -0
  11. package/docs/api/player.tokenrefreshoptions.ontokenrefreshed.md +13 -0
  12. package/docs/api/player.tokenrefreshoptions.refreshleadseconds.md +13 -0
  13. package/docs/api/player.tokenrefreshplugin.md +50 -0
  14. package/docs/api/player.tokenresponse.client_ip.md +13 -0
  15. package/docs/api/player.tokenresponse.expires.md +13 -0
  16. package/docs/api/player.tokenresponse.md +153 -0
  17. package/docs/api/player.tokenresponse.token.md +13 -0
  18. package/docs/api/player.tokenresponse.token_ip.md +13 -0
  19. package/docs/api/player.tokenresponse.url.md +13 -0
  20. package/docs/api/player.tokenresponse.url_ip.md +13 -0
  21. package/lib/playback/hls-playback/HlsPlayback.d.ts +1 -1
  22. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  23. package/lib/playback/hls-playback/HlsPlayback.js +23 -20
  24. package/lib/playback/hls-playback/RangesList.d.ts +7 -0
  25. package/lib/playback/hls-playback/RangesList.d.ts.map +1 -0
  26. package/lib/playback/hls-playback/RangesList.js +41 -0
  27. package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
  28. package/lib/plugins/subtitles/ClosedCaptions.js +0 -2
  29. package/package.json +1 -1
  30. package/src/playback/hls-playback/HlsPlayback.ts +40 -37
  31. package/src/playback/hls-playback/RangesList.ts +45 -0
  32. package/src/playback/hls-playback/__tests__/RangesList.test.ts +60 -0
  33. package/src/plugins/subtitles/ClosedCaptions.ts +0 -5
  34. package/tsconfig.tsbuildinfo +1 -1
@@ -49867,6 +49867,48 @@ Hls.defaultConfig = void 0;
49867
49867
  // export const CLAPPR_VERSION: string = process.env.CLAPPR_VERSION || '0.11.3';
49868
49868
  const CLAPPR_VERSION$1 = '0.13.0';
49869
49869
 
49870
+ class RangesList {
49871
+ // TODO write an efficient implementation
49872
+ items = [];
49873
+ insert(start, end, value) {
49874
+ const index = this.findIndex((start + end) / 2);
49875
+ this.items.splice(index, 0, [start, end, value]);
49876
+ }
49877
+ find(position) {
49878
+ const index = this.findIndex(position);
49879
+ const item = this.items[index];
49880
+ if (!item || item[0] > position || item[1] < position) {
49881
+ return null;
49882
+ }
49883
+ return item[2];
49884
+ }
49885
+ findIndex(position) {
49886
+ let low = 0;
49887
+ let high = this.items.length;
49888
+ let index = 0;
49889
+ while (low < high) {
49890
+ index = low + Math.floor((high - low) / 2);
49891
+ const item = this.items[index];
49892
+ if (item[0] > position) {
49893
+ if (index === low) {
49894
+ return index;
49895
+ }
49896
+ high = index;
49897
+ continue;
49898
+ }
49899
+ if (item[1] <= position) {
49900
+ if (index === high - 1) {
49901
+ return index + 1;
49902
+ }
49903
+ low = index + 1;
49904
+ continue;
49905
+ }
49906
+ break;
49907
+ }
49908
+ return index;
49909
+ }
49910
+ }
49911
+
49870
49912
  // Copyright 2014 Globo.com Player authors. All rights reserved.
49871
49913
  // Use of this source code is governed by a BSD-style
49872
49914
  // license that can be found on https://github.com/clappr/hlsjs-playback/blob/main/LICENSE
@@ -49876,7 +49918,6 @@ const DEFAULT_RECOVER_ATTEMPTS = 16;
49876
49918
  Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
49877
49919
  const T$7 = 'playback.hls';
49878
49920
  class HlsPlayback extends BasePlayback {
49879
- _ccTracksUpdated = false;
49880
49921
  _currentFragment = null;
49881
49922
  _currentLevel = null;
49882
49923
  _durationExcludesAfterLiveSyncPoint = false;
@@ -49901,7 +49942,8 @@ class HlsPlayback extends BasePlayback {
49901
49942
  _timeUpdateTimer = null;
49902
49943
  oncueenter = null;
49903
49944
  oncueexit = null;
49904
- cues = []; // TODO check the list size and use BST if needed
49945
+ cues = null;
49946
+ cuesByTrack = {};
49905
49947
  currentCueId = null;
49906
49948
  /**
49907
49949
  * @internal
@@ -50098,7 +50140,6 @@ class HlsPlayback extends BasePlayback {
50098
50140
  }
50099
50141
  this._manifestParsed = false;
50100
50142
  // this._ccIsSetup = false
50101
- this._ccTracksUpdated = false;
50102
50143
  this._setInitialState();
50103
50144
  this._hls.destroy();
50104
50145
  this._hls = null;
@@ -50152,12 +50193,20 @@ class HlsPlayback extends BasePlayback {
50152
50193
  this._hls.on(Events.AUDIO_TRACK_SWITCHED, (evt, data) => this._onAudioTrackSwitched(evt, data));
50153
50194
  this._hls.on(Events.CUES_PARSED, (evt, data) => {
50154
50195
  data.cues?.forEach((cue) => {
50155
- this.cues.push({
50196
+ if (!this.cues) {
50197
+ const trackId = this._hls.subtitleTrack;
50198
+ if (!this.cuesByTrack[trackId]) {
50199
+ this.cuesByTrack[trackId] = new RangesList();
50200
+ }
50201
+ this.cues = this.cuesByTrack[trackId];
50202
+ }
50203
+ const cueInfo = {
50156
50204
  id: cue.id,
50157
50205
  start: cue.startTime,
50158
50206
  end: cue.endTime,
50159
50207
  text: cue.text,
50160
- });
50208
+ };
50209
+ this.cues.insert(cue.startTime, cue.endTime, cueInfo);
50161
50210
  });
50162
50211
  });
50163
50212
  this.bindCustomListeners();
@@ -50384,7 +50433,7 @@ class HlsPlayback extends BasePlayback {
50384
50433
  }
50385
50434
  }
50386
50435
  reload() {
50387
- this.cues = [];
50436
+ this.cues = null;
50388
50437
  this.currentCueId = null;
50389
50438
  this._hls?.startLoad(-1);
50390
50439
  }
@@ -50449,9 +50498,7 @@ class HlsPlayback extends BasePlayback {
50449
50498
  }
50450
50499
  triggerCues() {
50451
50500
  const currentTime = this.getCurrentTime();
50452
- // const cues = Object.values(this.cues)
50453
- // TODO build a search tree
50454
- const cue = this.cues.find((cue) => currentTime >= cue.start && currentTime <= cue.end);
50501
+ const cue = this.cues?.find(currentTime);
50455
50502
  if (cue) {
50456
50503
  this.currentCueId = cue.id;
50457
50504
  this.oncueenter?.(cue);
@@ -50494,20 +50541,14 @@ class HlsPlayback extends BasePlayback {
50494
50541
  destroy() {
50495
50542
  this._stopTimeUpdateTimer();
50496
50543
  this._destroyHLSInstance();
50544
+ this.cues = null;
50545
+ this.cuesByTrack = {};
50497
50546
  return super.destroy();
50498
50547
  }
50499
50548
  _updatePlaybackType(evt, data) {
50500
50549
  const prevPlaybackType = this._playbackType;
50501
50550
  this._playbackType = (data.details.live ? Playback.LIVE : Playback.VOD);
50502
50551
  this._onLevelUpdated(evt, data);
50503
- // Live stream subtitle tracks detection hack (may not immediately available)
50504
- // if (
50505
- // this._ccTracksUpdated &&
50506
- // this._playbackType === Playback.LIVE &&
50507
- // this.hasClosedCaptionsTracks
50508
- // ) {
50509
- // this._onSubtitleLoaded()
50510
- // }
50511
50552
  if (prevPlaybackType !== this._playbackType) {
50512
50553
  this._updateSettings();
50513
50554
  }
@@ -50727,7 +50768,10 @@ class HlsPlayback extends BasePlayback {
50727
50768
  return;
50728
50769
  }
50729
50770
  this._hls.subtitleTrack = id;
50730
- this.cues = [];
50771
+ if (!this.cuesByTrack[id]) {
50772
+ this.cuesByTrack[id] = new RangesList();
50773
+ }
50774
+ this.cues = this.cuesByTrack[id];
50731
50775
  }
50732
50776
  /**
50733
50777
  * @override
@@ -50736,7 +50780,7 @@ class HlsPlayback extends BasePlayback {
50736
50780
  return this.getTextTracks();
50737
50781
  }
50738
50782
  getTextTracks() {
50739
- return this._hls?.subtitleTracks.map((t) => ({
50783
+ return (this._hls?.subtitleTracks.map((t) => ({
50740
50784
  id: t.id,
50741
50785
  name: t.name,
50742
50786
  track: {
@@ -50744,7 +50788,7 @@ class HlsPlayback extends BasePlayback {
50744
50788
  label: t.name,
50745
50789
  language: t.lang,
50746
50790
  },
50747
- })) || [];
50791
+ })) || []);
50748
50792
  }
50749
50793
  }
50750
50794
  HlsPlayback.canPlay = function (resource, mimeType) {
@@ -58849,8 +58893,6 @@ class ClosedCaptions extends UICorePlugin {
58849
58893
  // event.target does not exist for some reason in tests
58850
58894
  const id = Number((event.target ?? event.currentTarget).dataset?.item ??
58851
58895
  '-1');
58852
- // TODO review, make configurable, and emit event in addition
58853
- // localStorage.setItem(LOCAL_STORAGE_CC_ID, id) // TODO store language instead?
58854
58896
  this.userSelectedItemId = id;
58855
58897
  this.selectItem(this.findById(id));
58856
58898
  this.hideMenu();
package/dist/index.js CHANGED
@@ -50092,6 +50092,48 @@ Hls.defaultConfig = void 0;
50092
50092
  // export const CLAPPR_VERSION: string = process.env.CLAPPR_VERSION || '0.11.3';
50093
50093
  const CLAPPR_VERSION$1 = '0.13.0';
50094
50094
 
50095
+ class RangesList {
50096
+ // TODO write an efficient implementation
50097
+ items = [];
50098
+ insert(start, end, value) {
50099
+ const index = this.findIndex((start + end) / 2);
50100
+ this.items.splice(index, 0, [start, end, value]);
50101
+ }
50102
+ find(position) {
50103
+ const index = this.findIndex(position);
50104
+ const item = this.items[index];
50105
+ if (!item || item[0] > position || item[1] < position) {
50106
+ return null;
50107
+ }
50108
+ return item[2];
50109
+ }
50110
+ findIndex(position) {
50111
+ let low = 0;
50112
+ let high = this.items.length;
50113
+ let index = 0;
50114
+ while (low < high) {
50115
+ index = low + Math.floor((high - low) / 2);
50116
+ const item = this.items[index];
50117
+ if (item[0] > position) {
50118
+ if (index === low) {
50119
+ return index;
50120
+ }
50121
+ high = index;
50122
+ continue;
50123
+ }
50124
+ if (item[1] <= position) {
50125
+ if (index === high - 1) {
50126
+ return index + 1;
50127
+ }
50128
+ low = index + 1;
50129
+ continue;
50130
+ }
50131
+ break;
50132
+ }
50133
+ return index;
50134
+ }
50135
+ }
50136
+
50095
50137
  // Copyright 2014 Globo.com Player authors. All rights reserved.
50096
50138
  // Use of this source code is governed by a BSD-style
50097
50139
  // license that can be found on https://github.com/clappr/hlsjs-playback/blob/main/LICENSE
@@ -50101,7 +50143,6 @@ const DEFAULT_RECOVER_ATTEMPTS = 16;
50101
50143
  Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
50102
50144
  const T$e = 'playback.hls';
50103
50145
  class HlsPlayback extends BasePlayback {
50104
- _ccTracksUpdated = false;
50105
50146
  _currentFragment = null;
50106
50147
  _currentLevel = null;
50107
50148
  _durationExcludesAfterLiveSyncPoint = false;
@@ -50126,7 +50167,8 @@ class HlsPlayback extends BasePlayback {
50126
50167
  _timeUpdateTimer = null;
50127
50168
  oncueenter = null;
50128
50169
  oncueexit = null;
50129
- cues = []; // TODO check the list size and use BST if needed
50170
+ cues = null;
50171
+ cuesByTrack = {};
50130
50172
  currentCueId = null;
50131
50173
  /**
50132
50174
  * @internal
@@ -50323,7 +50365,6 @@ class HlsPlayback extends BasePlayback {
50323
50365
  }
50324
50366
  this._manifestParsed = false;
50325
50367
  // this._ccIsSetup = false
50326
- this._ccTracksUpdated = false;
50327
50368
  this._setInitialState();
50328
50369
  this._hls.destroy();
50329
50370
  this._hls = null;
@@ -50377,12 +50418,20 @@ class HlsPlayback extends BasePlayback {
50377
50418
  this._hls.on(Events.AUDIO_TRACK_SWITCHED, (evt, data) => this._onAudioTrackSwitched(evt, data));
50378
50419
  this._hls.on(Events.CUES_PARSED, (evt, data) => {
50379
50420
  data.cues?.forEach((cue) => {
50380
- this.cues.push({
50421
+ if (!this.cues) {
50422
+ const trackId = this._hls.subtitleTrack;
50423
+ if (!this.cuesByTrack[trackId]) {
50424
+ this.cuesByTrack[trackId] = new RangesList();
50425
+ }
50426
+ this.cues = this.cuesByTrack[trackId];
50427
+ }
50428
+ const cueInfo = {
50381
50429
  id: cue.id,
50382
50430
  start: cue.startTime,
50383
50431
  end: cue.endTime,
50384
50432
  text: cue.text,
50385
- });
50433
+ };
50434
+ this.cues.insert(cue.startTime, cue.endTime, cueInfo);
50386
50435
  });
50387
50436
  });
50388
50437
  this.bindCustomListeners();
@@ -50609,7 +50658,7 @@ class HlsPlayback extends BasePlayback {
50609
50658
  }
50610
50659
  }
50611
50660
  reload() {
50612
- this.cues = [];
50661
+ this.cues = null;
50613
50662
  this.currentCueId = null;
50614
50663
  this._hls?.startLoad(-1);
50615
50664
  }
@@ -50674,9 +50723,7 @@ class HlsPlayback extends BasePlayback {
50674
50723
  }
50675
50724
  triggerCues() {
50676
50725
  const currentTime = this.getCurrentTime();
50677
- // const cues = Object.values(this.cues)
50678
- // TODO build a search tree
50679
- const cue = this.cues.find((cue) => currentTime >= cue.start && currentTime <= cue.end);
50726
+ const cue = this.cues?.find(currentTime);
50680
50727
  if (cue) {
50681
50728
  this.currentCueId = cue.id;
50682
50729
  this.oncueenter?.(cue);
@@ -50719,20 +50766,14 @@ class HlsPlayback extends BasePlayback {
50719
50766
  destroy() {
50720
50767
  this._stopTimeUpdateTimer();
50721
50768
  this._destroyHLSInstance();
50769
+ this.cues = null;
50770
+ this.cuesByTrack = {};
50722
50771
  return super.destroy();
50723
50772
  }
50724
50773
  _updatePlaybackType(evt, data) {
50725
50774
  const prevPlaybackType = this._playbackType;
50726
50775
  this._playbackType = (data.details.live ? Playback.LIVE : Playback.VOD);
50727
50776
  this._onLevelUpdated(evt, data);
50728
- // Live stream subtitle tracks detection hack (may not immediately available)
50729
- // if (
50730
- // this._ccTracksUpdated &&
50731
- // this._playbackType === Playback.LIVE &&
50732
- // this.hasClosedCaptionsTracks
50733
- // ) {
50734
- // this._onSubtitleLoaded()
50735
- // }
50736
50777
  if (prevPlaybackType !== this._playbackType) {
50737
50778
  this._updateSettings();
50738
50779
  }
@@ -50953,7 +50994,10 @@ class HlsPlayback extends BasePlayback {
50953
50994
  return;
50954
50995
  }
50955
50996
  this._hls.subtitleTrack = id;
50956
- this.cues = [];
50997
+ if (!this.cuesByTrack[id]) {
50998
+ this.cuesByTrack[id] = new RangesList();
50999
+ }
51000
+ this.cues = this.cuesByTrack[id];
50957
51001
  }
50958
51002
  /**
50959
51003
  * @override
@@ -50962,7 +51006,7 @@ class HlsPlayback extends BasePlayback {
50962
51006
  return this.getTextTracks();
50963
51007
  }
50964
51008
  getTextTracks() {
50965
- return this._hls?.subtitleTracks.map((t) => ({
51009
+ return (this._hls?.subtitleTracks.map((t) => ({
50966
51010
  id: t.id,
50967
51011
  name: t.name,
50968
51012
  track: {
@@ -50970,7 +51014,7 @@ class HlsPlayback extends BasePlayback {
50970
51014
  label: t.name,
50971
51015
  language: t.lang,
50972
51016
  },
50973
- })) || [];
51017
+ })) || []);
50974
51018
  }
50975
51019
  }
50976
51020
  HlsPlayback.canPlay = function (resource, mimeType) {
@@ -51584,7 +51628,7 @@ class Player {
51584
51628
  }
51585
51629
  }
51586
51630
 
51587
- var version$1 = "2.30.0";
51631
+ var version$1 = "2.30.1";
51588
51632
 
51589
51633
  var packages = {
51590
51634
  "node_modules/@clappr/core": {
@@ -60258,8 +60302,6 @@ class ClosedCaptions extends UICorePlugin {
60258
60302
  // event.target does not exist for some reason in tests
60259
60303
  const id = Number((event.target ?? event.currentTarget).dataset?.item ??
60260
60304
  '-1');
60261
- // TODO review, make configurable, and emit event in addition
60262
- // localStorage.setItem(LOCAL_STORAGE_CC_ID, id) // TODO store language instead?
60263
60305
  this.userSelectedItemId = id;
60264
60306
  this.selectItem(this.findById(id));
60265
60307
  this.hideMenu();
@@ -361,6 +361,21 @@ A `PLUGIN` that configures [CMCD](https://cdn.cta.tech/cta/media/media/resources
361
361
  `PLUGIN` that displays the thumbnails of the video when available.
362
362
 
363
363
 
364
+ </td></tr>
365
+ <tr><td>
366
+
367
+ [TokenRefreshPlugin](./player.tokenrefreshplugin.md)
368
+
369
+
370
+ </td><td>
371
+
372
+ `PLUGIN` — automatic token refresh for Gcore protected-content streams.
373
+
374
+ Supports all three playback engines:
375
+
376
+ \| Engine \| Mechanism \| Interruption \| \|\-\-\-\-\-\---\|\-\-\-\-\-\-\-\-\---\|\-\-\-\-\-\-\-\-\-\-\-\---\| \| \*\*hls.js\*\* \| Custom loader rewrites every request URL \| None \| \| \*\*dash.js\*\* \| `addRequestInterceptor` rewrites every request URL \| None \| \| \*\*Native `<video>`<!-- -->\*\* (Safari ≤ iOS 14.4) \| Source reload + seek restore \| Brief \|
377
+
378
+
364
379
  </td></tr>
365
380
  <tr><td>
366
381
 
@@ -721,6 +736,28 @@ Plugin configuration options for the thumbnails plugin.
721
736
  Current playback time and total duration of the media.
722
737
 
723
738
 
739
+ </td></tr>
740
+ <tr><td>
741
+
742
+ [TokenRefreshOptions](./player.tokenrefreshoptions.md)
743
+
744
+
745
+ </td><td>
746
+
747
+ Configuration options for [TokenRefreshPlugin](./player.tokenrefreshplugin.md)<!-- -->.
748
+
749
+
750
+ </td></tr>
751
+ <tr><td>
752
+
753
+ [TokenResponse](./player.tokenresponse.md)
754
+
755
+
756
+ </td><td>
757
+
758
+ Response shape expected from your token-refresh API endpoint.
759
+
760
+
724
761
  </td></tr>
725
762
  <tr><td>
726
763
 
@@ -0,0 +1,59 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [Player](./player.player.md) &gt; [getPlugin](./player.player.getplugin.md)
4
+
5
+ ## Player.getPlugin() method
6
+
7
+ Returns a registered core plugin instance by name, or `null` if not found.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getPlugin(name: string): any;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ name
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td></tr>
47
+ </tbody></table>
48
+
49
+ **Returns:**
50
+
51
+ any
52
+
53
+ ## Example
54
+
55
+
56
+ ```ts
57
+ const tokenRefresh = player.getPlugin('token_refresh') as TokenRefreshPlugin | null
58
+ ```
59
+
@@ -137,6 +137,20 @@ Current playback (time since the beginning of the stream), if appropriate.
137
137
  Duration of the current media in seconds, if appropriate.
138
138
 
139
139
 
140
+ </td></tr>
141
+ <tr><td>
142
+
143
+ [getPlugin(name)](./player.player.getplugin.md)
144
+
145
+
146
+ </td><td>
147
+
148
+
149
+ </td><td>
150
+
151
+ Returns a registered core plugin instance by name, or `null` if not found.
152
+
153
+
140
154
  </td></tr>
141
155
  <tr><td>
142
156
 
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [TokenRefreshOptions](./player.tokenrefreshoptions.md) &gt; [getToken](./player.tokenrefreshoptions.gettoken.md)
4
+
5
+ ## TokenRefreshOptions.getToken property
6
+
7
+ Async function called each time a fresh token is needed. Must return a [TokenResponse](./player.tokenresponse.md)<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getToken: () => Promise<TokenResponse>;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [TokenRefreshOptions](./player.tokenrefreshoptions.md) &gt; [ipBound](./player.tokenrefreshoptions.ipbound.md)
4
+
5
+ ## TokenRefreshOptions.ipBound property
6
+
7
+ When `true`<!-- -->, the IP-bound variant (`token_ip` / `url_ip`<!-- -->) is used. Defaults to `false`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ ipBound?: boolean;
13
+ ```
@@ -0,0 +1,115 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [TokenRefreshOptions](./player.tokenrefreshoptions.md)
4
+
5
+ ## TokenRefreshOptions interface
6
+
7
+ Configuration options for [TokenRefreshPlugin](./player.tokenrefreshplugin.md)<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface TokenRefreshOptions
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [getToken](./player.tokenrefreshoptions.gettoken.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td><td>
47
+
48
+ () =&gt; Promise&lt;[TokenResponse](./player.tokenresponse.md)<!-- -->&gt;
49
+
50
+
51
+ </td><td>
52
+
53
+ Async function called each time a fresh token is needed. Must return a [TokenResponse](./player.tokenresponse.md)<!-- -->.
54
+
55
+
56
+ </td></tr>
57
+ <tr><td>
58
+
59
+ [ipBound?](./player.tokenrefreshoptions.ipbound.md)
60
+
61
+
62
+ </td><td>
63
+
64
+
65
+ </td><td>
66
+
67
+ boolean
68
+
69
+
70
+ </td><td>
71
+
72
+ _(Optional)_ When `true`<!-- -->, the IP-bound variant (`token_ip` / `url_ip`<!-- -->) is used. Defaults to `false`<!-- -->.
73
+
74
+
75
+ </td></tr>
76
+ <tr><td>
77
+
78
+ [onTokenRefreshed?](./player.tokenrefreshoptions.ontokenrefreshed.md)
79
+
80
+
81
+ </td><td>
82
+
83
+
84
+ </td><td>
85
+
86
+ (data: [TokenResponse](./player.tokenresponse.md)<!-- -->) =&gt; void
87
+
88
+
89
+ </td><td>
90
+
91
+ _(Optional)_ Optional callback invoked after every successful token refresh.
92
+
93
+
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [refreshLeadSeconds?](./player.tokenrefreshoptions.refreshleadseconds.md)
98
+
99
+
100
+ </td><td>
101
+
102
+
103
+ </td><td>
104
+
105
+ number
106
+
107
+
108
+ </td><td>
109
+
110
+ _(Optional)_ Seconds before the token expiry timestamp to request a fresh token. Defaults to `5`<!-- -->.
111
+
112
+
113
+ </td></tr>
114
+ </tbody></table>
115
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [TokenRefreshOptions](./player.tokenrefreshoptions.md) &gt; [onTokenRefreshed](./player.tokenrefreshoptions.ontokenrefreshed.md)
4
+
5
+ ## TokenRefreshOptions.onTokenRefreshed property
6
+
7
+ Optional callback invoked after every successful token refresh.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ onTokenRefreshed?: (data: TokenResponse) => void;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [TokenRefreshOptions](./player.tokenrefreshoptions.md) &gt; [refreshLeadSeconds](./player.tokenrefreshoptions.refreshleadseconds.md)
4
+
5
+ ## TokenRefreshOptions.refreshLeadSeconds property
6
+
7
+ Seconds before the token expiry timestamp to request a fresh token. Defaults to `5`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ refreshLeadSeconds?: number;
13
+ ```