如何使用React Native Video显示外部字幕?

时间:2018-07-30 10:20:06

标签: javascript reactjs react-native

我有一个视频文件,并且还有srtvtt个文件。如何使用react-native-video显示字幕?

1 个答案:

答案 0 :(得分:1)

这是来自 react-native-video documentation

的一个例子
import { TextTrackType }, Video from 'react-native-video';

textTracks={[
  {
    title: "English CC",
    language: "en",
    type: TextTrackType.VTT, // "text/vtt"
    uri: "https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt"
  },
  {
    title: "Spanish Subtitles",
    language: "es",
    type: TextTrackType.SRT, // "application/x-subrip"
    uri: "https://durian.blender.org/wp-content/content/subtitles/sintel_es.srt"
  }
]}