@banou/media-player 0.10.29 → 0.10.31

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 (55) hide show
  1. package/README.md +23 -1
  2. package/dist/de-DphEdq0O.js +52 -0
  3. package/dist/engine/index.js +1 -1
  4. package/dist/{engine-DeEY2qao.js → engine-5XbZqrD3.js} +213 -162
  5. package/dist/es-419-D6gsvnn8.js +52 -0
  6. package/dist/fr-BqAzAJX0.js +52 -0
  7. package/dist/index.js +931 -844
  8. package/dist/it-NTcUh3Gr.js +52 -0
  9. package/dist/ja-DSmX_bxj.js +52 -0
  10. package/dist/ko-DyPzWasj.js +52 -0
  11. package/dist/labels.d.ts +71 -0
  12. package/dist/language/index.d.ts +6 -0
  13. package/dist/language/index.js +34 -27
  14. package/dist/pl-C6Ow4ra5.js +52 -0
  15. package/dist/pt-BR-wudK3giz.js +52 -0
  16. package/dist/react/labels.d.ts +28 -0
  17. package/dist/react/video-player.d.ts +9 -0
  18. package/dist/ru-D5kxBkik.js +52 -0
  19. package/dist/tr-CW7R7N9k.js +52 -0
  20. package/dist/utils/track-label.d.ts +9 -8
  21. package/dist/zh-Hans-IhL1Pl78.js +52 -0
  22. package/dist/zh-Hant-C5YyFjEc.js +52 -0
  23. package/package.json +3 -1
  24. package/src/lib/engine/playback.ts +6 -5
  25. package/src/lib/engine/source-buffer.ts +3 -1
  26. package/src/lib/labels.ts +75 -0
  27. package/src/lib/language/index.ts +13 -1
  28. package/src/lib/locales/de.json +49 -0
  29. package/src/lib/locales/es-419.json +49 -0
  30. package/src/lib/locales/fr.json +49 -0
  31. package/src/lib/locales/it.json +49 -0
  32. package/src/lib/locales/ja.json +49 -0
  33. package/src/lib/locales/ko.json +49 -0
  34. package/src/lib/locales/pl.json +49 -0
  35. package/src/lib/locales/pt-BR.json +49 -0
  36. package/src/lib/locales/ru.json +49 -0
  37. package/src/lib/locales/tr.json +49 -0
  38. package/src/lib/locales/zh-Hans.json +49 -0
  39. package/src/lib/locales/zh-Hant.json +49 -0
  40. package/src/lib/react/components/burn-in-hint.tsx +4 -1
  41. package/src/lib/react/components/chrome.tsx +9 -0
  42. package/src/lib/react/components/control-bar.tsx +15 -26
  43. package/src/lib/react/components/errors.tsx +11 -9
  44. package/src/lib/react/components/overlay.tsx +18 -5
  45. package/src/lib/react/components/playback-slider.tsx +4 -1
  46. package/src/lib/react/components/settings.tsx +23 -31
  47. package/src/lib/react/components/skip-chapter.tsx +5 -2
  48. package/src/lib/react/components/sound.tsx +5 -2
  49. package/src/lib/react/components/subtitles.tsx +7 -4
  50. package/src/lib/react/components/track-menu.tsx +8 -4
  51. package/src/lib/react/components/volume-slider.tsx +3 -1
  52. package/src/lib/react/hooks/use-playback.ts +12 -2
  53. package/src/lib/react/labels.tsx +125 -0
  54. package/src/lib/react/video-player.tsx +14 -1
  55. package/src/lib/utils/track-label.ts +16 -11
package/README.md CHANGED
@@ -346,7 +346,28 @@ it has one.
346
346
 
347
347
  A media the player does not own reports picks the same way, by the option's label once the source's `select`
348
348
  resolves, and its host applies the preference to its own tracks: `preferredSelection(selection, preference)`, from
349
- `@banou/media-player/language`, names the option to select, and imports nothing else of the player.
349
+ `@banou/media-player/language`, names the option to select, and imports nothing else of the player. `languageTag(pick)`
350
+ from the same module gives a pick's BCP 47 tag (`jpn` gives `ja`, `Português (Brasil)` gives `pt-BR`), or undefined for
351
+ one naming no language, for code that reads tags.
352
+
353
+ ### Labels in the viewer's language
354
+
355
+ The controls, tooltips, menus, skip offers and failures are in English. Pass `language`, a BCP 47 tag such as the
356
+ host page shows, for another:
357
+
358
+ ```tsx
359
+ <MediaPlayer {...source} language="fr" />
360
+ ```
361
+
362
+ They are shown in the closest language the player has: Latin American Spanish (`es-419`, for every `es-*`), Brazilian
363
+ Portuguese (`pt-BR`, for every `pt-*`), French, German, Italian, Russian, Japanese, Korean, Simplified and Traditional
364
+ Chinese (`zh-Hans`, `zh-Hant`), Turkish and Polish, else English. The numbers in them are written as the tag writes them
365
+ (`es-AR` gives `0,5x`, `es-419` itself `0.5x`), and track languages are named in it, even when the labels are English
366
+ (`en-DE` gives `0,5x`). A language's text is fetched the first time a player shows it, with FormatJS (`@formatjs/intl`),
367
+ and the labels are English until it has arrived. A player given no `language`, or one it does not have, fetches neither.
368
+
369
+ Each language is `src/lib/locales/<tag>.json`, keyed by the English of `src/lib/labels.ts`; a unit test holds every
370
+ file to FormatJS's `verify` against that English.
350
371
 
