网站链接:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/learn-react-native-video/

React Native项目中插入视频播放的简单教程(iOS)。

在你的项目中执行以下步骤:

1.运行npm install react-native-video --save

2.iOS下:

(1)在Xcode中打开你的项目,在名字为Libraries上点右键,然后点击Add Files to "Your Project Name";

 

(2)添加libRTCVideo.a到 Build Phases -> Link Binary With Libraries 

(3)添加 项目中的.mp4 格式的视频文件到 Build Phases -> Copy Bundle Resources

(4)在你的项目中使用以下命令就可以得到你想引用的视频:

调用视频用法:

// Within your render function, assuming you have a file called
// "background.mp4" in your project. You can include multiple videos
// on a single screen if you like.
<Video source={{uri: "background"}} // Can be a URL or a local file.
rate={1.0} // 0 is paused, 1 is normal.
volume={1.0} // 0 is muted, 1 is normal.
muted={false} // Mutes the audio entirely.
paused={false} // Pauses playback entirely.
resizeMode="contain" // Fill the whole screen at aspect ratio.
repeat={true} // Repeat forever.
onLoadStart={this.loadStart} // Callback when video starts to load
onLoad={this.setDuration} // Callback when video loads
onProgress={this.setTime} // Callback every ~250ms with currentTime
onEnd={this.onEnd} // Callback when playback finishes
onError={this.videoError} // Callback when video cannot be loaded
style={styles.backgroundVideo} /> // Later on in your styles..
var styles = Stylesheet.create({
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});

最新文章

  1. FineReport如何部署Tomcat服务器集群
  2. [资料分享]7天搞定Node.js微信公众号开发
  3. JAVA 技术手册 卷1 第十四章『多线程』 读书摘要
  4. 获取View到顶部的高度
  5. jquery获取、改变元素属性值
  6. SQL学习记录
  7. Anchor和Dock的区别
  8. react-native之站在巨人的肩膀上
  9. [Leetcode][Python]51: N-Queens
  10. MSSQL - Sqlcommand
  11. spring mvc +cookie+拦截器功能 实现系统自动登陆
  12. 如何结合场景利用block进行回调
  13. golang sql database drivers
  14. hive group by聚合函数增强
  15. docker+fastdfs+nginx 实现分布式大文件存储系统以及视频缓存播放
  16. [Android] Android 让UI控件固定于底部的几种方法
  17. python unittest套件,修改为失败重新执行
  18. bootstrap 模态框事件
  19. Java SE 枚举的基本用法
  20. 在dosbox窗口显示a~z

热门文章

  1. sql GROUP BY 分组统计
  2. IE6常见bug整理
  3. EasyUI ComboBox默认值
  4. iOS开发-UIColor转UIIamge方法
  5. 理解Web标准(网站标准)
  6. USB Device Finder
  7. \r,\n,\t
  8. jquery动态创建form并提交到.ashx文件处理
  9. C# 仿制QQ弹出新闻消息框
  10. 模拟log4j获取日志对象调用所在的类名、方法名及行号