Automatic stream ingest and pulling
Updated at:
Copy as MD
The Alibaba Real-Time Communication (ARTC) SDK automatically ingests and pulls audio and video streams when a user joins a channel, switches roles, or leaves a channel. This feature is enabled by default. This topic describes how the feature works and provides sample code for disabling it.
How it works
Note
-
In audio-only scenarios, only audio streams are ingested and pulled.
-
In audio and video scenarios, all configured audio and video streams are ingested and pulled.

Sample code
API to disable automatic stream ingest and pulling
You can disable automatic stream ingest and pulling separately to control each behavior independently.
Disable automatic audio and video stream ingest
Android
/* If you set the parameter to false, video streams are not ingested after a user joins the channel. Your app must call this API to ingest video streams. */
/* If you set the parameter to true, video streams are immediately ingested after a user joins the channel. The default value is true. */
mAliRtcEngine.publishLocalVideoStream(false);
/* If you set the parameter to false, audio streams are not ingested after a user joins the channel. Your app must call this API to ingest audio streams. */
/* If you set the parameter to true, audio streams are immediately ingested after a user joins the channel. The default value is true. */
mAliRtcEngine.publishLocalAudioStream(false);
iOS
/* If you set the parameter to NO, video streams are not ingested after a user joins the channel. Your app must call this API to ingest video streams. */
/* If you set the parameter to YES, video streams are immediately ingested after a user joins the channel. The default value is YES. */
[self.engine publishLocalVideoStream:NO];
/* If you set the parameter to NO, audio streams are not ingested after a user joins the channel. Your app must call this API to ingest audio streams. */
/* If you set the parameter to YES, audio streams are immediately ingested after a user joins the channel. The default value is YES. */
[self.engine publishLocalAudioStream:NO];
Windows
/* If you set the parameter to false, video streams are not ingested after a user joins the channel. Your app must call this API to ingest video streams. */
/* If you set the parameter to true, video streams are immediately ingested after a user joins the channel. The default value is true. */
mAliRtcEngine->PublishLocalVideoStream(false);
/* If you set the parameter to false, audio streams are not ingested after a user joins the channel. Your app must call this API to ingest audio streams. */
/* If you set the parameter to true, audio streams are immediately ingested after a user joins the channel. The default value is true. */
mAliRtcEngine->PublishLocalAudioStream(false);
Disable automatic audio and video stream pulling
Android
/* If you set the parameter to false, video streams are not subscribed to after a user joins the channel. Your app must call the subscribeRemoteMediaStream or subscribeRemoteVideoStream method to subscribe to video streams. */
/* If you set the parameter to true, video streams are immediately subscribed to after a user joins the channel. The default value is true. */
mAliRtcEngine.setDefaultSubscribeAllRemoteVideoStreams(false);
/* If you set the parameter to false, audio streams are not subscribed to after a user joins the channel. Your app must call the subscribeRemoteMediaStream or subscribeRemoteAudioStream method to subscribe to audio streams. */
/* If you set the parameter to true, audio streams are immediately subscribed to after a user joins the channel. The default value is true. */
mAliRtcEngine.setDefaultSubscribeAllRemoteAudioStreams(false);
iOS
/* If you set the parameter to NO, video streams are not subscribed to after a user joins the channel. Your app must call the subscribeRemoteMediaStream or subscribeRemoteVideoStream method to subscribe to video streams. */
/* If you set the parameter to YES, video streams are immediately subscribed to after a user joins the channel. The default value is YES. */
[self.engine setDefaultSubscribeAllRemoteVideoStreams:NO];
/* If you set the parameter to NO, audio streams are not subscribed to after a user joins the channel. Your app must call the subscribeRemoteMediaStream or subscribeRemoteAudioStream method to subscribe to audio streams. */
/* If you set the parameter to YES, audio streams are immediately subscribed to after a user joins the channel. The default value is YES. */
[self.engine setDefaultSubscribeAllRemoteAudioStreams:NO];
Windows
/* If you set the parameter to false, video streams are not subscribed to after a user joins the channel. Your app must call the SubscribeRemoteMediaStream or SubscribeRemoteVideoStream method to subscribe to video streams. */
/* If you set the parameter to true, video streams are immediately subscribed to after a user joins the channel. The default value is true. */
mAliRtcEngine.SetDefaultSubscribeAllRemoteVideoStreams(false);
/* If you set the parameter to false, audio streams are not subscribed to after a user joins the channel. Your app must call the SubscribeRemoteMediaStream or SubscribeRemoteAudioStream method to subscribe to audio streams. */
/* If you set the parameter to true, audio streams are immediately subscribed to after a user joins the channel. The default value is true. */
mAliRtcEngine.SetDefaultSubscribeAllRemoteAudioStreams(false);
Is this page helpful?