【问题标题】:How to show and Hide Subtitles in React Native Video如何在 React Native 视频中显示和隐藏字幕
【发布时间】:2018-12-19 19:05:47
【问题描述】:

有没有办法在运行时使用(启用/禁用)正在运行的视频的字幕?我实际上正在使用这个包: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 字幕正在工作,但是如何禁用它们,有人知道如何正确操作吗?

【问题讨论】:

    标签: react-native react-native-video


    【解决方案1】:

    测试一下。可能工作了

    constructor(props) {
        super(props);
        this.state = {
           ...
            type:'title'
    
        };
    }
    
    
    ...
    render(){
       return(
          <Video
               ...
               selectedTextTrack={{
                   type: this.state.type,
                   value: "English Subtitles"
               }}
          />
      )
    
    }
    
    
    onuttonClick = () =>{
       this.setState({type:'disable});
    }
    

    【讨论】:

      猜你喜欢
      • 2019-06-20
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 2017-04-20
      • 2019-11-24
      • 2021-08-07
      相关资源
      最近更新 更多