@gcorevideo/player 2.28.35 → 2.28.36

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 (31) hide show
  1. package/README.md +22 -1
  2. package/assets/{subtitles → cc}/style.scss +5 -0
  3. package/dist/core.js +17 -23
  4. package/dist/index.css +346 -342
  5. package/dist/index.embed.js +46 -39
  6. package/dist/index.js +46 -39
  7. package/lib/playback/BasePlayback.d.ts +1 -0
  8. package/lib/playback/BasePlayback.d.ts.map +1 -1
  9. package/lib/playback/BasePlayback.js +3 -0
  10. package/lib/playback/dash-playback/DashPlayback.d.ts +1 -0
  11. package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
  12. package/lib/playback/dash-playback/DashPlayback.js +9 -22
  13. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  14. package/lib/playback/hls-playback/HlsPlayback.js +4 -0
  15. package/lib/plugins/subtitles/ClosedCaptions.d.ts +1 -1
  16. package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
  17. package/lib/plugins/subtitles/ClosedCaptions.js +32 -22
  18. package/lib/testUtils.d.ts +1 -0
  19. package/lib/testUtils.d.ts.map +1 -1
  20. package/lib/testUtils.js +3 -0
  21. package/package.json +1 -1
  22. package/src/playback/BasePlayback.ts +4 -0
  23. package/src/playback/dash-playback/DashPlayback.ts +10 -27
  24. package/src/playback/hls-playback/HlsPlayback.ts +4 -0
  25. package/src/plugins/subtitles/ClosedCaptions.ts +34 -20
  26. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +73 -112
  27. package/src/plugins/subtitles/__tests__/__snapshots__/ClosedCaptions.test.ts.snap +3 -3
  28. package/src/testUtils.ts +3 -0
  29. package/tsconfig.tsbuildinfo +1 -1
  30. /package/assets/{subtitles → cc}/combobox.ejs +0 -0
  31. /package/assets/{subtitles → cc}/string.ejs +0 -0
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Gcore video player
2
+
2
3
  $
3
4
 
4
5
  ## Installation
@@ -15,7 +16,7 @@ Or use a script on the CDN directly in your HTML:
15
16
 
16
17
  ## Usage
17
18
 
