react-native-viode

react-native录音组件

github地址:react-natitve-video

版本

版本4.x  对应的是react-native 0.57.0以上的版本
版本3.x  对应的是react-naitve 0.40.0以上的版本

安装 react-native-video

使用npm : 
<pre>
  npm install --save react-native-video
</pre>
或者使用yarn:
<pre>
  yarn add react-native-video
</pre>
根据需求在你的项目中引用react-native-video

--iOS--

1:ios可以在项目中执行 react-native link react-native-video �来导入react-natie-viode依赖
2:通过使用CocoaPods的方式,在你项目的Podfile文件中添加
   <pre>
      pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 
   </pre>
   <pre>
      pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
   </pre>

--Android--

1:android可以通过执行 react-native link react-native-video 来导入react-native-video依赖
2:配置android/setting.gradle文件
   <pre>
     include ':react-native-video'
   </pre>
   <pre>
     project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
   </pre>
3:android/app/build.gradle中新增
   <pre>
     dependencies {
     ...
     compile project(':react-native-video')
     }
   </pre>
4:MainApplication.java中新增
    import com.brentvatne.react.ReactVideoPackage;

  在List中添加ReactVideoPackage类
  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.asList(
            new MainReactPackage(),
            new ReactVideoPackage()
    );
  }

具体RN使用示例

// Load the module
import Video from 'react-native-video'  
// ***************************
<Video
    source={require('../src/img/moments.mp4')}   //设置本地视频地址   
    // source={{uri:'https:***.***'}}            //设置在线视频地址
    ref={(ref)=>{
        this.player = ref
    }}
    onBuffer={this.onBuffer}                     //视频缓冲回调
    onEnd = {this.onEnd}                         //播放结束后的回调
    onError = {this.onError}                     //播放失败后的回调
    style = {styles.backgroundVideo}             //样式设置
    /> 
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 持续更新中...... 一套企业级的 UI 设计语言和 React 实现。 https://mobile.ant....
    日不落000阅读 6,195评论 0赞 35
  • 在现代社会中,要想取得成功,最需要什么,最需要的就是合作精神。所谓合作就是个人与个人、群体与群体之间为达到共同目的...
    舟⼀阅读 373评论 0赞 2
  • 周末,伴随着轻柔的音乐,回顾这一周的教学,有欢乐,有愤怒,有担忧,有成长。教学与生活息息相关,无论是数语外还是音体...
    雪Cynthia阅读 525评论 0赞 5
  • “世间的一切,都是遇见。就像冷遇见暖,就有了雨;春遇见冬,就有了岁月;天遇见地,就有了永恒;人遇见人,就有了生命。...
    子木怜月阅读 295评论 0赞 6
  • 我所理解的“挺好的” 记得有一个丰胸广告词:做女人,挺好的。 每天都能够见到你,挺好的; 尝试吃了新的食物,挺好的...
    小脸猫阅读 1,457评论 0赞 1

友情链接更多精彩内容