# Android | Zoom Video SDK + Twilio migration This guide walks you through how to migrate your existing project from the Twilio Video SDK to the [Zoom Video SDK](https://www.zoom.com/en/video-sdk/). If you're starting a new project from scratch, see the [Video SDK for Android documentation](/docs/video-sdk/android/) as it contains more details about the usage and features of the Video SDK. ## Create a developer account Create a Video SDK developer account to access your credentials. [Choose a plan](https://zoom.us/pricing/developer) to get started. ### Install the SDK Download and install the Video SDK [from the Zoom Developer Portal](https://marketplace.zoom.us/) or through the [Maven Central repository](https://search.maven.org/artifact/us.zoom.videosdk/ZoomVideoSDK/1.5.3/aar). For example, if you're building using Gradle or Groovy, add this line to your app/build.gradle file: ```groovy implementation 'us.zoom.videosdk:ZoomVideoSDK:' ``` Replace `` with the version of the SDK, such as `1.5.3`. ## Authorize Both Zoom and Twilio use JSON Web Tokens (JWT) to authorize the use of the SDK and to generate a token for users to join. On your auth server, replace your [Twilio Video JWT](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) generation logic with the [Zoom Video SDK JWT](/docs/video-sdk/auth/) generation logic. ## Set up your project We suggest that you add the Zoom Video SDK to your project through Maven. MavenCentral hosts the Video SDK for Android. Use the following code to add it (replace `` with your desired version): ```groovy implementation 'us.zoom.videosdk:ZoomVideoSDK:' ``` ### Remove Twilio SDK If you like, you can also remove the Twilio SDK from your project with the following. ```groovy implementation 'com.twilio:video-android:' ``` ### Set permissions Ensure that you have all of the Android system permissions required by the Video SDK in your project (you can ignore permissions that you already have): ```plaintext WRITE_EXTERNAL_STORAGE INTERNET READ_PHONE_STATE ACCESS_NETWORK_STATE ACCESS_WIFI_STATE MODIFY_AUDIO_SETTINGS RECORD_AUDIO CAMERA BLUETOOTH BLUETOOTH_ADMIN BLUETOOTH_CONNECT BLUETOOTH_SCAN BROADCAST_STICKY WAKE_LOCK CALL_PHONE SYSTEM_ALERT_WINDOW FOREGROUND_SERVICE ``` If your project uses proguard, add the following rules to your project. ```plaintext -keep class us.zoom**{ *; } -keep interface us.zoom**{ *; } -keep class org.webrtc**{ *; } -keep class com.zipow**{ *; } ``` ## Code Changes The code snippets below illustrate the mappings between the Zoom and Twilio SDKs. Low-level functionality may differ between the two platforms, so the mappings may not be perfectly accurate for all use cases. ## Initialize the SDK In order to use The Zoom Video SDK, you must first initialize the main SDK singleton. This is usually done when your app starts, but you can substitute in the Video SDK wherever it is appropriate for your implementation. There is no equivalent of this in the Twilio Video SDK, so it is important to find the correct place in your app to add initialization logic. ```kotlin val zoomSdk = ZoomSDK.getInstance() val initParams = ZoomVideoSDKInitParams().apply { domain = "zoom.us" // Required enableLog = BuildConfig.DEBUG // Optional for debugging logFilePrefix = "MyLogPrefix" // Optional for debugging } zoomSdk.initialize(context, initParams) ``` ## SDK callbacks Both SDKs use listeners to detect and stay in sync with state changes. Replace the Twilio listener code with the Zoom Video SDK code. ```kotlin val roomListener = object : Room.Listener {...} ``` ```kotlin class ZoomDelegate : ZoomVideoSDKDelegate {...} val delegate = ZoomDelegate() zoomSdk.addListener(delegate) ``` The callbacks in these listeners can reflect a number of different changes including connection to the session/channel, status of other users, errors, and changes in state related to specific features. There are two main differences to be aware of when migrating to the `ZoomVideoSDKDelegate` used by Zoom: 1. For most use cases, the `ZoomVideoSDKDelegate` contains all of the callbacks you need. In Twilio there are multiple listeners depending on the area of functionality you are using. So it may require some refactoring to consolidate everything into one place. 2. You can call `addListener` whenever you're ready to receive callbacks from the Video SDK, while Twilio's `connect` method requires you to pass in a `Room.Listener` when connecting to a room. ## Join session/room The Video SDK uses [sessions](/docs/video-sdk/android/sessions/), which are similar to Twilio's concept of a room. Replace Twilio's code with Zoom's. ```kotlin val connectOptions = ConnectOptions.Builder(joinToken) .videoTracks(localVideoTracks) .audioTracks(localAudioTracks) .roomName(sessionId) .build() Video.connect(context, connectOptions, roomListener) ``` ```kotlin val sessionContext = ZoomVideoSDKSessionContext().apply { sessionName = sessionId userName = username sessionPassword = password token = myToken } zoomSdk.joinSession(sessionContext) ``` Both SDKs use a token for authentication, but **the Zoom SDK JWT requires information specific to the session you are trying to join**, so it's important to use the correct payload as specified in [Generate a Video SDK JWT](/docs/video-sdk/auth/#generate-a-video-sdk-jwt). ## Video See how to migrate from Twilio to Zoom Video SDK for video controls, local video preview, and displaying other user videos. ### Video controls Turning your own video on or off is conceptually similar between the two SDKs. ```kotlin val cameraEnumerator = Camera2Enumerator(context) cameraEnumerator.deviceNames.firstOrNull { cameraEnumerator.isFrontFacing(it) }?.let { val cameraCapturer = Camera2Capturer(context, it) val localVideoTrack = LocalVideoTrack.create(context, true, cameraCapturer) cameraCapturer.startCapture(width, height, framerate) } cameraCapturer.stopCapture() ``` ```kotlin zoomSdk.videoHelper.startVideo() zoomSdk.videoHelper.stopVideo() ``` The biggest difference between the implementations is the amount of setup that is required for Twilio. While Twilio requires manually setting up a `Camera2Capturer` and `LocalVideoTrack` to specify your input sources, this is all handled internally within the Zoom Video SDK. ### Set up local video preview Additionally, setting up a local video preview is similar between the two SDKs. ```kotlin val previewVideoView = VideoView(context) localVideoTrack?.addSink(previewVideoView) ``` ```kotlin val videoView = ZoomVideoSDKVideoView(context) val canvas = zoomSdk.session.mySelf.videoCanvas canvas.subscribe(videoView, ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_PanAndScan) ``` ### Display other user videos In order to enable your end users to see the video feeds of other users in a session/channel, you can use an approach similar to that used when setting up local video preview. But instead of getting local video, get the `ZoomVideoSDKVideoCanvas` associated with another user. ```kotlin val remoteVideoView = VideoView(context) remoteVideoTrack.addSink(remoteVideoView) remoteVideoTrack.removeSink(remoteVideoView) ``` ```kotlin zoomSdk.session.remoteUsers.firstOrNull { userId == it.userID }?.videoCanvas?.subscribe(remoteUserView, ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_PanAndScan) zoomSdk.session.remoteUsers.firstOrNull { userId == it.userID }?.videoCanvas?.unSubscribe(remoteUserView) ``` ## Audio controls Similarly to video controls, both SDKs offer a relatively simple approach to controlling audio. ```kotlin audioTrack.enable(enable) ``` ```kotlin zoomSdk.audioHelper.startAudio() val self = zoomSdk.session.mySelf zoomSdk.audioHelper.unMuteAudio(self) val self = zoomSdk.session.mySelf zoomSdk.audioHelper.muteAudio(self) ``` ## Leave a session To leave a session, call the `leaveSession` function and confirm whether the session should be ended for all users if you are the host. ```javascript room.disconnect(); ``` ```kotlin zoomSdk.leaveSession(end) ``` ## Clean up Video SDK When you are no longer using Zoom Video SDK in your app, you can call a simple method to clean up the Zoom Video SDK. ```kotlin localVideoTrack.release() localAudioTrack.release() ``` ```kotlin zoomSdk.cleanup() ``` With Twilio, you're required to release each track individually. ## REST APIs and Webhooks Zoom Video SDK has a full suite of [REST APIs](/docs/api/video-sdk) and [webhooks](/docs/api/video-sdk/events/). Learn how to [use the Zoom APIs](/docs/api/using-zoom-apis/) and [webhooks](/docs/api/webhooks/). _For reference, here's the [Twilio REST API documentation](https://www.twilio.com/docs/video/api)._ ## Video SDK features and support Zoom has a number of additional features including [live transcription and translation](https://marketplacefront.zoom.us/sdk/custom/android/us/zoom/sdk/ZoomVideoSDKLiveTranscriptionHelper.html), [cloud recording](https://marketplacefront.zoom.us/sdk/custom/android/us/zoom/sdk/ZoomVideoSDKRecordingHelper.html), [Public Switched Telephone Network (PSTN) call out](https://marketplacefront.zoom.us/sdk/custom/android/us/zoom/sdk/ZoomVideoSDKPhoneHelper.html) and [call in](https://marketplacefront.zoom.us/sdk/custom/android/us/zoom/sdk/ZoomVideoSDKSessionDialInNumberInfo.html) to join sessions by phone, [chat](/docs/video-sdk/android/chat/), [screen sharing](/docs/video-sdk/android/share/), and [command channel](/docs/video-sdk/android/command-channel/) to send data to other users in a session. Zoom also supports additional Video SDK platforms including Android, iOS, Linux, macOS, Windows, and wrappers such as Flutter and React Native. See [the Zoom Video SDK documentation](/docs/video-sdk/) to learn more. For the complete feature map of Twilio Video to Zoom Video SDK, by platform, see the [feature map](/docs/video-sdk/twilio/map/). Start building with the Video SDK now. For questions, contact us! ## Contact Us - [Developer Sales](https://www.zoom.com/en/video-sdk/#contact-block-get-started-with-video-sdk-from-zoom) - [Developer Forum](https://devforum.zoom.us/c/video-sdk/) - [Developer Support](/support/) - [Developer Partner Services](https://explore.zoom.us/en/lp/developer-partner-services/) _See [Video SDK Plans & Pricing for Developer](https://zoom.us/pricing/developer) for pricing._