@nomercy-entertainment/nomercy-video-player 2.1.9 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.1.10] — 2026-08-31
6
+
7
+ ### Fixed
8
+
9
+ - A caption choice is a language, a variant and a format. The language memory carried the language alone, so a viewer who picked English SDH got plain English back on the next item, and a viewer who picked the `.ass` rendition got the `.vtt` of the same lines without the show's own styling. The whole descriptor is carried now and matched narrowest-first, falling back to the same language rather than to no captions when a device's list has dropped the exact variant. A bare language written by an older build still reads as a choice.
10
+
5
11
  ## [2.1.9] — 2026-08-31
6
12
 
7
13
  ### Changed
package/dist/index.d.ts CHANGED
@@ -398,11 +398,6 @@ export declare class NMVideoPlayer<T extends VideoPlaylistItem = VideoPlaylistIt
398
398
  setTransitionStrategy: (strategy: ITransitionStrategy) => void;
399
399
  preloadStrategy: () => IPreloadStrategy;
400
400
  transitionStrategy: () => ITransitionStrategy;
401
- createElement: IPlayer<VideoEventMap>['createElement'];
402
- createButton: IPlayer<VideoEventMap>['createButton'];
403
- createSVG: IPlayer<VideoEventMap>['createSVG'];
404
- addClasses: IPlayer<VideoEventMap>['addClasses'];
405
- removeClasses: IPlayer<VideoEventMap>['removeClasses'];
406
401
  _disposeBackend(): void;
407
402
  }
408
403
  /**
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { readItemImage } from './player/itemImage.js';
11
11
  import { normalizeVideoPlaylistItem } from './player/normalize-item.js';
12
12
  import { VideoPreloadStrategy } from './player/preload.js';
13
13
  import { pickStartItem } from './player/start-selection.js';
14
- import { SUBTITLES_OFF, TrackLanguageMemory } from './player/track-language-memory.js';
14
+ import { matchSubtitleTrack, SUBTITLES_OFF, TrackLanguageMemory } from './player/track-language-memory.js';
15
15
  import { titleTokenTranslations } from './plugins/desktop-ui/i18n/token-bundle.js';
16
16
  import { containedRect, FullscreenState, PipState, SubtitleState, TheaterState } from './types.js';
17
17
  export { VttChapterSource } from './adapters/chapter-source/vtt-chapters.js';
@@ -121,7 +121,7 @@ export class NMVideoPlayer extends EventEmitter {
121
121
  this.languageMemory.rememberAudio(this.audioTracks()[id]?.language);
122
122
  });
123
123
  this.on('subtitle', ({ track }) => {
124
- this.languageMemory.rememberSubtitle(track === null ? SUBTITLES_OFF : this.subtitles()[track]?.language);
124
+ this.languageMemory.rememberSubtitle(track === null ? SUBTITLES_OFF : this.subtitles()[track]);
125
125
  });
126
126
  // Re-emit videoRect on signals that change the displayed content rect.
127
127
  this.on('duration', () => { this._emitVideoRect(); });
@@ -215,18 +215,21 @@ export class NMVideoPlayer extends EventEmitter {
215
215
  * `'en-US'`). No match → leave selection at off; no warning emitted.
216
216
  */
217
217
  _applyDefaultTracks() {
218
- const rememberedSubtitle = this.languageMemory.subtitleLanguage();
219
- const subtitleLang = rememberedSubtitle ?? this.options?.defaultSubtitleLanguage;
220
- if (subtitleLang === SUBTITLES_OFF) {
218
+ const remembered = this.languageMemory.subtitleChoice();
219
+ const wanted = remembered
220
+ ?? (this.options?.defaultSubtitleLanguage
221
+ ? { language: this.options.defaultSubtitleLanguage }
222
+ : undefined);
223
+ if (wanted === SUBTITLES_OFF) {
221
224
  this.subtitle(-1);
222
225
  }
223
- else if (subtitleLang) {
226
+ else if (wanted) {
224
227
  let tracks = [];
225
228
  try {
226
229
  tracks = this.subtitles();
227
230
  }
228
231
  catch { /* not yet available */ }
229
- const matchIdx = _matchLanguage(tracks.map(subtitleTrack => subtitleTrack.language), subtitleLang);
232
+ const matchIdx = matchSubtitleTrack(tracks, wanted, _matchLanguage);
230
233
  if (matchIdx >= 0) {
231
234
  this.subtitle(matchIdx);
232
235
  }