disconnectSendTransportScreen

Disconnects the send transport for screen sharing by closing the screen producer and notifying the server.

This function handles both remote and local screen transport disconnection. It manages producer lifecycle and ensures proper cleanup of screen sharing resources.

Workflow:

  1. Local Transport Disconnection:

    • Disconnects local screen transport if available

    • Closes local screen producer

    • Notifies local server

  2. Remote Transport Disconnection:

    • Closes remote screen producer if it exists

    • Notifies remote server about closed producer

  3. State Cleanup:

    • Clears screen producer references

    • Updates all relevant state parameters

  4. Server Notification:

    • Emits closeScreenProducer event

    • Emits pauseProducerMedia event with screen tag

Return

Result indicating success or failure

Example usage:

val options = DisconnectSendTransportScreenOptions(
parameters = myParameters
)

disconnectSendTransportScreen(options).onSuccess {
Logger.e("DisconnectSendTransp", "Screen transport disconnected successfully")
}.onFailure { error ->
Logger.e("DisconnectSendTransp", "Disconnection failed: ${error.message}")
}

Parameters

options

Configuration options for disconnecting screen transport