if ( isVideoRendering ) {
room.localParticipant?.unpublishVideoTrack(self.localVideoTrack!)
self.camera?.stopCapture(completion: {_ in
self.isVideoRendering = false
})
} else {
let frontCamera = CameraSource.captureDevice(position: .front)
let backCamera = CameraSource.captureDevice(position: .back)
camera!.startCapture(device: frontCamera != nil ? frontCamera! : backCamera!) { (captureDevice, videoFormat, error) in
if let error = error {
// self.logMessage(messageText: "Capture failed with error.\ncode = \((error as NSError).code) error = \(error.localizedDescription)")
} else {
self.viewController.onGoingCallView.previewView.shouldMirror = (captureDevice.position == .front)
}
}
isVideoRendering = true
}
but none of these been called
func didUnsubscribeFromVideoTrack(videoTrack: RemoteVideoTrack, publication: RemoteVideoTrackPublication, participant: RemoteParticipant) {
I tried below code to stop video
if ( isVideoRendering ) { room.localParticipant?.unpublishVideoTrack(self.localVideoTrack!)
but none of these been called func didUnsubscribeFromVideoTrack(videoTrack: RemoteVideoTrack, publication: RemoteVideoTrackPublication, participant: RemoteParticipant) {