Skip to content

Commit

Permalink
fix(ios): re-order HaishinKit configuration to fix random aspect rati…
Browse files Browse the repository at this point in the history
…o and crashes on iOS

See #7
  • Loading branch information
ThibaultBee committed May 31, 2022
1 parent 44e8962 commit 311a77c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ios/Classes/ApiVideoLiveStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,22 @@ 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
print("======== Camera error ==========")
print(error.description)
}
}

private func prepareVideo() {
rtmpStream.captureSettings = [
.sessionPreset: AVCaptureSession.Preset.high,
Expand Down

0 comments on commit 311a77c

Please sign in to comment.