react-native-video组件字幕无法正常显示的问题求助
react-native-video组件字幕无法正常显示的问题求助
大家好,我最近在React Native项目里用react-native-video包开发视频播放功能,想要给视频加上字幕/副标题,但遇到了棘手的问题——不管怎么配置,字幕就是没办法显示在视频上。
我已经尝试用textTracks和selectedTextTrack这两个属性来配置字幕,具体代码如下:
import Video, { TextTrackType } from "react-native-video"; <Video source={{ uri: "https://example.com/video.mp4" }} style={{ width: "100%", height: 250 }} controls textTracks={[ { title: "English CC", language: "en", type: TextTrackType.VTT, uri: "https://example.com/subtitles.vtt", }, ]} selectedTextTrack={{ type: "system", // 也试过用'title'和'language' value: "English CC", }} />
我已经试过调整selectedTextTrack的type值,先后用了system、title和language,对应的value也做了匹配调整(比如用language的时候填了en),但字幕还是没显示出来。有没有朋友遇到过类似的问题,或者能给我一些排查的方向呀?
内容来源于stack exchange
相关产品推荐
相关产品推荐

