expo-video-subtitle 0.3.0 → 0.4.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 +22 -0
- package/FORK.md +4 -4
- package/README.md +37 -1
- package/build/VideoPlayer.types.d.ts +19 -0
- package/build/VideoPlayer.types.d.ts.map +1 -1
- package/build/VideoPlayer.types.js.map +1 -1
- package/ios/Records/SubtitleSource.swift +9 -0
- package/ios/VideoPlayerSubtitleSideload.swift +63 -9
- package/package.json +1 -1
- package/src/VideoPlayer.types.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ Changes inherited from the upstream base version are not repeated here — see t
|
|
|
7
7
|
[upstream changelog](https://github.com/expo/expo/blob/main/packages/expo-video/CHANGELOG.md)
|
|
8
8
|
for the history of everything that isn't subtitle related.
|
|
9
9
|
|
|
10
|
+
## 0.4.0
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **iOS:** `SubtitleSource.bottomOffset` lifts a sideloaded subtitle track off the bottom of the video,
|
|
15
|
+
as a fraction of its height. It is for releases that carry burned-in subtitles, where a sideloaded
|
|
16
|
+
track would otherwise be drawn on top of them. Android has had the same thing since 0.1.0 as
|
|
17
|
+
`subtitleStyle.bottomOffset`.
|
|
18
|
+
|
|
19
|
+
It lives on the source, not on `subtitleStyle`, because that is the only place iOS can read it from
|
|
20
|
+
in time. AVFoundation renders legible tracks itself and `AVPlayerItem.textStyleRules` carries no
|
|
21
|
+
positioning, so the position has to travel inside the WebVTT — written in as a `line:` cue setting
|
|
22
|
+
while the subtitle is merged into the video. That merge runs from the `VideoSource` alone, before any
|
|
23
|
+
`VideoView` has handed the player a style, so a view prop could not drive it without rebuilding the
|
|
24
|
+
player item every time a video starts. The two consequences are that it covers sideloaded tracks only
|
|
25
|
+
and that changing it takes effect on the next source load.
|
|
26
|
+
|
|
27
|
+
Cues that already position themselves are left alone, matching how Android passes explicitly
|
|
28
|
+
positioned cues through. Note the anchor differs between platforms: a bare WebVTT `line:` percentage
|
|
29
|
+
fixes the *top* of the cue box, where Android fixes the bottom, so a cue that wraps onto two lines
|
|
30
|
+
grows downward on iOS.
|
|
31
|
+
|
|
10
32
|
## 0.3.0
|
|
11
33
|
|
|
12
34
|
### Added
|
package/FORK.md
CHANGED
|
@@ -6,7 +6,7 @@ and (b) pull a newer `expo-video` release into it **without losing the subtitle
|
|
|
6
6
|
- **Baseline:** `expo-video@56.1.4` (Expo SDK 56), as published on npm.
|
|
7
7
|
- **Native module name:** unchanged (`ExpoVideo`) — this is a drop-in replacement, not a coexisting package.
|
|
8
8
|
- **Design principle:** the fork is deliberately **surgical and additive**. 7 new source files hold
|
|
9
|
-
almost all of the logic (~1,
|
|
9
|
+
almost all of the logic (~1,270 lines); the 19 touched upstream files receive ~470 added lines and
|
|
10
10
|
only ~44 removed ones. Nothing upstream is rewritten — the removals are call-site signatures and a
|
|
11
11
|
handful of rewritten function bodies — so a version bump is a small, mechanical re-apply.
|
|
12
12
|
|
|
@@ -20,9 +20,9 @@ Measured against the published `expo-video@56.1.4` tarball. `+`/`-` are added/re
|
|
|
20
20
|
|
|
21
21
|
| File | Lines | Purpose |
|
|
22
22
|
| --- | --- | --- |
|
|
23
|
-
| `ios/Records/SubtitleSource.swift` |
|
|
23
|
+
| `ios/Records/SubtitleSource.swift` | 41 | Record for one sideloaded subtitle; `isSrt` detection; `bottomOffset`, which lives here rather than on `SubtitleStyle` because the composition is built from a `VideoSource` alone, before any `VideoView` has supplied a style. |
|
|
24
24
|
| `ios/Records/SubtitleStyle.swift` | 118 | Record for caption styling; hex→ARGB parsing; builds `[AVTextStyleRule]`. |
|
|
25
|
-
| `ios/VideoPlayerSubtitleSideload.swift` |
|
|
25
|
+
| `ios/VideoPlayerSubtitleSideload.swift` | 257 | Builds the `AVMutableComposition`, downloads remote subs, SRT→WebVTT converter, and `applyLinePosition`, which writes a WebVTT `line:` cue setting per cue for `bottomOffset` — the only way to position captions AVFoundation renders itself. Cue timing lines are matched by **timestamp regex, not by searching for `-->`**: subtitle text may contain an arrow, and appending a cue setting to it prints the setting on screen. The temp-file hash includes `bottomOffset`, or a changed offset would reuse the rendition written for the previous one. |
|
|
26
26
|
| `android/…/records/SubtitleSource.kt` | 54 | Record → `MediaItem.SubtitleConfiguration` + MIME resolution. |
|
|
27
27
|
| `android/…/records/SubtitleStyle.kt` | 144 | Record → `CaptionStyleCompat`; hex colour parsing; font-family resolution (`res/font` → `ReactFontManager`); the `applyEmbeddedStyles` flag, which `SubtitleUtils` reads directly rather than `toCaptionStyle`. |
|
|
28
28
|
| `android/…/utils/StackingSubtitleParser.kt` | 300 | `SubtitleParser` for SubRip that segments the cue timeline and merges simultaneous cues into one stacked block, plus the `SubtitleParser.Factory` that routes SubRip to it. Assigns each cue a vertical slot it keeps for its whole time on screen — a finished cue's line is held blank (`\u200B`) so the cues above it do not drop. Merges through a `SpannableStringBuilder` so cue spans survive. |
|
|
@@ -36,7 +36,7 @@ Measured against the published `expo-video@56.1.4` tarball. `+`/`-` are added/re
|
|
|
36
36
|
|
|
37
37
|
| File | Δ | What to re-apply |
|
|
38
38
|
| --- | --- | --- |
|
|
39
|
-
| `src/VideoPlayer.types.ts` | +
|
|
39
|
+
| `src/VideoPlayer.types.ts` | +79 | `subtitleTracks?: SubtitleSource[]` on `VideoSourceObject`; the exported `SubtitleSource` type, including `bottomOffset`. |
|
|
40
40
|
| `src/VideoView.types.ts` | +129 | `subtitleStyle?: SubtitleStyle` on `VideoViewProps`; `SubtitleStyle` + `SubtitleEdgeType` types. |
|
|
41
41
|
| `src/index.ts` | +2 | Export `SubtitleStyle`, `SubtitleEdgeType` (`SubtitleSource` rides on `export type *`). |
|
|
42
42
|
| `src/VideoPlayer.web.tsx` | +5 / −1 | Hoist `JSON.stringify(source)` out of the `useMemo` dependency list into a `sourceKey` const. No behaviour change — it was already recomputed every render — but `react-hooks/use-memo` rejects non-simple expressions in a dependency array, and it was the single lint **error** in the package. |
|
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ const player = useVideoPlayer({
|
|
|
67
67
|
player.subtitleTrack = player.availableSubtitleTracks[0];
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
`SubtitleSource` fields: `uri` (local `file://` or remote `http(s)://`), `language` (BCP-47 / ISO 639), optional `label`, optional `format` (`'vtt' | 'srt'`, inferred from the extension when omitted), and optional `
|
|
70
|
+
`SubtitleSource` fields: `uri` (local `file://` or remote `http(s)://`), `language` (BCP-47 / ISO 639), optional `label`, optional `format` (`'vtt' | 'srt'`, inferred from the extension when omitted), optional `default`, and optional `bottomOffset` (iOS — see [Moving subtitles off burned-in captions](#moving-subtitles-off-burned-in-captions)).
|
|
71
71
|
|
|
72
72
|
| | Android | iOS |
|
|
73
73
|
| --- | --- | --- |
|
|
@@ -109,6 +109,42 @@ The empty line can also sit *between* two cues when the middle one finishes firs
|
|
|
109
109
|
left on screen, the stack resets and the next cue starts from the bottom again. This is Android-only;
|
|
110
110
|
on iOS the system renderer decides the layout.
|
|
111
111
|
|
|
112
|
+
### Moving subtitles off burned-in captions
|
|
113
|
+
|
|
114
|
+
Some releases have subtitles burned into the picture. A sideloaded track then lands in the same place
|
|
115
|
+
and the two overlap. Both platforms can lift the subtitles clear of them, but the setting lives in a
|
|
116
|
+
different place on each:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// Android — a VideoView prop, applies to every track, updates live
|
|
120
|
+
<VideoView player={player} subtitleStyle={{ bottomOffset: 0.22 }} />
|
|
121
|
+
|
|
122
|
+
// iOS — a field on the subtitle track itself
|
|
123
|
+
subtitleTracks: [{ uri: 'https://cdn.example.com/id.srt', language: 'id', bottomOffset: 0.22 }]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Both are a fraction of the video height (`0`–`1`) measured up from the bottom; larger values sit
|
|
127
|
+
higher. The Android default is `0.08`.
|
|
128
|
+
|
|
129
|
+
The split is not an oversight. On iOS the position has to travel inside the WebVTT itself — the system
|
|
130
|
+
renders legible tracks and `AVPlayerItem.textStyleRules` carries no positioning — so it is written in
|
|
131
|
+
while the subtitle is merged into the video. That happens from the `VideoSource` alone, before any
|
|
132
|
+
`VideoView` has supplied a style, so a style prop could not reach it without rebuilding the player item
|
|
133
|
+
on every load. Two consequences on iOS: it applies to **sideloaded tracks only**, and **changing it
|
|
134
|
+
takes effect the next time the source loads**.
|
|
135
|
+
|
|
136
|
+
| | Android | iOS |
|
|
137
|
+
| --- | --- | --- |
|
|
138
|
+
| Where | `subtitleStyle.bottomOffset` | `subtitleTracks[].bottomOffset` |
|
|
139
|
+
| Applies to | every track, embedded included | sideloaded tracks only |
|
|
140
|
+
| Updates | live | on next source load |
|
|
141
|
+
| Anchors | the bottom of the subtitle block | the top of it, so a two-line cue grows downward |
|
|
142
|
+
| Cues that position themselves | left alone | left alone |
|
|
143
|
+
|
|
144
|
+
That last row is worth knowing: subtitles carrying their own placement — SubRip `{\anN}` tags, WebVTT
|
|
145
|
+
cues with a `line:` setting — were positioned deliberately by whoever wrote them, so neither platform
|
|
146
|
+
moves them.
|
|
147
|
+
|
|
112
148
|
## Styling subtitles
|
|
113
149
|
|
|
114
150
|
Pass a `subtitleStyle` prop to `VideoView`. It applies to whichever subtitle track is currently displayed, whether embedded or sideloaded. Colors accept a hex string (`#RGB`, `#RRGGBB`, `#RRGGBBAA`) or `transparent`.
|
|
@@ -396,6 +396,25 @@ export type SubtitleSource = {
|
|
|
396
396
|
* @default false
|
|
397
397
|
*/
|
|
398
398
|
default?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* How far above the bottom of the video this track renders, as a fraction of the video height (0–1).
|
|
401
|
+
*
|
|
402
|
+
* Useful when a video already carries burned-in (hardcoded) subtitles and the sideloaded ones would
|
|
403
|
+
* otherwise be drawn on top of them.
|
|
404
|
+
*
|
|
405
|
+
* It sits here rather than on [`subtitleStyle`](#videoviewprops) because iOS can only apply it while
|
|
406
|
+
* the subtitle is being merged into the video, which happens from the `VideoSource` alone — before any
|
|
407
|
+
* `VideoView` has supplied a style. Changing it therefore takes effect the next time the source loads.
|
|
408
|
+
*
|
|
409
|
+
* > **Note:** cues that position themselves are left alone, so this does nothing for a WebVTT track
|
|
410
|
+
* > whose cues already carry a `line:` setting.
|
|
411
|
+
*
|
|
412
|
+
* On **Android** use [`subtitleStyle.bottomOffset`](#subtitlestylebottomoffset) instead, which does the
|
|
413
|
+
* same thing for every track at once and updates live.
|
|
414
|
+
*
|
|
415
|
+
* @platform ios
|
|
416
|
+
*/
|
|
417
|
+
bottomOffset?: number;
|
|
399
418
|
};
|
|
400
419
|
/**
|
|
401
420
|
* Contains information about any errors that the player encountered during the playback
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.types.d.ts","sourceRoot":"","sources":["../src/VideoPlayer.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACtE;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAEhC;;;;;;OAMG;IACH,eAAe,EAAE,eAAe,CAAC;IAEjC;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;;;;;;OAQG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7C;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9C;;;OA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,MAAM,oBAAoB,GAAG;IACjC;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.types.js","sourceRoot":"","sources":["../src/VideoPlayer.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC","sourcesContent":["import { SharedObject } from 'expo';\n\nimport type { VideoPlayerEvents } from './VideoPlayerEvents.types';\nimport type { VideoThumbnail } from './VideoThumbnail';\n\n/**\n * A class that represents an instance of the video player.\n */\nexport declare class VideoPlayer extends SharedObject<VideoPlayerEvents> {\n /**\n * Boolean value whether the player is currently playing.\n * > Use `play` and `pause` methods to control the playback.\n */\n readonly playing: boolean;\n\n /**\n * Determines whether the player should automatically replay after reaching the end of the video.\n * @default false\n */\n loop: boolean;\n\n /**\n * Determines whether the player should allow external playback.\n * @default true\n * @platform ios\n */\n allowsExternalPlayback: boolean;\n\n /**\n * Determines how the player will interact with other audio playing in the system.\n *\n * @default 'auto'\n * @platform android\n * @platform ios\n */\n audioMixingMode: AudioMixingMode;\n\n /**\n * Boolean value whether the player is currently muted.\n * Setting this property to `true`/`false` will mute/unmute the player.\n * @default false\n */\n muted: boolean;\n\n /**\n * Float value indicating the current playback time in seconds.\n *\n * If the player is not yet playing, this value indicates the time position\n * at which playback will begin once the `play()` method is called.\n *\n * Setting `currentTime` to a new value seeks the player to the given time.\n * Check out the [`seekTolerance`](#seektolerance) property to configure the seeking precision.\n */\n currentTime: number;\n\n /**\n * The exact timestamp when the currently displayed video frame was sent from the server,\n * based on the `EXT-X-PROGRAM-DATE-TIME` tag in the livestream metadata.\n * If this metadata is missing, this property will return `null`.\n * @platform android\n * @platform ios\n */\n readonly currentLiveTimestamp: number | null;\n\n /**\n * Float value indicating the latency of the live stream in seconds.\n * If a livestream doesn't have the required metadata, this will return `null`.\n * @platform android\n * @platform ios\n */\n readonly currentOffsetFromLive: number | null;\n\n /**\n * Float value indicating the time offset from the live in seconds.\n * @platform ios\n */\n targetOffsetFromLive: number;\n\n /**\n * Float value indicating the duration of the current video in seconds.\n */\n readonly duration: number;\n\n /**\n * Float value between `0` and `1.0` representing the current volume.\n * Muting the player doesn't affect the volume. In other words, when the player is muted, the volume is the same as\n * when unmuted. Similarly, setting the volume doesn't unmute the player.\n * @default 1.0\n */\n volume: number;\n\n /**\n * Boolean value indicating if the player should correct audio pitch when the playback speed changes.\n * @default true\n */\n preservesPitch: boolean;\n\n /**\n * Float value indicating the interval in seconds at which the player will emit the [`timeUpdate`](#videoplayerevents) event.\n * When the value is equal to `0`, the event will not be emitted.\n *\n * @default 0\n */\n timeUpdateEventInterval: number;\n\n /**\n * Float value between `0` and `16.0` indicating the current playback speed of the player.\n * @default 1.0\n */\n playbackRate: number;\n\n /**\n * Boolean indicating if the player should keep the screen on while playing.\n *\n * > On Android, this property has an effect only when a [`VideoView`](#videoview) is visible. If you want to keep the screen awake at all times use [`expo-keep-awake`](./keep-awake/).\n *\n * @default true\n * @platform android\n * @platform ios\n */\n keepScreenOnWhilePlaying: boolean;\n\n /**\n * Boolean value indicating whether the player is currently playing a live stream.\n */\n readonly isLive: boolean;\n\n /**\n * Indicates the current status of the player.\n */\n readonly status: VideoPlayerStatus;\n\n /**\n * Boolean value determining whether the player should show the now playing notification.\n *\n * > **Note**: On Android, `supportsBackgroundPlayback` property of the [config plugin](#configuration-in-app-config)\n * > has to be `true` for the now playing notification to work.\n * @default false\n * @platform android\n * @platform ios\n */\n showNowPlayingNotification: boolean;\n\n /**\n * Determines whether the player should continue playing after the app enters the background.\n *\n * > **Note**: The `supportsBackgroundPlayback` property of the [config plugin](#configuration-in-app-config)\n * > has to be `true` for the background playback to work.\n * @default false\n * @platform ios\n * @platform android\n */\n staysActiveInBackground: boolean;\n\n /**\n * Float value indicating how far the player has buffered the video in seconds.\n *\n * This value is 0 when the player has not buffered up to the current playback time.\n * When it's impossible to determine the buffer state (for example, when the player isn't playing any media), this value is -1.\n */\n readonly bufferedPosition: number;\n\n /**\n * Specifies buffer options which will be used by the player when buffering the video.\n *\n * > You should provide a `BufferOptions` object when setting this property. Setting individual buffer properties is not supported.\n * @platform android\n * @platform ios\n */\n bufferOptions: BufferOptions;\n\n /**\n * Specifies the subtitle track which is currently displayed by the player. `null` when no subtitles are displayed.\n *\n * > To ensure a valid subtitle track, always assign one of the subtitle tracks from the [`availableSubtitleTracks`](#availablesubtitletracks) array.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n subtitleTrack: SubtitleTrack | null;\n\n /**\n * Specifies the audio track currently played by the player. `null` when no audio is played.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n audioTrack: AudioTrack | null;\n\n /**\n * An array of audio tracks available for the current video.\n *\n * @platform android\n * @platform ios\n */\n readonly availableAudioTracks: AudioTrack[];\n\n /**\n * An array of subtitle tracks available for the current video.\n *\n * @platform android\n * @platform ios\n */\n readonly availableSubtitleTracks: SubtitleTrack[];\n\n /**\n * Specifies the video track currently played by the player. `null` when no video is displayed.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n readonly videoTrack: VideoTrack | null;\n\n /**\n * An array of video tracks available for the current video.\n *\n * > On iOS, when using a HLS source, make sure that the uri contains `.m3u8` extension or that the [`contentType`](#contenttype) property of the [`VideoSource`](#videosource) has been set to `'hls'`. Otherwise, the video tracks will not be available.\n *\n * @platform android\n * @platform ios\n */\n readonly availableVideoTracks: VideoTrack[];\n\n /**\n * Indicates whether the player is currently playing back the media to an external device via AirPlay.\n *\n * @platform ios\n */\n readonly isExternalPlaybackActive: boolean;\n\n /**\n * Determines the time that the actual position seeked to may precede or exceed the requested seek position.\n *\n * This property affects the precision of setting the [`currentTime`](#currenttime) property and the [`seekBy`](#seekbyseconds) method, and on Android, it also affects the accuracy of the scrubber from the default native controls.\n *\n * By default, the player seeks to the exact requested time.\n *\n * > If you are trying to optimize for scrubbing (many frequent seeks), also see [`ScrubbingModeOptions`](#scrubbingmodeoptions-1).\n */\n seekTolerance: SeekTolerance;\n\n /**\n * Determines whether the scrubbing mode is enabled and what scrubbing optimizations should be enabled.\n *\n * > See [`SeekTolerance`](#seektolerance) to set the seeking tolerance, which can also affect the scrubbing performance.\n *\n */\n scrubbingModeOptions: ScrubbingModeOptions;\n\n /**\n * Initializes a new video player instance with the given source.\n *\n * @param source The source of the video to be played.\n * @param useSynchronousReplace Optional parameter, when `true` `source` from the first parameter will be loaded on the main thread.\n * @param playerBuilderOptions Options to apply to the player builder before the native constructor is invoked.\n * @hidden\n */\n constructor(\n source: VideoSource,\n useSynchronousReplace?: boolean,\n playerBuilderOptions?: PlayerBuilderOptions\n );\n\n /**\n * Resumes the player.\n */\n play(): void;\n\n /**\n * Pauses the player.\n */\n pause(): void;\n\n /**\n * Replaces the current source with a new one.\n *\n * > On iOS, this method loads the asset data synchronously on the UI thread and can block it for extended periods of time.\n * > Use `replaceAsync` to load the asset asynchronously and avoid UI lags.\n *\n * > This method will be deprecated in the future.\n */\n replace(source: VideoSource, disableWarning?: boolean): void;\n\n /**\n * Replaces the current source with a new one, while offloading loading of the asset to a different thread.\n *\n * > On Android and Web, this method is equivalent to `replace`.\n */\n replaceAsync(source: VideoSource): Promise<void>;\n\n /**\n * Seeks the playback by the given number of seconds. The time to which the player seeks may differ from the specified requested time for efficiency,\n * depending on the encoding and what is currently buffered by the player. Use this function to implement playback controls that seek by specific amount of time,\n * in which case, the actual time usually does not have to be precise. For frame accurate seeking, use the [`currentTime`](#currenttime) property.\n */\n seekBy(seconds: number): void;\n\n /**\n * Seeks the playback to the beginning.\n */\n replay(): void;\n\n /**\n * Generates thumbnails from the currently played asset. The thumbnails are references to native images,\n * thus they can be used as a source of the `Image` component from `expo-image`.\n * @platform android\n * @platform ios\n */\n generateThumbnailsAsync(\n times: number | number[],\n options?: VideoThumbnailOptions\n ): Promise<VideoThumbnail[]>;\n}\n\n/**\n * Additional options for video thumbnails generation.\n */\nexport type VideoThumbnailOptions = {\n /**\n * If provided, the generated thumbnail will not exceed this width in pixels, preserving its aspect ratio.\n * @platform android\n * @platform ios\n */\n maxWidth?: number;\n\n /**\n * If provided, the generated thumbnail will not exceed this height in pixels, preserving its aspect ratio.\n * @platform android\n * @platform ios\n */\n maxHeight?: number;\n};\n\n/**\n * Describes the current status of the player.\n * - `idle`: The player is not playing or loading any videos.\n * - `loading`: The player is loading video data from the provided source\n * - `readyToPlay`: The player has loaded enough data to start playing or to continue playback.\n * - `error`: The player has encountered an error while loading or playing the video.\n */\nexport type VideoPlayerStatus = 'idle' | 'loading' | 'readyToPlay' | 'error';\n\nexport type VideoSource = string | number | null | VideoSourceObject;\n\nexport type VideoSourceObject = {\n /**\n * The URI of the video.\n *\n * On iOS, `PHAsset` URIs are supported, but can only be loaded using the [`replaceAsync`](#replaceasyncsource) method or the default [`VideoPlayer`](#videoplayer) constructor.\n *\n * This property is exclusive with the `assetId` property. When both are present, the `assetId` will be ignored.\n */\n uri?: string;\n\n /**\n * The asset ID of a local video asset, acquired with the `require` function.\n * This property is exclusive with the `uri` property. When both are present, the `assetId` will be ignored.\n */\n assetId?: number;\n\n /**\n * Specifies the DRM options which will be used by the player while loading the video.\n */\n drm?: DRMOptions;\n\n /**\n * Specifies information which will be displayed in the now playing notification.\n * When undefined the player will display information contained in the video metadata.\n * @platform android\n * @platform ios\n */\n metadata?: VideoMetadata;\n\n /**\n * Specifies headers sent with the video request.\n * > For DRM license headers use the `headers` field of [`DRMOptions`](#drmoptions).\n * @platform android\n * @platform ios\n */\n headers?: Record<string, string>;\n\n /**\n * Specifies whether the player should use caching for the video.\n * > Due to platform limitations, the cache cannot be used with HLS video sources on iOS. Caching DRM-protected videos is not supported on Android and iOS.\n * @default false\n * @platform android\n * @platform ios\n */\n useCaching?: boolean;\n\n /**\n * Specifies the content type of the video source. When set to `'auto'`, the player will try to automatically determine the content type.\n *\n * You should use this property when playing HLS, SmoothStreaming or DASH videos from an uri, which does not contain a standardized extension for the corresponding media type.\n * @default 'auto'\n * @platform android\n * @platform ios\n */\n contentType?: ContentType;\n\n /**\n * An array of external (sideloaded) subtitle files to attach to the video source.\n *\n * Use this to add subtitles to sources that don't declare their own subtitle tracks — most importantly\n * progressive `MP4` files, which (unlike `HLS`/`DASH` manifests) cannot advertise external subtitle renditions.\n * The sideloaded tracks are merged into the media and become available through\n * [`availableSubtitleTracks`](#availablesubtitletracks), so they can be selected with\n * [`subtitleTrack`](#subtitletrack) just like embedded tracks.\n *\n * > **Note (iOS):** sideloading is done by building an `AVMutableComposition`, which has platform limitations:\n * > the video must be a progressive (non-HLS) source without DRM, remote subtitle files are downloaded to a\n * > local cache first, and only `WebVTT` is natively supported (`SRT` files are converted to `WebVTT`\n * > automatically). Sideloading only runs on the asynchronous loading path (the default `VideoPlayer`\n * > constructor and [`replaceAsync`](#replaceasyncsource)), not on the synchronous `replace`.\n *\n * @platform android\n * @platform ios\n */\n subtitleTracks?: SubtitleSource[];\n};\n\n/**\n * Describes a single external (sideloaded) subtitle file that can be attached to a [`VideoSource`](#videosource).\n */\nexport type SubtitleSource = {\n /**\n * The URI of the subtitle file. Both local (`file://`) and remote (`http(s)://`) URIs are supported.\n */\n uri: string;\n\n /**\n * The BCP-47 / ISO 639 language code of the subtitle track, for example `en`, `pl`, `de`.\n * This value is used to identify and select the track and is shown in the native track selector.\n */\n language: string;\n\n /**\n * A human-readable label for the track, shown in the native subtitle selection UI.\n * When omitted, a label is derived from the `language`.\n */\n label?: string;\n\n /**\n * The format of the subtitle file.\n * When omitted, the format is inferred from the file extension (`.vtt` / `.srt`).\n *\n * - `vtt`: WebVTT subtitles (`text/vtt`).\n * - `srt`: SubRip subtitles (`application/x-subrip`). On iOS these are converted to WebVTT before sideloading.\n *\n * @default inferred from the uri extension\n */\n format?: 'vtt' | 'srt';\n\n /**\n * Whether this track should be marked as the default subtitle track.\n * @default false\n */\n default?: boolean;\n};\n\n/**\n * Contains information about any errors that the player encountered during the playback\n */\nexport type PlayerError = {\n message: string;\n};\n\n/**\n * Contains information that will be displayed in the now playing notification when the video is playing.\n * @platform android\n * @platform ios\n */\nexport type VideoMetadata = {\n /**\n * The title of the video.\n * @platform android\n * @platform ios\n */\n title?: string;\n /**\n * Secondary text that will be displayed under the title.\n * @platform android\n * @platform ios\n */\n artist?: string;\n /**\n * The uri of the video artwork.\n * @platform android\n * @platform ios\n */\n artwork?: string;\n};\n\n/**\n * Specifies which type of DRM to use:\n * - Android supports ClearKey, PlayReady and Widevine.\n * - iOS supports FairPlay.\n */\nexport type DRMType = 'clearkey' | 'fairplay' | 'playready' | 'widevine';\n\n/**\n * Specifies DRM options which will be used by the player while loading the video.\n */\nexport type DRMOptions = {\n /**\n * Determines which type of DRM to use.\n */\n type: DRMType;\n\n /**\n * Determines the license server URL.\n */\n licenseServer: string;\n\n /**\n * Determines headers sent to the license server on license requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Specifies whether the DRM is a multi-key DRM.\n * @platform android\n */\n multiKey?: boolean;\n\n /**\n * Specifies the content ID of the stream.\n * @platform ios\n */\n contentId?: string;\n\n /**\n * Specifies the certificate URL for the FairPlay DRM.\n * @platform ios\n */\n certificateUrl?: string;\n\n /**\n * Specifies the base64 encoded certificate data for the FairPlay DRM.\n * When this property is set, the `certificateUrl` property is ignored.\n * @platform ios\n */\n base64CertificateData?: string;\n};\n\n/**\n * Specifies buffer options which will be used by the player when buffering the video.\n *\n * @platform android\n * @platform ios\n */\nexport type BufferOptions = {\n /**\n * The duration in seconds which determines how much media the player should buffer ahead of the current playback time.\n *\n * On iOS when set to `0` the player will automatically decide appropriate buffer duration.\n *\n * Equivalent to [`AVPlayerItem.preferredForwardBufferDuration`](https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration).\n * @default Android: 20, iOS: 0\n * @platform android\n * @platform ios\n */\n readonly preferredForwardBufferDuration?: number;\n\n /**\n * A Boolean value that indicates whether the player should automatically delay playback in order to minimize stalling.\n *\n * Equivalent to [`AVPlayer.automaticallyWaitsToMinimizeStalling`](https://developer.apple.com/documentation/avfoundation/avplayer/1643482-automaticallywaitstominimizestal).\n * @default true\n * @platform ios\n */\n readonly waitsToMinimizeStalling?: boolean;\n\n /**\n * Minimum duration of the buffer in seconds required to continue playing after the player has been paused or started buffering.\n *\n * > This property will be ignored if `preferredForwardBufferDuration` is lower.\n * @default 2\n * @platform android\n */\n readonly minBufferForPlayback?: number;\n\n /**\n * The maximum number of bytes that the player can buffer from the network.\n * When 0 the player will automatically decide appropriate buffer size.\n *\n * @default 0\n * @platform android\n */\n readonly maxBufferBytes?: number | null;\n\n /**\n * A Boolean value which determines whether the player should prioritize time over size when buffering media.\n *\n * @default false\n * @platform android\n */\n readonly prioritizeTimeOverSizeThreshold?: boolean;\n};\n\n/**\n * Specifies the content type of the source.\n *\n * - `auto`: The player will automatically determine the content type of the video.\n * - `progressive`: The player will use progressive download content type. This is the default `ContentType` when the uri does not contain an extension.\n * - `hls`: The player will use HLS content type.\n * - `dash`: The player will use DASH content type (Android-only).\n * - `smoothStreaming`: The player will use SmoothStreaming content type (Android-only).\n *\n * @default `auto`\n */\nexport type ContentType = 'auto' | 'progressive' | 'hls' | 'dash' | 'smoothStreaming';\n\n/**\n * Specifies the audio mode that the player should use. Audio mode is set on per-app basis, if there are multiple players playing and\n * have different a `AudioMode` specified, the highest priority mode will be used. Priority order: 'doNotMix' > 'auto' > 'duckOthers' > 'mixWithOthers'.\n *\n * - `mixWithOthers`: The player will mix its audio output with other apps.\n * - `duckOthers`: The player will lower the volume of other apps if any of the active players is outputting audio.\n * - `auto`: The player will allow other apps to keep playing audio only when it is muted. On iOS it will always interrupt other apps when `showNowPlayingNotification` is `true` due to system requirements.\n * - `doNotMix`: The player will pause playback in other apps, even when it's muted.\n *\n * > On iOS, the Now Playing notification is dependent on the audio mode. If the audio mode is different from `doNotMix` or `auto` this feature will not work.\n */\nexport type AudioMixingMode = 'mixWithOthers' | 'duckOthers' | 'auto' | 'doNotMix';\n\nexport type SubtitleTrack = {\n /**\n * A string used by `expo-video` to identify the subtitle track.\n *\n * @platform android\n */\n id?: string;\n\n /**\n * Language of the subtitle track. For example, `en`, `pl`, `de`.\n */\n language: string;\n\n /**\n * Label of the subtitle track in the language of the device.\n */\n label: string;\n\n /**\n * Name of the subtitle track as specified in the media source.\n * @platform android\n * @platform ios\n */\n name?: string;\n\n /**\n * Indicates whether this is the default subtitle track.\n * @platform android\n * @platform ios\n */\n isDefault?: boolean;\n\n /**\n * Indicates whether this track should be auto-selected based on user preferences.\n * @platform android\n * @platform ios\n */\n autoSelect?: boolean;\n};\n\n/**\n * Specifies a VideoTrack loaded from a [`VideoSource`](#videosource).\n */\nexport type VideoTrack = {\n /**\n * The id of the video track.\n *\n * > This field is platform-specific and may return different depending on the operating system.\n */\n id: string;\n\n /**\n * The URL of the `VideoTrack` for HLS video sources. `null` for other source types.\n */\n url: string | null;\n\n /**\n * Size of the video track.\n */\n size: VideoSize;\n\n /**\n * MimeType of the video track or null if unknown.\n */\n mimeType: string | null;\n\n /**\n * Indicates whether the video track format is supported by the device.\n *\n * @platform android\n */\n isSupported: boolean;\n\n /**\n * Specifies the bitrate in bits per second. This is the peak bitrate if known, or else the average bitrate if known, or else null.\n *\n * @deprecated Use `peakBitrate` or `averageBitrate` instead.\n */\n bitrate: number | null;\n\n /**\n * Specifies the average bitrate in bits per second or null if the value is unknown.\n *\n */\n averageBitrate: number | null;\n\n /**\n * Specifies the average bitrate in bits per second or null if the value is unknown.\n */\n peakBitrate: number | null;\n\n /**\n * Specifies the frame rate of the video track in frames per second.\n */\n frameRate: number | null;\n\n /**\n * Specifies the video range of the video track.\n */\n videoRange: VideoRange;\n};\n\n/**\n * Specifies the size of a video track.\n */\nexport type VideoSize = {\n /**\n * Width of the video track in pixels.\n */\n width: number;\n /**\n * Height of the video track in pixels.\n */\n height: number;\n};\n\nexport type AudioTrack = {\n /**\n * A string used by expo-video to identify the audio track.\n * @platform android\n */\n id?: string;\n\n /**\n * Language of the audio track. For example, 'en', 'pl', 'de'.\n */\n language: string;\n\n /**\n * Label of the audio track in the language of the device.\n */\n label: string;\n\n /**\n * Name of the audio track as specified in the media source.\n * @platform android\n * @platform ios\n */\n name?: string;\n\n /**\n * Indicates whether this is the default audio track.\n * @platform android\n * @platform ios\n */\n isDefault?: boolean;\n\n /**\n * Indicates whether this track should be auto-selected based on user preferences.\n * @platform android\n * @platform ios\n */\n autoSelect?: boolean;\n};\n\n/**\n * Determines the time that the actual position seeked to may precede or exceed the requested seek position.\n * Larger tolerance will usually result in faster seeking.\n * This property affects the precision of setting the [`currentTime`](#currenttime) property and the [`seekBy`](#seekbyseconds) method, and on Android, it also affects the accuracy of the scrubber from the default native controls.\n *\n * > If you are trying to optimize for scrubbing (many frequent seeks), also see [`ScrubbingModeOptions`](#scrubbingmodeoptions-1).\n *\n * @platform android\n * @platform ios\n */\nexport type SeekTolerance = {\n /**\n * The maximum time that the actual position seeked to may precede the requested seek position, in seconds. Must be non-negative.\n * @default 0\n */\n toleranceBefore?: number;\n\n /**\n * The maximum time that the actual position seeked to may exceed the requested seek position, in seconds. Must be non-negative.\n * @default 0\n */\n toleranceAfter?: number;\n};\n\n/**\n * Defines scrubbing mode options used by a [`VideoPlayer`](#videoplayer).\n */\nexport type ScrubbingModeOptions = {\n /**\n * Whether the codec operating rate should be increased in scrubbing mode.\n *\n * You should only enable this when the player is receiving a large number of seeks in a short period of time. For less frequent seeks, fine-tuning the [`SeekTolerance`](#seektolerance-1) may be sufficient.\n *\n * On Android, the player may consume more resources in this mode, so it should only be used for short periods of time in response to user interaction (for example, dragging on a progress bar UI element).\n *\n * On Android, when `scrubbingModeEnabled` is `true`, the playback is suppressed. You should set this property back to `false` when the user interaction ends to allow the playback to resume.\n * For best results, on iOS you should pause the playback when scrubbing.\n *\n * > For best scrubbing performance, consider also increasing the seeking tolerance using the [`SeekTolerance`](#seektolerance-1) property.\n *\n * > Other scrubbing mode options will have no effect when this is `false`.\n * @default false\n * @platform android\n * @platform ios\n */\n scrubbingModeEnabled?: boolean;\n\n /**\n * Whether the codec operating rate should be increased in scrubbing mode.\n *\n * @platform android\n * @default true\n */\n increaseCodecOperatingRate?: boolean;\n\n /**\n * Sets whether ExoPlayer's dynamic scheduling should be enabled in scrubbing mode.\n * This can result in available output buffers being handled more quickly when seeking.\n *\n * @platform android\n * @default true\n */\n enableDynamicScheduling?: boolean;\n /**\n * Sets whether to use `MediaCodec.BUFFER_FLAG_DECODE_ONLY` in scrubbing mode.\n * When playback is using MediaCodec on API 34+, this flag can speed up seeking by signalling that the decoded output of buffers between the previous keyframe and the target frame is not needed by the player.\n *\n * @platform android\n * @default true\n */\n useDecodeOnlyFlag?: boolean;\n\n /**\n * Sets whether to avoid flushing the decoder (where possible) in scrubbing mode.\n * When `true`, avoids flushing the decoder when a new seek starts decoding from a key-frame in compatible content.\n *\n * @platform android\n * @default true\n */\n allowSkippingMediaCodecFlush?: boolean;\n};\n\n/**\n * Options to apply to the player builder before the native constructor is invoked\n * @platform android\n */\nexport type PlayerBuilderOptions = {\n /**\n * Seek backward increment in seconds.\n * Values will be clamped between 0.001 and 999 seconds.\n * @platform android\n */\n seekBackwardIncrement?: number;\n\n /**\n * Seek forward increment in seconds.\n * Values will be clamped between 0.001 and 999 seconds.\n * @platform android\n */\n seekForwardIncrement?: number;\n};\n\n/**\n * Specifies the dynamic range of the video content.\n * - `sdr`: Standard Dynamic Range video.\n * - `hlg`: Hybrid Log-Gamma - HDR backward-compatible with SDR displays\n * - `pq`: Perceptual Quantizer - Formats like HDR10 and Dolby Vision\n */\nexport type VideoRange = 'sdr' | 'hlg' | 'pq';\n"]}
|
|
1
|
+
{"version":3,"file":"VideoPlayer.types.js","sourceRoot":"","sources":["../src/VideoPlayer.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC","sourcesContent":["import { SharedObject } from 'expo';\n\nimport type { VideoPlayerEvents } from './VideoPlayerEvents.types';\nimport type { VideoThumbnail } from './VideoThumbnail';\n\n/**\n * A class that represents an instance of the video player.\n */\nexport declare class VideoPlayer extends SharedObject<VideoPlayerEvents> {\n /**\n * Boolean value whether the player is currently playing.\n * > Use `play` and `pause` methods to control the playback.\n */\n readonly playing: boolean;\n\n /**\n * Determines whether the player should automatically replay after reaching the end of the video.\n * @default false\n */\n loop: boolean;\n\n /**\n * Determines whether the player should allow external playback.\n * @default true\n * @platform ios\n */\n allowsExternalPlayback: boolean;\n\n /**\n * Determines how the player will interact with other audio playing in the system.\n *\n * @default 'auto'\n * @platform android\n * @platform ios\n */\n audioMixingMode: AudioMixingMode;\n\n /**\n * Boolean value whether the player is currently muted.\n * Setting this property to `true`/`false` will mute/unmute the player.\n * @default false\n */\n muted: boolean;\n\n /**\n * Float value indicating the current playback time in seconds.\n *\n * If the player is not yet playing, this value indicates the time position\n * at which playback will begin once the `play()` method is called.\n *\n * Setting `currentTime` to a new value seeks the player to the given time.\n * Check out the [`seekTolerance`](#seektolerance) property to configure the seeking precision.\n */\n currentTime: number;\n\n /**\n * The exact timestamp when the currently displayed video frame was sent from the server,\n * based on the `EXT-X-PROGRAM-DATE-TIME` tag in the livestream metadata.\n * If this metadata is missing, this property will return `null`.\n * @platform android\n * @platform ios\n */\n readonly currentLiveTimestamp: number | null;\n\n /**\n * Float value indicating the latency of the live stream in seconds.\n * If a livestream doesn't have the required metadata, this will return `null`.\n * @platform android\n * @platform ios\n */\n readonly currentOffsetFromLive: number | null;\n\n /**\n * Float value indicating the time offset from the live in seconds.\n * @platform ios\n */\n targetOffsetFromLive: number;\n\n /**\n * Float value indicating the duration of the current video in seconds.\n */\n readonly duration: number;\n\n /**\n * Float value between `0` and `1.0` representing the current volume.\n * Muting the player doesn't affect the volume. In other words, when the player is muted, the volume is the same as\n * when unmuted. Similarly, setting the volume doesn't unmute the player.\n * @default 1.0\n */\n volume: number;\n\n /**\n * Boolean value indicating if the player should correct audio pitch when the playback speed changes.\n * @default true\n */\n preservesPitch: boolean;\n\n /**\n * Float value indicating the interval in seconds at which the player will emit the [`timeUpdate`](#videoplayerevents) event.\n * When the value is equal to `0`, the event will not be emitted.\n *\n * @default 0\n */\n timeUpdateEventInterval: number;\n\n /**\n * Float value between `0` and `16.0` indicating the current playback speed of the player.\n * @default 1.0\n */\n playbackRate: number;\n\n /**\n * Boolean indicating if the player should keep the screen on while playing.\n *\n * > On Android, this property has an effect only when a [`VideoView`](#videoview) is visible. If you want to keep the screen awake at all times use [`expo-keep-awake`](./keep-awake/).\n *\n * @default true\n * @platform android\n * @platform ios\n */\n keepScreenOnWhilePlaying: boolean;\n\n /**\n * Boolean value indicating whether the player is currently playing a live stream.\n */\n readonly isLive: boolean;\n\n /**\n * Indicates the current status of the player.\n */\n readonly status: VideoPlayerStatus;\n\n /**\n * Boolean value determining whether the player should show the now playing notification.\n *\n * > **Note**: On Android, `supportsBackgroundPlayback` property of the [config plugin](#configuration-in-app-config)\n * > has to be `true` for the now playing notification to work.\n * @default false\n * @platform android\n * @platform ios\n */\n showNowPlayingNotification: boolean;\n\n /**\n * Determines whether the player should continue playing after the app enters the background.\n *\n * > **Note**: The `supportsBackgroundPlayback` property of the [config plugin](#configuration-in-app-config)\n * > has to be `true` for the background playback to work.\n * @default false\n * @platform ios\n * @platform android\n */\n staysActiveInBackground: boolean;\n\n /**\n * Float value indicating how far the player has buffered the video in seconds.\n *\n * This value is 0 when the player has not buffered up to the current playback time.\n * When it's impossible to determine the buffer state (for example, when the player isn't playing any media), this value is -1.\n */\n readonly bufferedPosition: number;\n\n /**\n * Specifies buffer options which will be used by the player when buffering the video.\n *\n * > You should provide a `BufferOptions` object when setting this property. Setting individual buffer properties is not supported.\n * @platform android\n * @platform ios\n */\n bufferOptions: BufferOptions;\n\n /**\n * Specifies the subtitle track which is currently displayed by the player. `null` when no subtitles are displayed.\n *\n * > To ensure a valid subtitle track, always assign one of the subtitle tracks from the [`availableSubtitleTracks`](#availablesubtitletracks) array.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n subtitleTrack: SubtitleTrack | null;\n\n /**\n * Specifies the audio track currently played by the player. `null` when no audio is played.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n audioTrack: AudioTrack | null;\n\n /**\n * An array of audio tracks available for the current video.\n *\n * @platform android\n * @platform ios\n */\n readonly availableAudioTracks: AudioTrack[];\n\n /**\n * An array of subtitle tracks available for the current video.\n *\n * @platform android\n * @platform ios\n */\n readonly availableSubtitleTracks: SubtitleTrack[];\n\n /**\n * Specifies the video track currently played by the player. `null` when no video is displayed.\n *\n * @default null\n * @platform android\n * @platform ios\n */\n readonly videoTrack: VideoTrack | null;\n\n /**\n * An array of video tracks available for the current video.\n *\n * > On iOS, when using a HLS source, make sure that the uri contains `.m3u8` extension or that the [`contentType`](#contenttype) property of the [`VideoSource`](#videosource) has been set to `'hls'`. Otherwise, the video tracks will not be available.\n *\n * @platform android\n * @platform ios\n */\n readonly availableVideoTracks: VideoTrack[];\n\n /**\n * Indicates whether the player is currently playing back the media to an external device via AirPlay.\n *\n * @platform ios\n */\n readonly isExternalPlaybackActive: boolean;\n\n /**\n * Determines the time that the actual position seeked to may precede or exceed the requested seek position.\n *\n * This property affects the precision of setting the [`currentTime`](#currenttime) property and the [`seekBy`](#seekbyseconds) method, and on Android, it also affects the accuracy of the scrubber from the default native controls.\n *\n * By default, the player seeks to the exact requested time.\n *\n * > If you are trying to optimize for scrubbing (many frequent seeks), also see [`ScrubbingModeOptions`](#scrubbingmodeoptions-1).\n */\n seekTolerance: SeekTolerance;\n\n /**\n * Determines whether the scrubbing mode is enabled and what scrubbing optimizations should be enabled.\n *\n * > See [`SeekTolerance`](#seektolerance) to set the seeking tolerance, which can also affect the scrubbing performance.\n *\n */\n scrubbingModeOptions: ScrubbingModeOptions;\n\n /**\n * Initializes a new video player instance with the given source.\n *\n * @param source The source of the video to be played.\n * @param useSynchronousReplace Optional parameter, when `true` `source` from the first parameter will be loaded on the main thread.\n * @param playerBuilderOptions Options to apply to the player builder before the native constructor is invoked.\n * @hidden\n */\n constructor(\n source: VideoSource,\n useSynchronousReplace?: boolean,\n playerBuilderOptions?: PlayerBuilderOptions\n );\n\n /**\n * Resumes the player.\n */\n play(): void;\n\n /**\n * Pauses the player.\n */\n pause(): void;\n\n /**\n * Replaces the current source with a new one.\n *\n * > On iOS, this method loads the asset data synchronously on the UI thread and can block it for extended periods of time.\n * > Use `replaceAsync` to load the asset asynchronously and avoid UI lags.\n *\n * > This method will be deprecated in the future.\n */\n replace(source: VideoSource, disableWarning?: boolean): void;\n\n /**\n * Replaces the current source with a new one, while offloading loading of the asset to a different thread.\n *\n * > On Android and Web, this method is equivalent to `replace`.\n */\n replaceAsync(source: VideoSource): Promise<void>;\n\n /**\n * Seeks the playback by the given number of seconds. The time to which the player seeks may differ from the specified requested time for efficiency,\n * depending on the encoding and what is currently buffered by the player. Use this function to implement playback controls that seek by specific amount of time,\n * in which case, the actual time usually does not have to be precise. For frame accurate seeking, use the [`currentTime`](#currenttime) property.\n */\n seekBy(seconds: number): void;\n\n /**\n * Seeks the playback to the beginning.\n */\n replay(): void;\n\n /**\n * Generates thumbnails from the currently played asset. The thumbnails are references to native images,\n * thus they can be used as a source of the `Image` component from `expo-image`.\n * @platform android\n * @platform ios\n */\n generateThumbnailsAsync(\n times: number | number[],\n options?: VideoThumbnailOptions\n ): Promise<VideoThumbnail[]>;\n}\n\n/**\n * Additional options for video thumbnails generation.\n */\nexport type VideoThumbnailOptions = {\n /**\n * If provided, the generated thumbnail will not exceed this width in pixels, preserving its aspect ratio.\n * @platform android\n * @platform ios\n */\n maxWidth?: number;\n\n /**\n * If provided, the generated thumbnail will not exceed this height in pixels, preserving its aspect ratio.\n * @platform android\n * @platform ios\n */\n maxHeight?: number;\n};\n\n/**\n * Describes the current status of the player.\n * - `idle`: The player is not playing or loading any videos.\n * - `loading`: The player is loading video data from the provided source\n * - `readyToPlay`: The player has loaded enough data to start playing or to continue playback.\n * - `error`: The player has encountered an error while loading or playing the video.\n */\nexport type VideoPlayerStatus = 'idle' | 'loading' | 'readyToPlay' | 'error';\n\nexport type VideoSource = string | number | null | VideoSourceObject;\n\nexport type VideoSourceObject = {\n /**\n * The URI of the video.\n *\n * On iOS, `PHAsset` URIs are supported, but can only be loaded using the [`replaceAsync`](#replaceasyncsource) method or the default [`VideoPlayer`](#videoplayer) constructor.\n *\n * This property is exclusive with the `assetId` property. When both are present, the `assetId` will be ignored.\n */\n uri?: string;\n\n /**\n * The asset ID of a local video asset, acquired with the `require` function.\n * This property is exclusive with the `uri` property. When both are present, the `assetId` will be ignored.\n */\n assetId?: number;\n\n /**\n * Specifies the DRM options which will be used by the player while loading the video.\n */\n drm?: DRMOptions;\n\n /**\n * Specifies information which will be displayed in the now playing notification.\n * When undefined the player will display information contained in the video metadata.\n * @platform android\n * @platform ios\n */\n metadata?: VideoMetadata;\n\n /**\n * Specifies headers sent with the video request.\n * > For DRM license headers use the `headers` field of [`DRMOptions`](#drmoptions).\n * @platform android\n * @platform ios\n */\n headers?: Record<string, string>;\n\n /**\n * Specifies whether the player should use caching for the video.\n * > Due to platform limitations, the cache cannot be used with HLS video sources on iOS. Caching DRM-protected videos is not supported on Android and iOS.\n * @default false\n * @platform android\n * @platform ios\n */\n useCaching?: boolean;\n\n /**\n * Specifies the content type of the video source. When set to `'auto'`, the player will try to automatically determine the content type.\n *\n * You should use this property when playing HLS, SmoothStreaming or DASH videos from an uri, which does not contain a standardized extension for the corresponding media type.\n * @default 'auto'\n * @platform android\n * @platform ios\n */\n contentType?: ContentType;\n\n /**\n * An array of external (sideloaded) subtitle files to attach to the video source.\n *\n * Use this to add subtitles to sources that don't declare their own subtitle tracks — most importantly\n * progressive `MP4` files, which (unlike `HLS`/`DASH` manifests) cannot advertise external subtitle renditions.\n * The sideloaded tracks are merged into the media and become available through\n * [`availableSubtitleTracks`](#availablesubtitletracks), so they can be selected with\n * [`subtitleTrack`](#subtitletrack) just like embedded tracks.\n *\n * > **Note (iOS):** sideloading is done by building an `AVMutableComposition`, which has platform limitations:\n * > the video must be a progressive (non-HLS) source without DRM, remote subtitle files are downloaded to a\n * > local cache first, and only `WebVTT` is natively supported (`SRT` files are converted to `WebVTT`\n * > automatically). Sideloading only runs on the asynchronous loading path (the default `VideoPlayer`\n * > constructor and [`replaceAsync`](#replaceasyncsource)), not on the synchronous `replace`.\n *\n * @platform android\n * @platform ios\n */\n subtitleTracks?: SubtitleSource[];\n};\n\n/**\n * Describes a single external (sideloaded) subtitle file that can be attached to a [`VideoSource`](#videosource).\n */\nexport type SubtitleSource = {\n /**\n * The URI of the subtitle file. Both local (`file://`) and remote (`http(s)://`) URIs are supported.\n */\n uri: string;\n\n /**\n * The BCP-47 / ISO 639 language code of the subtitle track, for example `en`, `pl`, `de`.\n * This value is used to identify and select the track and is shown in the native track selector.\n */\n language: string;\n\n /**\n * A human-readable label for the track, shown in the native subtitle selection UI.\n * When omitted, a label is derived from the `language`.\n */\n label?: string;\n\n /**\n * The format of the subtitle file.\n * When omitted, the format is inferred from the file extension (`.vtt` / `.srt`).\n *\n * - `vtt`: WebVTT subtitles (`text/vtt`).\n * - `srt`: SubRip subtitles (`application/x-subrip`). On iOS these are converted to WebVTT before sideloading.\n *\n * @default inferred from the uri extension\n */\n format?: 'vtt' | 'srt';\n\n /**\n * Whether this track should be marked as the default subtitle track.\n * @default false\n */\n default?: boolean;\n\n /**\n * How far above the bottom of the video this track renders, as a fraction of the video height (0–1).\n *\n * Useful when a video already carries burned-in (hardcoded) subtitles and the sideloaded ones would\n * otherwise be drawn on top of them.\n *\n * It sits here rather than on [`subtitleStyle`](#videoviewprops) because iOS can only apply it while\n * the subtitle is being merged into the video, which happens from the `VideoSource` alone — before any\n * `VideoView` has supplied a style. Changing it therefore takes effect the next time the source loads.\n *\n * > **Note:** cues that position themselves are left alone, so this does nothing for a WebVTT track\n * > whose cues already carry a `line:` setting.\n *\n * On **Android** use [`subtitleStyle.bottomOffset`](#subtitlestylebottomoffset) instead, which does the\n * same thing for every track at once and updates live.\n *\n * @platform ios\n */\n bottomOffset?: number;\n};\n\n/**\n * Contains information about any errors that the player encountered during the playback\n */\nexport type PlayerError = {\n message: string;\n};\n\n/**\n * Contains information that will be displayed in the now playing notification when the video is playing.\n * @platform android\n * @platform ios\n */\nexport type VideoMetadata = {\n /**\n * The title of the video.\n * @platform android\n * @platform ios\n */\n title?: string;\n /**\n * Secondary text that will be displayed under the title.\n * @platform android\n * @platform ios\n */\n artist?: string;\n /**\n * The uri of the video artwork.\n * @platform android\n * @platform ios\n */\n artwork?: string;\n};\n\n/**\n * Specifies which type of DRM to use:\n * - Android supports ClearKey, PlayReady and Widevine.\n * - iOS supports FairPlay.\n */\nexport type DRMType = 'clearkey' | 'fairplay' | 'playready' | 'widevine';\n\n/**\n * Specifies DRM options which will be used by the player while loading the video.\n */\nexport type DRMOptions = {\n /**\n * Determines which type of DRM to use.\n */\n type: DRMType;\n\n /**\n * Determines the license server URL.\n */\n licenseServer: string;\n\n /**\n * Determines headers sent to the license server on license requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Specifies whether the DRM is a multi-key DRM.\n * @platform android\n */\n multiKey?: boolean;\n\n /**\n * Specifies the content ID of the stream.\n * @platform ios\n */\n contentId?: string;\n\n /**\n * Specifies the certificate URL for the FairPlay DRM.\n * @platform ios\n */\n certificateUrl?: string;\n\n /**\n * Specifies the base64 encoded certificate data for the FairPlay DRM.\n * When this property is set, the `certificateUrl` property is ignored.\n * @platform ios\n */\n base64CertificateData?: string;\n};\n\n/**\n * Specifies buffer options which will be used by the player when buffering the video.\n *\n * @platform android\n * @platform ios\n */\nexport type BufferOptions = {\n /**\n * The duration in seconds which determines how much media the player should buffer ahead of the current playback time.\n *\n * On iOS when set to `0` the player will automatically decide appropriate buffer duration.\n *\n * Equivalent to [`AVPlayerItem.preferredForwardBufferDuration`](https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration).\n * @default Android: 20, iOS: 0\n * @platform android\n * @platform ios\n */\n readonly preferredForwardBufferDuration?: number;\n\n /**\n * A Boolean value that indicates whether the player should automatically delay playback in order to minimize stalling.\n *\n * Equivalent to [`AVPlayer.automaticallyWaitsToMinimizeStalling`](https://developer.apple.com/documentation/avfoundation/avplayer/1643482-automaticallywaitstominimizestal).\n * @default true\n * @platform ios\n */\n readonly waitsToMinimizeStalling?: boolean;\n\n /**\n * Minimum duration of the buffer in seconds required to continue playing after the player has been paused or started buffering.\n *\n * > This property will be ignored if `preferredForwardBufferDuration` is lower.\n * @default 2\n * @platform android\n */\n readonly minBufferForPlayback?: number;\n\n /**\n * The maximum number of bytes that the player can buffer from the network.\n * When 0 the player will automatically decide appropriate buffer size.\n *\n * @default 0\n * @platform android\n */\n readonly maxBufferBytes?: number | null;\n\n /**\n * A Boolean value which determines whether the player should prioritize time over size when buffering media.\n *\n * @default false\n * @platform android\n */\n readonly prioritizeTimeOverSizeThreshold?: boolean;\n};\n\n/**\n * Specifies the content type of the source.\n *\n * - `auto`: The player will automatically determine the content type of the video.\n * - `progressive`: The player will use progressive download content type. This is the default `ContentType` when the uri does not contain an extension.\n * - `hls`: The player will use HLS content type.\n * - `dash`: The player will use DASH content type (Android-only).\n * - `smoothStreaming`: The player will use SmoothStreaming content type (Android-only).\n *\n * @default `auto`\n */\nexport type ContentType = 'auto' | 'progressive' | 'hls' | 'dash' | 'smoothStreaming';\n\n/**\n * Specifies the audio mode that the player should use. Audio mode is set on per-app basis, if there are multiple players playing and\n * have different a `AudioMode` specified, the highest priority mode will be used. Priority order: 'doNotMix' > 'auto' > 'duckOthers' > 'mixWithOthers'.\n *\n * - `mixWithOthers`: The player will mix its audio output with other apps.\n * - `duckOthers`: The player will lower the volume of other apps if any of the active players is outputting audio.\n * - `auto`: The player will allow other apps to keep playing audio only when it is muted. On iOS it will always interrupt other apps when `showNowPlayingNotification` is `true` due to system requirements.\n * - `doNotMix`: The player will pause playback in other apps, even when it's muted.\n *\n * > On iOS, the Now Playing notification is dependent on the audio mode. If the audio mode is different from `doNotMix` or `auto` this feature will not work.\n */\nexport type AudioMixingMode = 'mixWithOthers' | 'duckOthers' | 'auto' | 'doNotMix';\n\nexport type SubtitleTrack = {\n /**\n * A string used by `expo-video` to identify the subtitle track.\n *\n * @platform android\n */\n id?: string;\n\n /**\n * Language of the subtitle track. For example, `en`, `pl`, `de`.\n */\n language: string;\n\n /**\n * Label of the subtitle track in the language of the device.\n */\n label: string;\n\n /**\n * Name of the subtitle track as specified in the media source.\n * @platform android\n * @platform ios\n */\n name?: string;\n\n /**\n * Indicates whether this is the default subtitle track.\n * @platform android\n * @platform ios\n */\n isDefault?: boolean;\n\n /**\n * Indicates whether this track should be auto-selected based on user preferences.\n * @platform android\n * @platform ios\n */\n autoSelect?: boolean;\n};\n\n/**\n * Specifies a VideoTrack loaded from a [`VideoSource`](#videosource).\n */\nexport type VideoTrack = {\n /**\n * The id of the video track.\n *\n * > This field is platform-specific and may return different depending on the operating system.\n */\n id: string;\n\n /**\n * The URL of the `VideoTrack` for HLS video sources. `null` for other source types.\n */\n url: string | null;\n\n /**\n * Size of the video track.\n */\n size: VideoSize;\n\n /**\n * MimeType of the video track or null if unknown.\n */\n mimeType: string | null;\n\n /**\n * Indicates whether the video track format is supported by the device.\n *\n * @platform android\n */\n isSupported: boolean;\n\n /**\n * Specifies the bitrate in bits per second. This is the peak bitrate if known, or else the average bitrate if known, or else null.\n *\n * @deprecated Use `peakBitrate` or `averageBitrate` instead.\n */\n bitrate: number | null;\n\n /**\n * Specifies the average bitrate in bits per second or null if the value is unknown.\n *\n */\n averageBitrate: number | null;\n\n /**\n * Specifies the average bitrate in bits per second or null if the value is unknown.\n */\n peakBitrate: number | null;\n\n /**\n * Specifies the frame rate of the video track in frames per second.\n */\n frameRate: number | null;\n\n /**\n * Specifies the video range of the video track.\n */\n videoRange: VideoRange;\n};\n\n/**\n * Specifies the size of a video track.\n */\nexport type VideoSize = {\n /**\n * Width of the video track in pixels.\n */\n width: number;\n /**\n * Height of the video track in pixels.\n */\n height: number;\n};\n\nexport type AudioTrack = {\n /**\n * A string used by expo-video to identify the audio track.\n * @platform android\n */\n id?: string;\n\n /**\n * Language of the audio track. For example, 'en', 'pl', 'de'.\n */\n language: string;\n\n /**\n * Label of the audio track in the language of the device.\n */\n label: string;\n\n /**\n * Name of the audio track as specified in the media source.\n * @platform android\n * @platform ios\n */\n name?: string;\n\n /**\n * Indicates whether this is the default audio track.\n * @platform android\n * @platform ios\n */\n isDefault?: boolean;\n\n /**\n * Indicates whether this track should be auto-selected based on user preferences.\n * @platform android\n * @platform ios\n */\n autoSelect?: boolean;\n};\n\n/**\n * Determines the time that the actual position seeked to may precede or exceed the requested seek position.\n * Larger tolerance will usually result in faster seeking.\n * This property affects the precision of setting the [`currentTime`](#currenttime) property and the [`seekBy`](#seekbyseconds) method, and on Android, it also affects the accuracy of the scrubber from the default native controls.\n *\n * > If you are trying to optimize for scrubbing (many frequent seeks), also see [`ScrubbingModeOptions`](#scrubbingmodeoptions-1).\n *\n * @platform android\n * @platform ios\n */\nexport type SeekTolerance = {\n /**\n * The maximum time that the actual position seeked to may precede the requested seek position, in seconds. Must be non-negative.\n * @default 0\n */\n toleranceBefore?: number;\n\n /**\n * The maximum time that the actual position seeked to may exceed the requested seek position, in seconds. Must be non-negative.\n * @default 0\n */\n toleranceAfter?: number;\n};\n\n/**\n * Defines scrubbing mode options used by a [`VideoPlayer`](#videoplayer).\n */\nexport type ScrubbingModeOptions = {\n /**\n * Whether the codec operating rate should be increased in scrubbing mode.\n *\n * You should only enable this when the player is receiving a large number of seeks in a short period of time. For less frequent seeks, fine-tuning the [`SeekTolerance`](#seektolerance-1) may be sufficient.\n *\n * On Android, the player may consume more resources in this mode, so it should only be used for short periods of time in response to user interaction (for example, dragging on a progress bar UI element).\n *\n * On Android, when `scrubbingModeEnabled` is `true`, the playback is suppressed. You should set this property back to `false` when the user interaction ends to allow the playback to resume.\n * For best results, on iOS you should pause the playback when scrubbing.\n *\n * > For best scrubbing performance, consider also increasing the seeking tolerance using the [`SeekTolerance`](#seektolerance-1) property.\n *\n * > Other scrubbing mode options will have no effect when this is `false`.\n * @default false\n * @platform android\n * @platform ios\n */\n scrubbingModeEnabled?: boolean;\n\n /**\n * Whether the codec operating rate should be increased in scrubbing mode.\n *\n * @platform android\n * @default true\n */\n increaseCodecOperatingRate?: boolean;\n\n /**\n * Sets whether ExoPlayer's dynamic scheduling should be enabled in scrubbing mode.\n * This can result in available output buffers being handled more quickly when seeking.\n *\n * @platform android\n * @default true\n */\n enableDynamicScheduling?: boolean;\n /**\n * Sets whether to use `MediaCodec.BUFFER_FLAG_DECODE_ONLY` in scrubbing mode.\n * When playback is using MediaCodec on API 34+, this flag can speed up seeking by signalling that the decoded output of buffers between the previous keyframe and the target frame is not needed by the player.\n *\n * @platform android\n * @default true\n */\n useDecodeOnlyFlag?: boolean;\n\n /**\n * Sets whether to avoid flushing the decoder (where possible) in scrubbing mode.\n * When `true`, avoids flushing the decoder when a new seek starts decoding from a key-frame in compatible content.\n *\n * @platform android\n * @default true\n */\n allowSkippingMediaCodecFlush?: boolean;\n};\n\n/**\n * Options to apply to the player builder before the native constructor is invoked\n * @platform android\n */\nexport type PlayerBuilderOptions = {\n /**\n * Seek backward increment in seconds.\n * Values will be clamped between 0.001 and 999 seconds.\n * @platform android\n */\n seekBackwardIncrement?: number;\n\n /**\n * Seek forward increment in seconds.\n * Values will be clamped between 0.001 and 999 seconds.\n * @platform android\n */\n seekForwardIncrement?: number;\n};\n\n/**\n * Specifies the dynamic range of the video content.\n * - `sdr`: Standard Dynamic Range video.\n * - `hlg`: Hybrid Log-Gamma - HDR backward-compatible with SDR displays\n * - `pq`: Perceptual Quantizer - Formats like HDR10 and Dolby Vision\n */\nexport type VideoRange = 'sdr' | 'hlg' | 'pq';\n"]}
|
|
@@ -21,6 +21,15 @@ internal struct SubtitleSource: Record {
|
|
|
21
21
|
@Field
|
|
22
22
|
var `default`: Bool = false
|
|
23
23
|
|
|
24
|
+
/// How far above the bottom of the video this track renders, as a fraction of the video height.
|
|
25
|
+
///
|
|
26
|
+
/// Applied by rewriting the WebVTT with a `line:` cue setting, because it has to be baked in when the
|
|
27
|
+
/// composition is built — see `VideoPlayerSubtitleSideload`. It lives on the source rather than on
|
|
28
|
+
/// `SubtitleStyle` for that reason: the composition is built from a `VideoSource` alone, before any
|
|
29
|
+
/// `VideoView` has handed the player a style.
|
|
30
|
+
@Field
|
|
31
|
+
var bottomOffset: Double? = nil
|
|
32
|
+
|
|
24
33
|
/// Whether the source is a SubRip (`.srt`) file, which must be converted to WebVTT before sideloading.
|
|
25
34
|
var isSrt: Bool {
|
|
26
35
|
if let format {
|
|
@@ -107,8 +107,9 @@ internal enum VideoPlayerSubtitleSideload {
|
|
|
107
107
|
return nil
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// Fast path: a local WebVTT file can be used as-is
|
|
111
|
-
|
|
110
|
+
// Fast path: a local WebVTT file can be used as-is — unless it has to be rewritten to carry a
|
|
111
|
+
// line position.
|
|
112
|
+
if uri.isFileURL && !subtitle.isSrt && subtitle.bottomOffset == nil {
|
|
112
113
|
return uri
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -123,14 +124,19 @@ internal enum VideoPlayerSubtitleSideload {
|
|
|
123
124
|
return nil
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
else {
|
|
127
|
+
// Decode only when there is something to rewrite, so an untouched WebVTT keeps its original bytes
|
|
128
|
+
// (and its original encoding) instead of being round-tripped through UTF-8.
|
|
129
|
+
if subtitle.isSrt || subtitle.bottomOffset != nil {
|
|
130
|
+
guard var text = String(data: data, encoding: .utf8) else {
|
|
131
131
|
return nil
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
if subtitle.isSrt {
|
|
134
|
+
text = SubtitleConverter.srtToVtt(text)
|
|
135
|
+
}
|
|
136
|
+
if let bottomOffset = subtitle.bottomOffset {
|
|
137
|
+
text = SubtitleConverter.applyLinePosition(text, bottomOffset: bottomOffset)
|
|
138
|
+
}
|
|
139
|
+
data = Data(text.utf8)
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
return writeTempVtt(data: data, source: subtitle)
|
|
@@ -160,7 +166,11 @@ internal enum VideoPlayerSubtitleSideload {
|
|
|
160
166
|
|
|
161
167
|
// Derive a process-stable filename (SHA-256) so identical subtitles always resolve to the same file.
|
|
162
168
|
// Swift's `Data.hashValue` is randomly seeded per launch, which would leak a new temp file every run.
|
|
163
|
-
|
|
169
|
+
//
|
|
170
|
+
// `bottomOffset` is part of the identity because it changes the bytes written: without it, the
|
|
171
|
+
// reuse check below would hand back a rendition positioned for a previous offset.
|
|
172
|
+
let offsetKey = source.bottomOffset.map { String(format: "%.4f", $0) } ?? ""
|
|
173
|
+
let identifier = "\(source.uri?.absoluteString ?? "")-\(source.language ?? "")-\(offsetKey)"
|
|
164
174
|
let digest = SHA256.hash(data: Data(identifier.utf8))
|
|
165
175
|
let hashString = digest.compactMap { String(format: "%02x", $0) }.joined()
|
|
166
176
|
let fileURL = directory.appendingPathComponent("\(hashString).vtt")
|
|
@@ -183,6 +193,11 @@ internal enum VideoPlayerSubtitleSideload {
|
|
|
183
193
|
|
|
184
194
|
/// Minimal SubRip (`.srt`) → WebVTT (`.vtt`) converter. AVFoundation only reads WebVTT as a `.text` track.
|
|
185
195
|
internal enum SubtitleConverter {
|
|
196
|
+
/// A WebVTT cue timing line, anchored at the start: `[HH:]MM:SS.mmm --> [HH:]MM:SS.mmm`, optionally
|
|
197
|
+
/// followed by cue settings. Hours are optional per the WebVTT grammar.
|
|
198
|
+
private static let cueTimingPattern =
|
|
199
|
+
#"^[ \t]*(?:\d{2,}:)?[0-5]\d:[0-5]\d\.\d{3}[ \t]+-->[ \t]+(?:\d{2,}:)?[0-5]\d:[0-5]\d\.\d{3}"#
|
|
200
|
+
|
|
186
201
|
static func srtToVtt(_ srt: String) -> String {
|
|
187
202
|
let normalized = srt
|
|
188
203
|
.replacingOccurrences(of: "\r\n", with: "\n")
|
|
@@ -200,4 +215,43 @@ internal enum SubtitleConverter {
|
|
|
200
215
|
}
|
|
201
216
|
return "WEBVTT\n\n" + converted
|
|
202
217
|
}
|
|
218
|
+
|
|
219
|
+
/// Adds a WebVTT `line:` cue setting to every cue that does not already position itself.
|
|
220
|
+
///
|
|
221
|
+
/// This is how a subtitle is moved clear of burned-in captions on iOS. AVFoundation renders legible
|
|
222
|
+
/// tracks itself and `AVPlayerItem.textStyleRules` carries no positioning, so the position has to
|
|
223
|
+
/// travel inside the WebVTT — which is also why it is fixed when the composition is built.
|
|
224
|
+
///
|
|
225
|
+
/// - Parameter bottomOffset: fraction of the video height to sit above the bottom, matching the
|
|
226
|
+
/// Android `subtitleStyle.bottomOffset`. WebVTT counts `line` down from the top, so it is inverted.
|
|
227
|
+
///
|
|
228
|
+
/// Note the anchor differs from Android: a bare `line:` percentage positions the *top* of the cue
|
|
229
|
+
/// box, so a cue that wraps onto two lines extends downward from there, where Android holds the
|
|
230
|
+
/// bottom edge fixed. `line-align` would express it exactly, but it is a newer part of the syntax and
|
|
231
|
+
/// a parser that rejects it would drop the whole setting, so the widely-understood form is used.
|
|
232
|
+
static func applyLinePosition(_ vtt: String, bottomOffset: Double) -> String {
|
|
233
|
+
let clamped = min(max(bottomOffset, 0), 1)
|
|
234
|
+
let linePercentage = Int(((1 - clamped) * 100).rounded())
|
|
235
|
+
|
|
236
|
+
let normalized = vtt
|
|
237
|
+
.replacingOccurrences(of: "\r\n", with: "\n")
|
|
238
|
+
.replacingOccurrences(of: "\r", with: "\n")
|
|
239
|
+
|
|
240
|
+
let positioned = normalized.components(separatedBy: "\n").map { line -> String in
|
|
241
|
+
// Only cue timing lines carry cue settings. Matched against the timestamp syntax rather than by
|
|
242
|
+
// looking for the arrow, because subtitle *text* is free to contain "-->" — dialogue and lyrics
|
|
243
|
+
// do — and appending a cue setting to it would print the setting on screen.
|
|
244
|
+
guard line.range(of: Self.cueTimingPattern, options: .regularExpression) != nil else {
|
|
245
|
+
return line
|
|
246
|
+
}
|
|
247
|
+
// A cue that already positions itself was written that way deliberately — left alone, matching
|
|
248
|
+
// how the Android side passes explicitly positioned cues through untouched.
|
|
249
|
+
guard !line.contains("line:") else {
|
|
250
|
+
return line
|
|
251
|
+
}
|
|
252
|
+
return "\(line) line:\(linePercentage)%"
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return positioned.joined(separator: "\n")
|
|
256
|
+
}
|
|
203
257
|
}
|
package/package.json
CHANGED
package/src/VideoPlayer.types.ts
CHANGED
|
@@ -459,6 +459,26 @@ export type SubtitleSource = {
|
|
|
459
459
|
* @default false
|
|
460
460
|
*/
|
|
461
461
|
default?: boolean;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* How far above the bottom of the video this track renders, as a fraction of the video height (0–1).
|
|
465
|
+
*
|
|
466
|
+
* Useful when a video already carries burned-in (hardcoded) subtitles and the sideloaded ones would
|
|
467
|
+
* otherwise be drawn on top of them.
|
|
468
|
+
*
|
|
469
|
+
* It sits here rather than on [`subtitleStyle`](#videoviewprops) because iOS can only apply it while
|
|
470
|
+
* the subtitle is being merged into the video, which happens from the `VideoSource` alone — before any
|
|
471
|
+
* `VideoView` has supplied a style. Changing it therefore takes effect the next time the source loads.
|
|
472
|
+
*
|
|
473
|
+
* > **Note:** cues that position themselves are left alone, so this does nothing for a WebVTT track
|
|
474
|
+
* > whose cues already carry a `line:` setting.
|
|
475
|
+
*
|
|
476
|
+
* On **Android** use [`subtitleStyle.bottomOffset`](#subtitlestylebottomoffset) instead, which does the
|
|
477
|
+
* same thing for every track at once and updates live.
|
|
478
|
+
*
|
|
479
|
+
* @platform ios
|
|
480
|
+
*/
|
|
481
|
+
bottomOffset?: number;
|
|
462
482
|
};
|
|
463
483
|
|
|
464
484
|
/**
|