<Video ref='videoPlayer' //设置组件类型,类似于input的type source={{uri:data.content}} //视频地址 style={styles.video} //视频样式 volume={1} paused={false} rate={this.state.rate} muted={this.state.muted} resizeMode={this.state.resizeMode} repeat={this.state.repeat} onProgress={this._onProgress} onEnd={this._onEnd} />
其他参数可以正常使用,唯独回调函数不能使用。貌似在RN 0.38版本中出现问题。
网上解决方法很多,其中一个方法就是升级RN到0.39 react-native-video升级到最新。
但是本人使用的RN版本不幸的是0.38的,还有另一个方法就能轻松解决:
react-native unlink react-native-video react-native link react-native-video
本人使用的版本是
RN 0.38
react-native-video@0.9.0
如果还不能解决就参考下:
http://coding.imooc.com/learn/questiondetail/4004.html