$ npm install react-native-alpha-video --save
$ react-native link react-native-alpha-video
AlphaVideoView用来渲染动画,扩展UIView
AlphaVideoModule.getAssets(require('./wwww.mp4'))
AlphaVideoModule.advanceDownload(list)
URL,或是本地 NSBundle.mainBundle / assets 文件--- string类型
是否循环播放,默认不循环--- bool类型
是否静音,默认不静音--- bool类型
视频播放完成后,回调
play:() => voidpause:() => voidstop:() => voidclear:() => voidadvanceDownload(urls: Array<String>): voidimport AlphaVideo from 'react-native-alpha-video';
// TODO: What to do with the module?
AlphaVideo;iOS使用需要在项目中创建一个metal文件filter.metal文件内容
#include <metal_stdlib>
using namespace metal;
#include <CoreImage/CoreImage.h>
extern "C" { namespace coreimage {
float4 maskVideoMetal(sample_t s,sample_t m){
return float4(s.rgb,m.r);
}
}
}