351
372
  ## Layout
352
373
 
@@ -428,6 +449,7 @@ its published name so it stays an honest consumer.
428
449
  player.addEventListener('chapterschange', () => console.log(player.chapters))
429
450
  ```
430
451
  - `src/lib/react/` the player component, its chrome, and the hooks.
452
+ - `src/lib/labels.ts` the chrome's text in English, and `src/lib/locales/` its other languages.
431
453
 
432
454
  Built by `vite.lib.config.ts` into `dist/`, which is what npm publishes.
433
455
 
@@ -0,0 +1,52 @@
1
+ //#region src/lib/locales/de.json
2
+ var e = "Audio", t = "Kopiert", n = "Kopieren", r = "Aus", i = "Stummschalten", a = "Pause", o = "Wiedergabe", s = "Qualität", c = "Erneut abspielen", l = "Einstellungen", u = "Untertitel", d = "Nicht verfügbar", f = "behoben", p = {
3
+ "(Default)": "(Normal)",
4
+ Audio: e,
5
+ Copied: t,
6
+ Copy: n,
7
+ "Copy the errors": "Fehler kopieren",
8
+ "Could not switch. Try again.": "Wechsel fehlgeschlagen. Versuch es noch einmal.",
9
+ Disable: "Aus",
10
+ "Exit full screen (f)": "Vollbild beenden (f)",
11
+ "Exit picture in picture": "Bild-im-Bild beenden",
12
+ "Full screen": "Vollbild",
13
+ "Full screen (f)": "Vollbild (f)",
14
+ Mute: i,
15
+ "Mute (m)": "Stummschalten (m)",
16
+ "Normalize volume": "Lautstärke angleichen",
17
+ "Now click your browser's pop out button": "Klicke jetzt auf die Bild-im-Bild-Schaltfläche deines Browsers",
18
+ Pause: a,
19
+ "Pause (k)": "Pause (k)",
20
+ "Picture in picture": "Bild-im-Bild",
21
+ Play: o,
22
+ "Play (k)": "Wiedergabe (k)",
23
+ "Playback errors ({count})": "Wiedergabefehler ({count})",
24
+ "Playback failed": "Wiedergabe fehlgeschlagen",
25
+ "Playback speed": "Geschwindigkeit",
26
+ "Put the subtitles in the picture": "Untertitel ins Bild einbetten",
27
+ "Put the subtitles in the video": "Untertitel ins Video einbetten",
28
+ Quality: s,
29
+ "Reading the video file failed": "Die Videodatei konnte nicht gelesen werden",
30
+ Replay: c,
31
+ "Replay (k)": "Erneut abspielen (k)",
32
+ Settings: l,
33
+ "Skip Ending": "Abspann überspringen",
34
+ "Skip Opening": "Intro überspringen",
35
+ Subtitles: u,
36
+ "Subtitles are in the picture": "Die Untertitel sind im Bild",
37
+ "The MediaSource closed before a SourceBuffer could be created": "Die MediaSource wurde geschlossen, bevor ein SourceBuffer erstellt werden konnte",
38
+ "The MediaSource never opened": "Die MediaSource wurde nie geöffnet",
39
+ "The browser rejected a media segment": "Der Browser hat ein Mediensegment abgelehnt",
40
+ "The video codec in this file could not be identified": "Der Videocodec dieser Datei konnte nicht erkannt werden",
41
+ "This browser cannot play the codecs in this file: {codecs}": "Dieser Browser kann die Codecs dieser Datei nicht abspielen: {codecs}",
42
+ "This file has no subtitles": "Diese Datei hat keine Untertitel",
43
+ "Track {number}": "Spur {number}",
44
+ Unavailable: d,
45
+ "Unmute (m)": "Ton einschalten (m)",
46
+ "at {time}": "bei {time}",
47
+ recovered: f,
48
+ "{rate}x": "{rate}x",
49
+ "{start} to {end}": "von {start} bis {end}"
50
+ };
51
+ //#endregion
52
+ export { e as Audio, t as Copied, n as Copy, r as Disable, i as Mute, a as Pause, o as Play, s as Quality, c as Replay, l as Settings, u as Subtitles, d as Unavailable, p as default, f as recovered };
@@ -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-DeEY2qao.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-5XbZqrD3.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 };