Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
assign null for screencastPromise after startScreencast
Browse files Browse the repository at this point in the history
  • Loading branch information
karkakol committed Apr 25, 2024
1 parent 92513f9 commit c2952f1
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class MembraneWebRTC(val sendEvent: (name: String, data: Map<String, Any?>) -> U
fun disconnect() {
ensureCreated()
if (isScreencastOn) {
stopScreencast(false)
stopScreencast()
}
membraneRTC?.disconnect()
membraneRTC = null
Expand Down Expand Up @@ -632,6 +632,7 @@ class MembraneWebRTC(val sendEvent: (name: String, data: Map<String, Any?>) -> U
setScreencastTrackState(true)

screencastPromise?.resolve(isScreencastOn)
screencastPromise = null
}

private fun getScreencastVideoParameters(): VideoParameters {
Expand All @@ -658,18 +659,16 @@ class MembraneWebRTC(val sendEvent: (name: String, data: Map<String, Any?>) -> U
emitEndpoints()
}

private fun stopScreencast(calledFromToggleScreencast: Boolean = true) {
private fun stopScreencast() {
ensureScreencastTrack()
localScreencastTrack?.let {
removeTrackFromLocalEndpoint(it)
localScreencastTrack = null
}

setScreencastTrackState(false)
if (calledFromToggleScreencast) {
screencastPromise?.resolve(isScreencastOn)
}

screencastPromise?.resolve(isScreencastOn)
screencastPromise = null
}

Expand Down

0 comments on commit c2952f1

Please sign in to comment.