@banou/media-player 0.10.35 → 0.10.37

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/README.md CHANGED
@@ -234,8 +234,12 @@ reflect the real element froze the window: seeking while paused left the old sce
234
234
  transport state is carried by the Media Session instead, which is what the window reads for its
235
235
  play/pause button.
236
236
 
237
- If anything in that path is unavailable the player falls back to handing the browser the bare video,
238
- which plays without subtitles rather than not at all.
237
+ The window outlives the player. A player unmounted while its window is open leaves it open for a
238
+ second, and the next player mounted in the same document in that time plays in it, at the shape of
239
+ its own video. So an app that mounts a new player for the next episode keeps the window without a
240
+ click, which a new window would need. If no player takes the window in that second, it closes.
241
+
242
+ Where that path is unavailable the player offers no picture in picture control.
239
243
 
240
244
  ### Picture in picture for a media you do not own
241
245
 
@@ -341,17 +345,28 @@ Pass the languages to start a file in, and save what the viewer picks:
341
345
  ```
342
346
 
343
347
  A preference is a tag or a name (`ja`, `ja-JP`, `jpn`, `Japanese`, `English (US)`), and a pick is reported the way the
344
- track names its language, its tag or else its title, or null for subtitles off. A file starts on its full track in the
345
- preferred language, never a commentary or a signs and songs track when a full one exists, and on its default when it has
346
- nothing in that language. What the viewer picks wins for that file. A subtitle track that names no language is reported
348
+ track names its language, its tag or else its title, or null for subtitles off. A file starts on its full audio track in
349
+ the preferred language, else on its default: a commentary or an audio description in it does not count. Subtitles start
350
+ on the full track in the language, else on a signs and songs one in it, else on the default. What the viewer picks wins
351
+ for that file. A subtitle track that names no language is reported
347
352
  by its title, and only when it turns subtitles on, so the next file starts with them on, on the track of that title if
348
353
  it has one.
349
354
 
355
+ To start in the viewer's own language, pass it as both preferences with `alwaysShowSubtitles={false}`: a file with audio
356
+ in it plays that audio with subtitles off, and any other plays its original audio with subtitles in it. Subtitles are
357
+ left off only where the audio plays in their language, so a picked audio language other than theirs keeps them on. The
358
+ original is the file's track in `originalLanguage` when the source knows it (`ja` for anime), else the file's default,
359
+ which is its first track: on a dual audio file whose first track is a dub, only `originalLanguage` finds the original.
360
+ `onAlwaysShowSubtitlesChange` reports true when the viewer turns on subtitles in the language the audio plays in, for
361
+ the app to pass back as `alwaysShowSubtitles`. The rule is `startingTracks(audio, subtitles, preferences)`, from
362
+ `@banou/media-player/language`.
363
+
350
364
  A media the player does not own reports picks the same way, by the option's label once the source's `select`
351
- resolves, and its host applies the preference to its own tracks: `preferredSelection(selection, preference)`, from
352
- `@banou/media-player/language`, names the option to select, and imports nothing else of the player. `languageTag(pick)`
353
- from the same module gives a pick's BCP 47 tag (`jpn` gives `ja`, `Português (Brasil)` gives `pt-BR`), or undefined for
354
- one naming no language, for code that reads tags.
365
+ resolves, and its host applies the preferences to its own tracks: `preferredSelection(kind, selections, preferences)`,
366
+ from `@banou/media-player/language`, names the option to select by the same rule, the audio selected standing for the
367
+ source's default, and imports nothing else of the player. `languageTag(pick)` from the same module gives a pick's BCP 47
368
+ tag (`jpn` gives `ja`, `Português (Brasil)` gives `pt-BR`), or undefined for one naming no language, for code that reads
369
+ tags.
355
370
 
356
371
  ### Labels in the viewer's language
357
372
 
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../engine-BZDbaSfM.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../engine-x5oIkHAN.js";
2
2
  export { i as DEFAULT_BUFFER_SIZE, e as MediaElementError, a as SUBTITLES_OFF, u as createPictureInPicture, d as createSubtitleRenderer, c as createThumbnailGenerator, n as getTimeRanges, s as isMediaElementError, o as pictureInPictureMode, l as startPlayback, t as terminateRemuxer, r as updateSourceBuffer };
@@ -24,7 +24,10 @@ export type PictureInPictureOptions = {
24
24
  */
25
25
  subtitles: HTMLElement;
26
26
  maxWidth?: number;
27
- /** Where the mirror is mounted. It must be in the document. Defaults to the video's parent. */
27
+ /**
28
+ * Where the mirror is mounted. It must be in the document. Defaults to the video's parent in burn-in, where the
29
+ * mirror is the picture, and to the body in a window, so the window can outlive the player (see `destroy`).
30
+ */
28
31
  container?: HTMLElement;
29
32
  /** Overrides detection. Passing a mode the browser cannot honour is the caller's problem. */
30
33
  mode?: PictureInPictureMode;
@@ -33,9 +36,17 @@ export type PictureInPictureOptions = {
33
36
  };
34
37
  export type PictureInPictureController = {
35
38
  toggle: () => Promise<void>;
39
+ /**
40
+ * Burn-in, or a window that is not open, ends here. An open window stays open for a second, and the
41
+ * next controller created in the document in that time draws its own video into it, at that video's
42
+ * shape: an app that replaces the player for the next episode keeps the window with no click, which
43
+ * a new window would need. If no controller takes it in that second, it closes.
44
+ */
36
45
  destroy: () => void;
37
46
  mode: PictureInPictureMode;
38
47
  };
48
+ /** How long a destroyed controller's window waits for the next one; a remounted player asks within a few frames. */
49
+ export declare const HAND_OVER_MS = 1000;
39
50
  /**
40
51
  * null means offer no control at all. That covers Safari, whose picture in picture is
41
52
  * `webkitSetPresentationMode` and not the W3C API, so neither arm here can drive it. A dead button