Cross-channel subscription
Updated at:
Copy as MD
By default, only users in the same room can communicate through audio and video streams. Different rooms are isolated from each other. Cross-channel subscription allows communication between rooms for scenarios such as co-streaming.
How it works
When Streamer A1 subscribes to the stream of Streamer B1 in Room B, if Room B or Streamer B1 does not exist, A1 waits until the app cancels the subscription. This simplifies the processing logic.
Sample code
Subscribe to audio and video streams across channels
-
Sample code for Android:
/* Subscribe to the camera stream and audio stream of B1 in Room B. */ mAliRtcEngine.subscribeRemoteDestChannelStream("B","B1",AliRtcVideoTrack.AliRtcVideoTrackCamera,true,true); -
Sample code for iOS:
/* Subscribe to the camera stream and audio stream of B1 in Room B. */ [self.engine subscribeRemoteDestChannelStream:@"B" uid:@"B1" track:AliRtcVideoTrackCamera subAudio:YES sub:YES]; -
Sample code for Windows:
/* Subscribe to the camera stream and audio stream of B1 in Room B. */ mAliRtcEngine->SubscribeRemoteDestChannelStream("B","B1",AliEngineVideoTrackCamera,true,true);
Cancel cross-channel subscription to audio and video streams
-
Sample code for Android:
/* Unsubscribe from the camera stream and audio stream of B1 in Room B. */ mAliRtcEngine.subscribeRemoteDestChannelStream("B","B1",AliRtcVideoTrack.AliRtcVideoTrackNo,false,false); -
Sample code for iOS:
/* Unsubscribe from the camera stream and audio stream of B1 in Room B. */ [self.engine subscribeRemoteDestChannelStream:@"B" uid:@"B1" track:AliRtcVideoTrackNo subAudio:NO sub:NO]; -
Sample code for Windows:
/* Unsubscribe from the camera stream and audio stream of B1 in Room B. */ mAliRtcEngine->SubscribeRemoteDestChannelStream("B","B1",AliEngineVideoTrackCamera,false,false);
Is this page helpful?