createScreenShareVideoTrack

fun createScreenShareVideoTrack(encoderConfig: String? = null, data: Intent?, multiStream: Boolean = false, withAudio: Boolean = false): CustomStreamTrack?

Creates a screen-share video track from the user's MediaProjection consent.

Returns a track carrying the consent and the resolved profile, ready for Room.enableScreenShare. Capture starts there, not here.

Returns null instead when the user declined the consent, or when encoderConfig is unknown. An unknown profile is also reported on the active room's onError as 3071 (ERROR_INVALID_CUSTOM_TRACK_CONFIG); nothing is thrown.

Return

the track, or null for the two cases above.

Parameters

encoderConfig

a screen-share profile name — "h360p_30fps", "h480p_15fps", "h480p_30fps", "h720p_5fps", "h720p_15fps", "h720p_30fps", "h1080p_15fps" or "h1080p_30fps"; null/empty means "h720p_15fps".

data

the consent Intent from MediaProjectionManager; null means the user declined.

multiStream

true publishes the profile's three bitrate tiers as simulcast layers instead of one encoding. Defaults to false.

withAudio

true also captures system audio and mixes it into the microphone track, so muting the mic silences both. Defaults to false.