我想播放来自url
的视频并支持字幕。
是否有任何支持react native
视频中字幕的组件?
答案 0 :(得分:1)
有一个PR/discussion to add subtitle support反应原生视频组件。我认为如果/一旦合并,它应该是官方的方式。我会在这里展示一个例子,但最终的API尚未确定。
react-native-video-controls还有一个分叉,可以使用JavaScript在视频顶部显示字幕,您可以试试。
答案 1 :(得分:-1)
Please check this package awesome-react-native-video-controls
npm i react-native-video-wcag
Import it and add following code snippet
import VideoPlayer from 'awesome-react-native-video-controls';
// in the component's render() function
<VideoPlayer
source={{ uri: 'include url here' }}
subtitle={subtitle}
/>
subtitle is Json like
[{
"startTime": "00:00:04,123", //hh:mm:ss,SSS
"endTime": "00:00:05,001",
"text": "Add content here"
}]
This solution is what I used and it worked for me:)
Reference document
https://www.npmjs.com/package/react-native-video-wcag