Skip to content

Commit

Permalink
chore(dependency): upgrade to HaishinKit 1.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Feb 5, 2024
1 parent 84448ed commit fd646c0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion ApiVideoLiveStream.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
spec.source_files = "Sources/**/*.{h,m,swift}"
spec.exclude_files = "Sources/Exclude"

spec.dependency "HaishinKit", "1.7.2"
spec.dependency "HaishinKit", "1.7.3"

end
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/shogo4405/HaishinKit.swift",
"state" : {
"revision" : "a7ae921e0cfce28057b610bd3374fd057c5c1b65",
"version" : "1.7.1"
"revision" : "0fdd6b0046964161e3a7d263685ac1737e57a341",
"version" : "1.7.3"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/shogo4405/HaishinKit.swift",
"state" : {
"revision" : "4d16635e4d5011c923fbf79cc2dcfdbc70821ab0",
"version" : "1.7.2"
"revision" : "0fdd6b0046964161e3a7d263685ac1737e57a341",
"version" : "1.7.3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/shogo4405/HaishinKit.swift", from: "1.7.2")
.package(url: "https://github.com/shogo4405/HaishinKit.swift", from: "1.7.3")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
53 changes: 27 additions & 26 deletions Sources/ApiVideoLiveStream/ApiVideoLiveStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public class ApiVideoLiveStream {
/// - initialVideoConfig: The ApiVideoLiveStream's new VideoConfig
/// - initialCamera: The ApiVideoLiveStream's initial camera device
public convenience init(
preview: NetStreamDrawable,
preview: IOStreamDrawable,
initialAudioConfig: AudioConfig? = AudioConfig(),
initialVideoConfig: VideoConfig? = VideoConfig(),
initialCamera: AVCaptureDevice? = AVCaptureDevice.default(
Expand Down Expand Up @@ -281,37 +281,39 @@ public class ApiVideoLiveStream {

private func attachCamera(_ camera: AVCaptureDevice?) {
self.lastCamera = camera
let capture = self.rtmpStream.videoCapture(for: 0)

if let camera = camera {
self.rtmpStream.attachCamera(camera, channel: 0) { videoCaptureUnit, error in
if let error {
print("======== Camera error ==========")
print(error)
self.delegate?.videoError(error)
return
}

if let camera {
videoCaptureUnit?.isVideoMirrored = camera.position == .front
}
#if os(iOS)
// capture.preferredVideoStabilizationMode = AVCaptureVideoStabilizationMode
// videoCaptureUnit.preferredVideoStabilizationMode = AVCaptureVideoStabilizationMode
// .auto // Add latency to video
#endif
capture?.isVideoMirrored = camera.position == .front
}

self.rtmpStream.attachCamera(camera) { error in
print("======== Camera error ==========")
print(error)
self.delegate?.videoError(error)
}

self.rtmpStream.lockQueue.async {
guard let device = capture?.device else {
guard let device = videoCaptureUnit?.device else {
return
}
do {
try device.lockForConfiguration()
if device.isExposureModeSupported(.continuousAutoExposure) {
device.exposureMode = .continuousAutoExposure
self.rtmpStream.lockQueue.async {
do {
try device.lockForConfiguration()
if device.isExposureModeSupported(.continuousAutoExposure) {
device.exposureMode = .continuousAutoExposure
}
if device.isFocusModeSupported(.continuousAutoFocus) {
device.focusMode = .continuousAutoFocus
}
device.unlockForConfiguration()
} catch {
print("Could not lock device for exposure and focus: \(error)")
}
if device.isFocusModeSupported(.continuousAutoFocus) {
device.focusMode = .continuousAutoFocus
}
device.unlockForConfiguration()
} catch {
print("Could not lock device for exposure and focus: \(error)")
}
}
}
Expand Down Expand Up @@ -395,7 +397,7 @@ public class ApiVideoLiveStream {
}

public func stopPreview() {
self.rtmpStream.attachCamera(nil)
self.rtmpStream.attachCamera(nil, channel: 0)
self.rtmpStream.attachAudio(nil)
}

Expand Down Expand Up @@ -423,7 +425,6 @@ public class ApiVideoLiveStream {
if level == "error" {
self.delegate?.connectionFailed(code)
}
break
}
}

Expand Down

0 comments on commit fd646c0

Please sign in to comment.