18
- See the complete example app on Vercel: [https://github.com/dmitritz/gcore-videoplayer-js-nuxt](https://github.com/dmitritz/gcore-videoplayer-js-nuxt)
19
+ See the complete example app on Vercel: <https://github.com/dmitritz/gcore-videoplayer-js-nuxt>
19
20
 
20
21
  ### Plain HTML example
21
22
 
@@ -83,3 +84,23 @@ See the complete example app on Vercel: [https://github.com/dmitritz/gcore-video
83
84
  ## Documentation
84
85
 
85
86
  - [API reference](./docs/api/index.md)
87
+
88
+ ## Development
89
+
90
+ ### Log level
91
+
92
+ Detailed logs can be useful in local development while debugging or watching tests output.
93
+ Log level of the player core and components can be controlled by configuring a LogTracer:
94
+
95
+ ```ts
96
+ import { LogTracer, Logger, setTracer } from '@gcorevideo/utils'
97
+ // ...
98
+ Logger.enable('*') // log everything; you can use glob-like patterns, such as 'gplayer', 'plugins.*' or 'playback.*'
99
+ setTracer(new LogTracer('AudioTracks.test'))
100
+ ```
101
+
102
+ When debugging an app that use the player as a dependency,
103
+
104
+ ```ts
105
+ import { LogTracer, Logger, setTracer } from '@gcorevideo/player'
106
+ ```
@@ -68,6 +68,11 @@
68
68
  position: absolute;
69
69
  bottom: calc(var(--bottom-panel) + 5px);
70
70
  width: 100%;
71
+ transition: transform 0.3s ease-out;
72
+
73
+ &.media-control-cc-pulled {
74
+ transform: translateY(var(--bottom-panel));
75
+ }
71
76
 
72
77
  p {
73
78
  width: auto;
package/dist/core.js CHANGED
@@ -12807,6 +12807,9 @@ class BasePlayback extends HTML5Video$1 {
12807
12807
  super._onPlaying();
12808
12808
  this.trigger(Events$1.PLAYBACK_MEDIACONTROL_ENABLE);
12809
12809
  }
12810
+ setTextTrack(id) {
12811
+ // noop
12812
+ }
12810
12813
  }
12811
12814
 
12812
12815
  var PlaybackEvents;
@@ -12829,6 +12832,7 @@ const T$3 = 'playback.dash';
12829
12832
  class DashPlayback extends BasePlayback {
12830
12833
  _levels = [];
12831
12834
  _currentLevel = AUTO$1;
12835
+ _currentTextTrackId = -1;
12832
12836
  // true when the actual duration is longer than hlsjs's live sync point
12833
12837
  // when this is false playableRegionDuration will be the actual duration
12834
12838
  // when this is true playableRegionDuration will exclude the time after the sync point
@@ -12961,7 +12965,11 @@ class DashPlayback extends BasePlayback {
12961
12965
  streaming: {
12962
12966
  text: {
12963
12967
  defaultEnabled: false,
12964
- dispatchForManualRendering: true,
12968
+ // NOTE: dispatchForManualRendering is not correctly implemented in DASH.js;
12969
+ // it does not work when there are multiple text tracks.
12970
+ // CUE_ENTER and CUE_EXIT events might be dispatched additionally
12971
+ // for a track, other than the currently active one.
12972
+ // dispatchForManualRendering: true, // TODO only when useNativeSubtitles is not true?
12965
12973
  },
12966
12974
  },
12967
12975
  }, this.options.dash);
@@ -13005,24 +13013,6 @@ class DashPlayback extends BasePlayback {
13005
13013
  this._dash.on(_.events.PLAYBACK_RATE_CHANGED, (e) => {
13006
13014
  this.trigger(PlaybackEvents.PLAYBACK_RATE_CHANGED, e.playbackRate);
13007
13015
  });
13008
- this._dash.on(_.events.TRACK_CHANGE_RENDERED, (e) => {
13009
- if (e.mediaType === 'audio') {
13010
- this.trigger(Events$1.PLAYBACK_AUDIO_CHANGED, toClapprTrack$1(e.newMediaInfo));
13011
- }
13012
- });
13013
- this._dash.on(_.events.CUE_ENTER, (e) => {
13014
- this.oncueenter?.({
13015
- end: e.end,
13016
- id: e.id,
13017
- start: e.start,
13018
- text: e.text,
13019
- });
13020
- });
13021
- this._dash.on(_.events.CUE_EXIT, (e) => {
13022
- this.oncueexit?.({
13023
- id: e.id,
13024
- });
13025
- });
13026
13016
  }
13027
13017
  render() {
13028
13018
  this._ready();
@@ -13332,14 +13322,14 @@ class DashPlayback extends BasePlayback {
13332
13322
  this._dash?.setTextTrack(this.closedCaptionsTrackId);
13333
13323
  }
13334
13324
  setTextTrack(id) {
13325
+ this._currentTextTrackId = id;
13335
13326
  this._dash?.setTextTrack(id);
13336
13327
  }
13337
13328
  /**
13338
13329
  * @override
13339
13330
  */
13340
13331
  get closedCaptionsTracks() {
13341
- const tt = this.getTextTracks();
13342
- return tt;
13332
+ return this.getTextTracks();
13343
13333
  }
13344
13334
  getTextTracks() {
13345
13335
  return this._dash?.getTracksFor('text').map((t, index) => ({
@@ -13349,7 +13339,7 @@ class DashPlayback extends BasePlayback {
13349
13339
  id: index,
13350
13340
  label: getTextTrackLabel(t) || "",
13351
13341
  language: t.lang,
13352
- mode: "hidden",
13342
+ mode: this._currentTextTrackId === index ? "showing" : "hidden",
13353
13343
  },
13354
13344
  })) || [];
13355
13345
  }
@@ -50861,7 +50851,11 @@ class HlsPlayback extends BasePlayback {
50861
50851
  this.trigger(Events$1.PLAYBACK_AUDIO_CHANGED, toClapprTrack(track));
50862
50852
  }
50863
50853
  setTextTrack(id) {
50854
+ if (id === this._hls.subtitleTrack) {
50855
+ return;
50856
+ }
50864
50857
  this._hls.subtitleTrack = id;
50858
+ this.cues = [];
50865
50859
  }
50866
50860
  /**
50867
50861
  * @override
@@ -51481,7 +51475,7 @@ class Player {
51481
51475
  }
51482
51476
  }
51483
51477
 
51484
- var version$1 = "2.28.35";
51478
+ var version$1 = "2.28.36";
51485
51479
 
51486
51480
  var packages = {
51487
51481
  "node_modules/@clappr/core": {