react-native-video onLoad onProgress不工作的IOS

时间:2017-11-23 10:41:09

标签: ios react-native react-native-ios

我已经使用react-native视频播放音频文件,它在android上工作正常,但在ios上它无法触发onLoad和onProgress函数,我用它来获取持续时间和进度。以下是我的代码。

<Video source={{ uri: songPlaying.url }}
          ref="audio"
          volume={this.state.muted ? 0 : 1.0}
          muted={false}
          paused={!this.state.playing}
          onLoad={this.onLoad.bind(this)}                                                   
          onProgress={this.setTime.bind(this)}
          onEnd={this.onEnd.bind(this)}
          resizeMode="cover"
          repeat={false} />    

 onLoad(params) {
    this.setState({ songDuration: params.duration });
  }

//called in onProgress to set time.

 setTime(params) {
    if (!this.state.sliding) {
      this.setState({ currentTime: params.currentTime });
    }
  }

0 个答案:

没有答案
相关问题