@nomercy-entertainment/nomercy-video-player 2.8.1 → 2.8.3

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,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.8.3] — 2026-11-09
6
+
7
+ ### Fixed
8
+
9
+ - `videoRect` reports the painted picture, clipped to the player, in every aspect mode: `uniform`, `fill`, `exactfit` and `none`. The setters emit `videoRect` on a mode change.
10
+ - `./plugins/octopus`: the ASS canvas follows that rectangle, so subtitles stay on the picture after a resize or a mode change.
11
+
5
12
  ## [2.8.1] — 2026-11-09
6
13
 
7
14
  ### Changed
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { KeyHandlerPlugin } from './plugins/key-handler/index.js';
17
17
  export { OctopusPlugin } from './plugins/octopus/index.js';
18
18
  export { V1VideoCompatPlugin } from './plugins/v1-compat.js';
19
19
  export type { AudioTrackRef, ChapterRef, FontTrackRef, HtmlPreloadMode, IVideoPlayer, SegmentBoundaryPayload, SegmentEndBehaviour, SegmentOptions, Stretching, SubtitleTrackRef, VideoBackendFactory, VideoEventMap, VideoPlayerConfig, VideoPlaylistItem, VideoRect, WatchProgress, } from './types.js';
20
- export { containedRect } from './types.js';
20
+ export { containedRect, paintedRect } from './types.js';
21
21
  export { AudioTrackState, FullscreenState, PipState, PlayState, QualityState, RepeatState, ShuffleState, SubtitleState, TheaterState, VolumeState, } from './types.js';
22
22
  export type { QualityLevel } from './types.js';
23
23
  export type { AudioTrack, Chapter, SidecarSubtitleInput, SubtitleTrack } from '@nomercy-entertainment/nomercy-player-core';
@@ -276,13 +276,14 @@ export declare class NMVideoPlayer<T extends VideoPlaylistItem = VideoPlaylistIt
276
276
  private _applyObjectFit;
277
277
  private _videoRectObserver;
278
278
  /**
279
- * The displayed video content rectangle relative to the player container,
280
- * computed from `object-fit: contain` geometry.
279
+ * The painted picture clipped to the player container, following the
280
+ * current `aspectRatio()` mode. Unchanged for Fit; Stretch and Crop give the
281
+ * container; True size gives the native size, centered and clipped.
281
282
  *
282
283
  * Returns `null` when the video has no loaded metadata yet.
283
284
  * Changes are signalled by the `'videoRect'` event — fired on `mediaReady`,
284
- * `duration`, `fullscreen`, and a `ResizeObserver` on the container and
285
- * video element.
285
+ * `duration`, `fullscreen`, `aspectRatio`, and a `ResizeObserver` on the
286
+ * container and video element.
286
287
  */
287
288
  videoRect(): VideoRect | null;
288
289
  private _emitVideoRect;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { VideoPreloadStrategy } from './player/preload.js';
14
14
  import { pickStartItem } from './player/start-selection.js';
15
15
  import { matchSubtitleTrack, SUBTITLES_OFF, TrackLanguageMemory } from './player/track-language-memory.js';
16
16
  import { titleTokenTranslations } from './plugins/desktop-ui/i18n/token-bundle.js';
17
- import { containedRect, FullscreenState, PipState, SubtitleState, TheaterState } from './types.js';
17
+ import { FullscreenState, paintedRect, PipState, SubtitleState, TheaterState } from './types.js';
18
18
  export { VttChapterSource } from './adapters/chapter-source/vtt-chapters.js';
19
19
  export { StorageBackedSubtitleStyleStore } from './adapters/subtitle-style-store/storage-backed.js';
20
20
  export { VttSpriteThumbnailSource } from './adapters/thumbnail-source/vtt-sprite.js';
@@ -24,7 +24,7 @@ export { VideoPreloadStrategy } from './player/preload.js';
24
24
  export { KeyHandlerPlugin } from './plugins/key-handler/index.js';
25
25
  export { OctopusPlugin } from './plugins/octopus/index.js';
26
26
  export { V1VideoCompatPlugin } from './plugins/v1-compat.js';
27
- export { containedRect } from './types.js';
27
+ export { containedRect, paintedRect } from './types.js';
28
28
  export { AudioTrackState, FullscreenState, PipState, PlayState, QualityState, RepeatState, ShuffleState, SubtitleState, TheaterState, VolumeState, } from './types.js';
29
29
  const _instances = new Map();
30
30
  /**
@@ -645,6 +645,7 @@ export class NMVideoPlayer extends EventEmitter {
645
645
  this._aspectRatio = value;
646
646
  this._applyObjectFit(value);
647
647
  this.emit('aspectRatio', { value });
648
+ this._emitVideoRect();
648
649
  }
649
650
  cycleAspectRatio() {
650
651
  const order = ['uniform', 'fill', 'exactfit', 'none'];
@@ -653,6 +654,7 @@ export class NMVideoPlayer extends EventEmitter {
653
654
  this._aspectRatio = next;
654
655
  this._applyObjectFit(next);
655
656
  this.emit('aspectRatio', { value: next });
657
+ this._emitVideoRect();
656
658
  }
657
659
  _applyObjectFit(value) {
658
660
  const el = this.videoElement;
@@ -663,13 +665,14 @@ export class NMVideoPlayer extends EventEmitter {
663
665
  // ── Video geometry ──
664
666
  _videoRectObserver = null;
665
667
  /**
666
- * The displayed video content rectangle relative to the player container,
667
- * computed from `object-fit: contain` geometry.
668
+ * The painted picture clipped to the player container, following the
669
+ * current `aspectRatio()` mode. Unchanged for Fit; Stretch and Crop give the
670
+ * container; True size gives the native size, centered and clipped.
668
671
  *
669
672
  * Returns `null` when the video has no loaded metadata yet.
670
673
  * Changes are signalled by the `'videoRect'` event — fired on `mediaReady`,
671
- * `duration`, `fullscreen`, and a `ResizeObserver` on the container and
672
- * video element.
674
+ * `duration`, `fullscreen`, `aspectRatio`, and a `ResizeObserver` on the
675
+ * container and video element.
673
676
  */
674
677
  videoRect() {
675
678
  const video = this.videoElement;
@@ -677,7 +680,7 @@ export class NMVideoPlayer extends EventEmitter {
677
680
  return null;
678
681
  }
679
682
  const container = this.container;
680
- const rect = containedRect(video.videoWidth, video.videoHeight, container.clientWidth, container.clientHeight);
683
+ const rect = paintedRect(this._aspectRatio, video.videoWidth, video.videoHeight, container.clientWidth, container.clientHeight);
681
684
  return rect;
682
685
  }
683
686
  _emitVideoRect() {