Merge pull request #1119 from react-native-community/chore/document-ios-caption

Document iOS sidecar text tracks
This commit is contained in:
Hampton Maxwell 2018-07-11 09:31:59 -07:00 committed by GitHub
commit 5178601edb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,8 @@
## Changelog ## Changelog
### Next Version
* Support sidecar text tracks on iOS [#1109](https://github.com/react-native-community/react-native-video/pull/1109)
### Version 3.0 ### Version 3.0
* Inherit Android buildtools and SDK version from the root project [#1081](https://github.com/react-native-community/react-native-video/pull/1081) * Inherit Android buildtools and SDK version from the root project [#1081](https://github.com/react-native-community/react-native-video/pull/1081)
* Automatically play on ExoPlayer when the paused prop is not set [#1083](https://github.com/react-native-community/react-native-video/pull/1083) * Automatically play on ExoPlayer when the paused prop is not set [#1083](https://github.com/react-native-community/react-native-video/pull/1083)

View File

@ -402,9 +402,11 @@ Property | Description
--- | --- --- | ---
title | Descriptive name for the track title | Descriptive name for the track
language | 2 letter [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) representing the language language | 2 letter [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) representing the language
type | Mime type of the track<br> * TextTrackType.SRT - .srt SubRip Subtitle<br> * TextTrackType.TTML - .ttml TTML<br> * TextTrackType.VTT - .vtt WebVTT type | Mime type of the track<br> * TextTrackType.SRT - SubRip (.srt)<br> * TextTrackType.TTML - TTML (.ttml)<br> * TextTrackType.VTT - WebVTT (.vtt)<br>iOS only supports VTT, Android ExoPlayer supports all 3
uri | URL for the text track. Currently, only tracks hosted on a webserver are supported uri | URL for the text track. Currently, only tracks hosted on a webserver are supported
On iOS, sidecar text tracks are only supported for individual files, not HLS playlists. For HLS, you should include the text tracks as part of the playlist.
Example: Example:
``` ```
import { TextTrackType }, Video from 'react-native-video'; import { TextTrackType }, Video from 'react-native-video';
@ -413,21 +415,20 @@ textTracks={[
{ {
title: "English CC", title: "English CC",
language: "en", language: "en",
type: "text/vtt", TextTrackType.VTT, type: TextTrackType.VTT, // "text/vtt"
uri: "https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt" uri: "https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt"
}, },
{ {
title: "Spanish Subtitles", title: "Spanish Subtitles",
language: "es", language: "es",
type: "application/x-subrip", TextTrackType.SRT, type: TextTrackType.SRT, // "application/x-subrip"
uri: "https://durian.blender.org/wp-content/content/subtitles/sintel_es.srt" uri: "https://durian.blender.org/wp-content/content/subtitles/sintel_es.srt"
} }
]} ]}
``` ```
This isn't support on iOS because AVPlayer doesn't support it. Text tracks must be loaded as part of an HLS playlist.
Platforms: Android ExoPlayer Platforms: Android ExoPlayer, iOS
#### useTextureView #### useTextureView
Output to a TextureView instead of the default SurfaceView. In general, you will want to use SurfaceView because it is more efficient and provides better performance. However, SurfaceViews has two limitations: Output to a TextureView instead of the default SurfaceView. In general, you will want to use SurfaceView because it is more efficient and provides better performance. However, SurfaceViews has two limitations: