Skip to content

reactor-studio/react-native-zoom-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-zoom-sdk and add RNMobileRTC.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMobileRTC.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. 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 type

Auth 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>
    );
  }
}	

About

React Native wrapper for Zoom.us

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published