0

有没有办法在运行时使用(启用/禁用)正在运行的视频的字幕?我实际上正在使用这个包:https ://github.com/abbasfreestyle/react-native-af-video-player并没有直接显示如何使用它们,而是转到 react-native-video 组件。(在 af 视频播放器内部)所以我尝试使用 textTracks 和 selectedTextTrack 属性使其工作并尝试修改一般状态并在以下之间切换:

selectedTextTrack={{
  type: "title",
  value: "English Subtitles"
}}

selectedTextTrack={{
      type: "disabled",
      value: "English Subtitles"
}}

这正是文档和说明它要做的问题的方式:https ://github.com/react-native-community/react-native-video/issues/1044字幕正在工作,但如何禁用他们,有谁知道如何正确地做到这一点?

4

1 回答 1

0

测试一下。可能工作

constructor(props) {
    super(props);
    this.state = {
       ...
        type:'title'

    };
}


...
render(){
   return(
      <Video
           ...
           selectedTextTrack={{
               type: this.state.type,
               value: "English Subtitles"
           }}
      />
  )

}


onuttonClick = () =>{
   this.setState({type:'disable});
}
于 2018-12-26T05:04:50.080 回答