react-native-zoom-sdk v0.19.1
react-native-zoom-sdk
Getting started
Before you start, you should add Zoom SDK by downloading iOS and Android SDK to your project
place iOS SDK in ios/lib/ directory of your project.
Or add this line to your Podfile
pod 'ZoomMobileRTC'
After that install the package with:
$ npm install react-native-zoom-sdk --save
Mostly automatic installation
Run the link command. It will execute other SDK config to your app.
$ react-native link react-native-zoom-sdk
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-zoom-sdkand addRNMobileRTC.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNMobileRTC.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactor.RNMobileRTCPackage;to the imports at the top of the file - Add
new RNMobileRtcPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-zoom-sdk' project(':react-native-zoom-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-zoom-sdk/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-zoom-sdk')
Methods
initialize Initializes the SDK with SDK authorization. Returns a promise as a result.
Catch and handle errors with codes from RNMobileRTC.AuthError object.
Signature:
RNMobileRTC.initialize(sdkKey, sdkSecret, 'zoom.us')startMeeting Starts the new meeting. Returns a promise that represents a result of starting
the meeting. Catch and handle error types from RNMobileRTC.MeetingError object
Signature:
RNMobileRTC.startMeeting({
meetingNumber: '0123456789',
userName: 'Nana',
userType: UserType.ZOOM_USER,
})joinMeeting Joins the user to the meeting. Returns a promise that represents a result of joining
to the meeting. Catch and handle error types from RNMobileRTC.MeetingError object
Signature:
RNMobileRTC.joinMeeting({ meetingNumber: '0123456789', userName: 'Nana', })Constants
User types
const { UserType } = RNMobileRTC;
UserType.API_USER // API user type
UserType.ZOOM_USER // Work email user type
UserType.SSO_USER // Single-sign-on user typeAuth error
Usage
import RNMobileRTC from 'react-native-zoom-sdk';
export default class App extends Component<{}> {
constructor() {
super();
...
RNMobileRTC.initialize(key, secret, domain)
.then((result) => alert(result))
.catch((error) => { throw new Error(error.message) });
}
handleJoinTheMeeting() {
// Join the meeting
RNMobileRTC.joinMeeting({
meetingNumber: '0123456789',
userName: 'Nana',
// pwd: 'my password',
// participantId: '111',
}).then((result) => alert(result))
.catch((error) => {
if (error.code === RNMobileRTC.MeetingError.MEETING_NOT_EXIST) {
console.error('Meeting does not exist!');
}
});
}
render() {
return (
<View style={styles.container}>
<TouchableOpacity onPress={this.handleJoinTheMeeting}>
<Text style={styles.welcome}>
Join the meeting!
</Text>
</TouchableOpacity>
</View>
);
}
}