@banou/media-player 0.10.35 → 0.10.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.
- package/README.md +18 -7
- package/dist/index.js +603 -599
- package/dist/language/index.d.ts +39 -5
- package/dist/language/index.js +53 -18
- package/dist/react/video-player.d.ts +18 -2
- package/package.json +1 -1
- package/src/lib/language/index.ts +94 -13
- package/src/lib/react/hooks/use-playback.ts +20 -19
- package/src/lib/react/video-player.tsx +26 -7
package/README.md
CHANGED
|
@@ -341,17 +341,28 @@ Pass the languages to start a file in, and save what the viewer picks:
|
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
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
|
|
345
|
-
preferred language,
|
|
346
|
-
|
|
344
|
+
track names its language, its tag or else its title, or null for subtitles off. A file starts on its full audio track in
|
|
345
|
+
the preferred language, else on its default: a commentary or an audio description in it does not count. Subtitles start
|
|
346
|
+
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
|
|
347
|
+
for that file. A subtitle track that names no language is reported
|
|
347
348
|
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
349
|
it has one.
|
|
349
350
|
|
|
351
|
+
To start in the viewer's own language, pass it as both preferences with `alwaysShowSubtitles={false}`: a file with audio
|
|
352
|
+
in it plays that audio with subtitles off, and any other plays its original audio with subtitles in it. Subtitles are
|
|
353
|
+
left off only where the audio plays in their language, so a picked audio language other than theirs keeps them on. The
|
|
354
|
+
original is the file's track in `originalLanguage` when the source knows it (`ja` for anime), else the file's default,
|
|
355
|
+
which is its first track: on a dual audio file whose first track is a dub, only `originalLanguage` finds the original.
|
|
356
|
+
`onAlwaysShowSubtitlesChange` reports true when the viewer turns on subtitles in the language the audio plays in, for
|
|
357
|
+
the app to pass back as `alwaysShowSubtitles`. The rule is `startingTracks(audio, subtitles, preferences)`, from
|
|
358
|
+
`@banou/media-player/language`.
|
|
359
|
+
|
|
350
360
|
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
|
|
352
|
-
`@banou/media-player/language`, names the option to select,
|
|
353
|
-
|
|
354
|
-
one naming no language, for code that reads
|
|
361
|
+
resolves, and its host applies the preferences to its own tracks: `preferredSelection(kind, selections, preferences)`,
|
|
362
|
+
from `@banou/media-player/language`, names the option to select by the same rule, the audio selected standing for the
|
|
363
|
+
source's default, and imports nothing else of the player. `languageTag(pick)` from the same module gives a pick's BCP 47
|
|
364
|
+
tag (`jpn` gives `ja`, `Português (Brasil)` gives `pt-BR`), or undefined for one naming no language, for code that reads
|
|
365
|
+
tags.
|
|
355
366
|
|
|
356
367
|
### Labels in the viewer's language
|
|
357
368
|
|