WCSApi2.getMediaAccess() method (see example code): @IBAction func testPressed(_ sender: Any) {
if (testButton.title(for: .normal) == "TEST") {
let constraints = FPWCSApi2MediaConstraints(audio: true, video: true)!
do {
try WCSApi2.getMediaAccess(constraints, localDisplay.videoView)
} catch {
print(error)
}
testButton.setTitle("RELEASE", for: .normal)
} else {
WCSApi2.releaseLocalMedia(display: localDisplay.videoView);
testButton.setTitle("TEST", for: .normal)
}
}
private func setupWCSLocalMedia(active: Bool) {
guard let videoView = self.videoView else { return }
if active {
let constraints = FPWCSApi2MediaConstraints(audio: true, video: true)!
try? WCSApi2.getMediaAccess(constraints, videoView)
} else {
_ = WCSApi2.releaseLocalMedia(display: videoView)
}
}
Test then Release button. If the issue is not reproduced, please check the return value of releaseLocalMedia method. It returns true if the display found in resources acquired by previous getMediaAccess call and false if not. if (r.view == display) {
[r close];
r.view = nil;
ret = true;
[localMediaResources removeObject:r];
break;
}
This it the internal SDK code. In internalHow to you get the "r" reference that you mentioned in your answer?
close method, WebRTC library function RTCVideoTrack.removeRenderer is called to remove the RTCVideoRenderer from the media track. This should release the device camera.Test then Release button. If the issue is not reproduced, please modify the example code to reproduce it and send us the code using this form.We did not received any steps to reproduce or code example to reproduce the issue from you, so we don't raise ticket yet. Please use this form to send.any though regarding the ticket I submitted? Did you saw the issue? Is under development?