Fix stop sharing button state.
This commit is contained in:
parent
b358863a1e
commit
ba4413e702
|
@ -224,7 +224,8 @@ class VectorCallViewModel @AssistedInject constructor(
|
|||
formattedDuration = webRtcCall.formattedDuration(),
|
||||
isHD = webRtcCall.mxCall.isVideoCall && webRtcCall.currentCaptureFormat() is CaptureFormat.HD,
|
||||
canOpponentBeTransferred = webRtcCall.mxCall.capabilities.supportCallTransfer(),
|
||||
transferee = computeTransfereeState(webRtcCall.mxCall)
|
||||
transferee = computeTransfereeState(webRtcCall.mxCall),
|
||||
isSharingScreen = webRtcCall.isSharingScreen()
|
||||
)
|
||||
}
|
||||
updateOtherKnownCall(webRtcCall)
|
||||
|
|
|
@ -97,6 +97,7 @@ import kotlin.coroutines.CoroutineContext
|
|||
private const val STREAM_ID = "userMedia"
|
||||
private const val AUDIO_TRACK_ID = "${STREAM_ID}a0"
|
||||
private const val VIDEO_TRACK_ID = "${STREAM_ID}v0"
|
||||
private const val SCREEN_TRACK_ID = "${STREAM_ID}s0"
|
||||
private val DEFAULT_AUDIO_CONSTRAINTS = MediaConstraints()
|
||||
private const val INVITE_TIMEOUT_IN_MS = 60_000L
|
||||
|
||||
|
@ -805,7 +806,7 @@ class WebRtcCall(
|
|||
}
|
||||
|
||||
private fun showScreenLocally(factory: PeerConnectionFactory, videoSource: VideoSource?, localMediaStream: MediaStream?) {
|
||||
localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource).apply { setEnabled(true) }
|
||||
localVideoTrack = factory.createVideoTrack(SCREEN_TRACK_ID, videoSource).apply { setEnabled(true) }
|
||||
localMediaStream?.addTrack(localVideoTrack)
|
||||
localSurfaceRenderers.forEach { it.get()?.let { localVideoTrack?.addSink(it) } }
|
||||
}
|
||||
|
@ -820,6 +821,13 @@ class WebRtcCall(
|
|||
videoCapturer.startCapture(currentCaptureFormat.width, currentCaptureFormat.height, currentCaptureFormat.fps)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the user is sharing the screen, false otherwise.
|
||||
*/
|
||||
fun isSharingScreen(): Boolean {
|
||||
return localVideoTrack?.id() == SCREEN_TRACK_ID
|
||||
}
|
||||
|
||||
private suspend fun release() {
|
||||
listeners.clear()
|
||||
mxCall.removeListener(this)
|
||||
|
|
Loading…
Reference in New Issue