# react-native-pili **Repository Path**: duiduiche-frontend/react-native-pili ## Basic Information - **Project Name**: react-native-pili - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-06-14 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #Pili Streaming Cloud React Native SDK ##Introduction ###Warning This lib dependency PLMediaStreamingKit (2.1.1) and PLPlayerKit (2.2.4) , the latest native sdk break origin API, i will match the latest version be free.. 这*可能*是**第一个**在 React Native 上实现全功能的直播 SDK 了,底层基于 [Pili-SDK](https://github.com/pili-engineering),把 iOS 和 Android 的 API 尽量统一。 2.0 版本为了更容易集成第三方 SDK ,对原有的 React Native 项目进行了改造,iOS 的依赖采用了 Cocoapod 进行管理,当然你也可以采用原来的方式,毕竟是可以共存的。具体可以参考 [AirApps](https://github.com/airapps/airapps) 可以查看如何进行集成。项目的简单的例子是 [react-native-pili](https://github.com/airapps/react-native-living) ##Installation ```bash git clone https://github.com/buhe/pili-startkit YourPorjectName cd YourPorjectName/js && npm install cd ../ios && pod install ``` ###Javascript ```bash cd YourPorjectName/js npm start ``` ###iOS 1. Open ios/YourPorjectName.xcworkspace (这里请注意是打开 .xcworkspace!请确认) 2. Just run your project (Cmd+R) 3. 如果是 iOS 10 需要在 info 中额外添加如下权限: ``` NSCameraUsageDescription cameraDesciption NSContactsUsageDescription contactsDesciption NSMicrophoneUsageDescription microphoneDesciption ``` ref: [iOS 10](http://www.jianshu.com/p/c212cde86877) ###Android 1. Open android use Android Studio 2. Just run your project ##TODO - [x] Android Player - [x] Android Streaming - [x] iOS Player - [x] iOS Streaming - [ ] 美颜和水印支持 ##Usage ###1. 推流 ```javascript {}} //onReady event onConnecting={()=>{}} //onConnecting event onStreaming={()=>{}} //onStreaming event onShutdown={()=>{}} //onShutdown event onIOError={()=>{}} //onIOError event onDisconnected={()=>{}} //onDisconnected event /> ``` ###2. 直播播放 ```javascript {}} //loading from remote or local onPaused={()=>{}} //pause event onShutdown={()=>{}} //stopped event onError={()=>{}} //error event onPlaying={()=>{}} //play event /> ``` ##Release Note ##2.1.1 - [x] Android Player - [x] Android Streaming - [x] iOS Player - [x] iOS Streaming