Ankit-Aggarwal / SwiftyWebRTC

Swift Framework for WebRTC
MIT License
159 stars 32 forks source link

How to stay on the per connection when navigate back from Video chat screen to other screen. #36

Open hilajqinnovation opened 3 years ago

hilajqinnovation commented 3 years ago

Hi Ankit-Aggarwal, Thank you so much for this wonderfull code for establishing video call using WebRTC in pure swift. I found lot of other cods that are not is pure swift. I implemented the video call using WebRTC and PubNub with the help of this code. But in my project I want to continue the calling process in background also. Also after establishing the video call, and I navigate from VideoChat screen to other screens I need to continue the calling like video needs to paused but voice call needs to continue. But here when I navigate back from the VideoChat screen without disconnecting the call, I'm getting callback in the deinit method and the removing the stream from the peerConnection and call get disconnected, and I commented the code then the app get crashed. Can you please help me I don't want to disconnect the call when I navigate back to other screens of the same app.

The deinit method is, deinit { guard let peerConnection = self.peerConnection else { return } if let stream = peerConnection.localStreams.first { print(stream) audioTrack = nil peerConnection.remove(stream) } @@}