react-native-nodemediaclient
Advanced tools
Comparing version 0.2.21 to 0.3.0
{ | ||
"name": "react-native-nodemediaclient", | ||
"version": "0.2.21", | ||
"version": "0.3.0", | ||
"description": "This project is the react-native packaging of NodeMediaClient-Android and NodeMediaClient-iOS SDK.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"main": "src/index", | ||
"author": "Chen Mingliang", | ||
"license": "" | ||
"license": "", | ||
"homepage": "https://github.com/NodeMedia/react-native-nodemediaclient" | ||
} |
@@ -5,5 +5,6 @@ # react-native-nodemediaclient | ||
This project is the react-native packaging of NodeMediaClient-Android and NodeMediaClient-iOS SDK. | ||
Complete live publish and play functions, providing the exact same API call. You can publish two platforms just by developing one set of programs. | ||
[中文介绍](https://github.com/NodeMedia/react-native-nodemediaclient/blob/master/README_CN.md) | ||
## 0.Enter the project directory | ||
@@ -15,11 +16,7 @@ cd AwesomeProject | ||
## 2.Link | ||
~~react-native link react-native-nodemediaclient~~ | ||
>No longer needed after react native 0.60 | ||
## 3.Install dependencies | ||
## 2.Install dependencies | ||
cd ios | ||
pod install | ||
## 4.NodeCameraView Permission | ||
## 3.Permission | ||
@@ -46,85 +43,4 @@ ### Android | ||
<string>AwesomeProject requires access to your phone’s Microphone.</string> | ||
```` | ||
## 5.Example | ||
### NodePlayerView | ||
``` | ||
import { NodePlayerView } from 'react-native-nodemediaclient'; | ||
...... | ||
<NodePlayerView | ||
style={{ height: 200 }} | ||
ref={(vp) => { this.vp = vp }} | ||
inputUrl={"rtmp://192.168.0.10/live/stream"} | ||
scaleMode={"ScaleAspectFit"} | ||
bufferTime={300} | ||
maxBufferTime={1000} | ||
autoplay={true} | ||
/> | ||
``` | ||
### NodeCameraView | ||
``` | ||
import { NodeCameraView } from 'react-native-nodemediaclient'; | ||
const requestCameraPermission = async () => { | ||
try { | ||
const granted = await PermissionsAndroid.requestMultiple([PermissionsAndroid.PERMISSIONS.CAMERA,PermissionsAndroid.PERMISSIONS.RECORD_AUDIO], | ||
{ | ||
title: "Cool Photo App Camera And Microphone Permission", | ||
message: | ||
"Cool Photo App needs access to your camera " + | ||
"so you can take awesome pictures.", | ||
buttonNeutral: "Ask Me Later", | ||
buttonNegative: "Cancel", | ||
buttonPositive: "OK" | ||
} | ||
); | ||
if (granted === PermissionsAndroid.RESULTS.GRANTED) { | ||
console.log("You can use the camera"); | ||
} else { | ||
console.log("Camera permission denied"); | ||
} | ||
} catch (err) { | ||
console.warn(err); | ||
} | ||
}; | ||
...... | ||
<NodeCameraView | ||
style={{ height: 400 }} | ||
ref={(vb) => { this.vb = vb }} | ||
outputUrl = {"rtmp://192.168.0.10/live/stream"} | ||
camera={{ cameraId: 1, cameraFrontMirror: true }} | ||
audio={{ bitrate: 32000, profile: 1, samplerate: 44100 }} | ||
video={{ preset: 12, bitrate: 400000, profile: 1, fps: 15, videoFrontMirror: false }} | ||
autopreview={true} | ||
/> | ||
<Button title="request permissions" onPress={requestCameraPermission} /> | ||
<Button | ||
onPress={() => { | ||
if (this.state.isPublish) { | ||
this.setState({ publishBtnTitle: 'Start Publish', isPublish: false }); | ||
this.vb.stop(); | ||
} else { | ||
this.setState({ publishBtnTitle: 'Stop Publish', isPublish: true }); | ||
this.vb.start(); | ||
} | ||
}} | ||
title={this.state.publishBtnTitle} | ||
color="#841584" | ||
/> | ||
``` | ||
>I don't know which version of react native updated compileSdkVersion to 28 instead of 23, Camera and microphone permissions need to be manually requested. Look at the document at https://reactnative.dev/docs/permissionsandroid , If don't have permission to apply first, you will only see a white screen. | ||
>In this demo you might have to boot it twice. | ||
In the official version, you can apply permission on the home page first, and then jump to the live page after you have permission. | ||
## Note for android | ||
@@ -135,5 +51,1 @@ If you have enabled progaurd in release don't forget to add this to `proguard-rules.pro` file: | ||
``` | ||
## Demo project | ||
![img](https://raw.githubusercontent.com/NodeMedia/iShow-RN/master/1519740855033.gif) | ||
https://github.com/NodeMedia/iShow-RN |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
2
39007
24
158
48
1