twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 177 forks source link

How to know either remote participant unsubscribed to video ? #523

Closed nitinKareer closed 4 years ago

nitinKareer commented 4 years ago

I tried below code to stop video

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) {

    print("bye")
}

func remoteParticipantDidUnpublishVideoTrack(participant: RemoteParticipant, publication: RemoteVideoTrackPublication) {
    print(publication.isTrackSubscribed)
}