This topic describes how to use screen sharing.
Stream ingest client
- Start screen sharing.
// Configure screen sharing for stream ingest int ret = [self.engine startScreenShareWithDesktopId: int:desktopId AliRtcScreenShareConfig * _Nonnull:config]; ..... - After the stream ingest starts, use a callback to confirm that the screen sharing is published.
void onScreenSharePublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous stream ingest state. newState AliRtcPublishState The current stream ingest state. elapseSinceLastState int The time interval since the last state change. Unit: ms. channel String The current channel ID. - Stop screen sharing.
// Configure to stop screen sharing int ret = [self.engine stopScreenShare:NO]; - After screen sharing stops, use a callback to confirm that the screen sharing is unpublished.
void onScreenSharePublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous stream ingest state. newState AliRtcPublishState The current stream ingest state. elapseSinceLastState int The time interval since the last state change. Unit: ms. channel String The current channel ID.
Subscriber client
Subscribers can automatically or manually subscribe to the screen sharing video stream from the stream ingest client and set the corresponding view for display. For more information, see the AliRtcEngine interface.
该文章对您有帮助吗?