From 311a77ca32a42f1d466150827954383906358c9c Mon Sep 17 00:00:00 2001 From: ThibaultBee Date: Tue, 31 May 2022 15:29:12 +0200 Subject: [PATCH] fix(ios): re-order HaishinKit configuration to fix random aspect ratio and crashes on iOS See https://github.com/apivideo/api.video-flutter-live-stream/issues/7 --- ios/Classes/ApiVideoLiveStream.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ios/Classes/ApiVideoLiveStream.swift b/ios/Classes/ApiVideoLiveStream.swift index 89cc7fe..9f4c17c 100644 --- a/ios/Classes/ApiVideoLiveStream.swift +++ b/ios/Classes/ApiVideoLiveStream.swift @@ -89,15 +89,14 @@ public class ApiVideoLiveStream{ } NotificationCenter.default.addObserver(self, selector: #selector(on(_:)), name: UIDevice.orientationDidChangeNotification, object: nil) - attachCamera() prepareVideo() - attachAudio() prepareAudio() - - preview.attachStream(rtmpStream) + attachCamera() + attachAudio() + preview.attachStream(rtmpStream) } - + private func attachCamera() { rtmpStream.captureSettings[.isVideoMirrored] = camera == .front rtmpStream.attachCamera(DeviceUtil.device(withPosition: camera)) { error in @@ -105,7 +104,7 @@ public class ApiVideoLiveStream{ print(error.description) } } - + private func prepareVideo() { rtmpStream.captureSettings = [ .sessionPreset: AVCaptureSession.Preset.high,