From 14a888bf4309df69fcceba7e364f54aea779f17e Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Thu, 8 Jun 2023 18:09:14 +0300 Subject: [PATCH] ios: show video in call from simulator (#2562) --- apps/ios/Shared/Views/Call/WebRTCClient.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/ios/Shared/Views/Call/WebRTCClient.swift b/apps/ios/Shared/Views/Call/WebRTCClient.swift index d6275fb904..5ecec1a982 100644 --- a/apps/ios/Shared/Views/Call/WebRTCClient.swift +++ b/apps/ios/Shared/Views/Call/WebRTCClient.swift @@ -302,6 +302,17 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg } func startCaptureLocalVideo(_ activeCall: Call) { +#if targetEnvironment(simulator) + guard + let capturer = activeCall.localCamera as? RTCFileVideoCapturer + else { + logger.error("Unable to work with a file capturer") + return + } + capturer.stopCapture() + // Drag video file named `video.mp4` to `sounds` directory in the project from any other path in filesystem + capturer.startCapturing(fromFileNamed: "sounds/video.mp4") +#else guard let capturer = activeCall.localCamera as? RTCCameraVideoCapturer, let camera = (RTCCameraVideoCapturer.captureDevices().first { $0.position == activeCall.device }) @@ -329,6 +340,7 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg capturer.startCapture(with: camera, format: format, fps: Int(min(24, fps.maxFrameRate))) +#endif } private func createAudioSender(_ connection: RTCPeerConnection) {