fix: crash on second webrtc connection
This commit is contained in:
parent
8e1e8dc4e6
commit
22570e0e6d
@ -15,7 +15,7 @@ class WebRtcService(
|
|||||||
private val websocketClient: WebsocketClient,
|
private val websocketClient: WebsocketClient,
|
||||||
private val cameraService: CameraService
|
private val cameraService: CameraService
|
||||||
) {
|
) {
|
||||||
private val rtcPeerConnection by lazy { createRtcPeerConnection() }
|
private var rtcPeerConnection: RtcPeerConnection = createRtcPeerConnection()
|
||||||
val videoTrack by lazy { rtcPeerConnection.createVideoTrack() }
|
val videoTrack by lazy { rtcPeerConnection.createVideoTrack() }
|
||||||
val audioTrack by lazy { rtcPeerConnection.createAudioTrack() }
|
val audioTrack by lazy { rtcPeerConnection.createAudioTrack() }
|
||||||
private var peerId: String = ""
|
private var peerId: String = ""
|
||||||
@ -37,6 +37,7 @@ class WebRtcService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleOffer(sdp: String) {
|
private fun handleOffer(sdp: String) {
|
||||||
|
rtcPeerConnection = createRtcPeerConnection()
|
||||||
var mediaConstraints = MediaConstraints()
|
var mediaConstraints = MediaConstraints()
|
||||||
val remoteSessionDescription = SessionDescription(SessionDescription.Type.OFFER, sdp)
|
val remoteSessionDescription = SessionDescription(SessionDescription.Type.OFFER, sdp)
|
||||||
rtcPeerConnection.apply {
|
rtcPeerConnection.apply {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user