- Configure the Maven repository, SDK dependency, and basic environment as described in Integration.
- Prepare a channel
tokenissued by your server. - Request camera and microphone runtime permissions in your app.
- To manage output devices such as the speaker, earpiece, or Bluetooth headsets, see Audio routing (Chinese).
cn.seastart.rtc.media.original.render.VcsPlayerGlTextureView or VcsPlayerGlSurfaceView for preview and remote display views, with this package path in both code imports and XML layouts.
Step 1: Create and initialize RTCEngine
RTCEngine.create(...) requires an Engine-level error listener. It receives errors that don’t belong to any channel callback, as well as blocking errors such as calling a channel that hasn’t started; channelId is null when it can’t be determined.
Step 2: Prepare channel and media callbacks
Everyjoin(...) call takes its own RTCClientEvent for that channel. If you only override a few events, extend RTCClientSimpleEvent instead of implementing the full interface.
channel. Even if a listener is bound to only one RTCChannel, use this parameter to keep logs and state separated. For more definitions, see RTCClientEvent (Chinese) and RTCMediaEvent (Chinese).
Step 3: Join a channel
join(...) synchronously returns RTCChannel?:
- A non-null return only means the SDK accepted the request and created a channel handle, not that the join succeeded.
- The actual result is reported by
onJoinSucceed(...)oronJoinFailed(...). - If the SDK isn’t initialized or has been released, it synchronously throws
SdkNotInitializedException.
join creates the default channel, and the flat APIs on RTCEngine—publish, subscribe, query, leave(), and so on—all act on it. The SDK also supports joining multiple channels at the same time; this quickstart covers only the single-channel flow. For details, see Multi-channel (Chinese).
Step 4: Start local capture and publish
Run the following publishing flow afteronJoinSucceed(...). Capture and publishing are two separate actions: explicitly start local capture first, then publish the same local track to the channel. Unpublishing doesn’t automatically stop shared capture; when you no longer need the device, also call the track’s stopCapture().
4.1 Camera capture and publishing
4.2 Microphone capture and publishing
The microphone capture module is decoupled from joining and publishing.publishLocalAudio(...) no longer opens the microphone; you must call LocalMicTrack.startCapture(...) first.
setRtcLocalAudioFrameEvent(...) first, then call micTrack.startCapture(...) to receive local PCM data for recording or processing; registering the callback alone doesn’t open the microphone. See LocalMicTrack (Chinese) and RTCEngine (Chinese).
4.3 Screen sharing (optional)
Step 5: Subscribe to and play remote media
After receivingonStreamTrackAdd(...), get the remote track from the default channel, bind a render view, then subscribe:
Step 6: Leave the channel and release resources
releaseSDK() releases all channels and shared resources from the current initialization cycle; you can call initSDK() again afterward.
More capabilities
- Joining multiple channels concurrently, per-channel publishing and subscription, and resource isolation: Multi-channel (Chinese)
- Microphone input device enumeration, switching, and PCM callbacks: LocalMicTrack (Chinese)
- Custom video publishing: Custom tracks (Chinese)
- Whiteboard: Whiteboard
- Audio output device management: Audio routing (Chinese)
- Full SDK API: RTCEngine (Chinese)