#Pili Streaming Cloud React Native SDK
##Installation
Run npm install react-native-pili --save
###iOS
- In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
- Go to node_modules ➜ react-native-pili ➜ RCTPili and add RCTPili.xcodeproj
- In XCode, in the project navigator, select your project. Add libPTCPili.a ,libz.tbd,libc++.tbd to your project's Build Phases ➜ Link Binary With Libraries
- Run your project (Cmd+R)
###Android
android/settings.gradle
include ':react-native-pili'
project(':react-native-pili').projectDir = new File(settingsDir, '../node_modules/react-native-pili/android')
android/app/build.gradle
dependencies {
...
compile project(':react-native-pili')
}
MainActivity.java
On top, where imports are:
import com.pili.rnpili.PiliPackage;
Modify getPackages method
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new PiliPackage(this)
);
}
##TODO
##Usage
###1. 推流
<Streaming
stream={{
id:"xxx",
title:"title",
hub:"hubname",
publishKey:"<PK>",
publishSecurity:"static",
hosts:{
publish:{
rtmp:"pili-publish.pilitest.qiniucdn.com"
}
}
}}
style={{
height:400,
width:400,
}}
zoom={1}
muted={true}
focus={false}
profile={{
video:{
fps:30,
bps:1000 * 1024,
maxFrameInterval:48
},
audio:{
rate:44100,
bitrate:96 * 1024
},
started={false}
onReady={()=>{}}
onConnecting={()=>{}}
onStreaming={()=>{}}
onShutdown={()=>{}}
onIOError={()=>{}}
onDisconnected={()=>{}}
/>
###2. 直播播放
<Player
source={{
uri:"rtmp://pili-live-rtmp.pilitest.qiniucdn.com/pilitest/xxx",
controller: true,
timeout: 10 * 1000,
live:true,
hardCodec:false,
}}
started={true}
muted={false}
style={{
height:200,
width:200,
}}
onLoading={()=>{}}
onPaused={()=>{}}
onShutdown={()=>{}}
onError={()=>{}}
onPlaying={()=>{}}
/>
##Release Note
##0.1.0