From 54785cf9ebe052c6d5628d5bd054c6340663e5d9 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Mon, 2 Dec 2024 00:54:42 +0900 Subject: [PATCH] Updating the api documentation. --- Examples/iOS/IngestViewController.swift | 6 ++++-- HaishinKit/Sources/Mixer/MediaMixer.swift | 10 ++++++++-- HaishinKit/Sources/Mixer/VideoCaptureUnit.swift | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Examples/iOS/IngestViewController.swift b/Examples/iOS/IngestViewController.swift index a3abf058a..3ea5a4f6e 100644 --- a/Examples/iOS/IngestViewController.swift +++ b/Examples/iOS/IngestViewController.swift @@ -36,8 +36,10 @@ final class IngestViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() Task { - // If you want to use the multi-camera feature, please make sure stream.isMultiCamSessionEnabled = true. Before attachCamera or attachAudio. - // mixer.isMultiCamSessionEnabled = true + // If you want to use the multi-camera feature, please make create a MediaMixer with a multiCamSession mode. + // ``` + // let mixer = MediaMixer(multiCamSessionEnabled: true, multiTrackAudioMixingEnabled: false) + // ``` if let orientation = DeviceUtil.videoOrientation(by: UIApplication.shared.statusBarOrientation) { await mixer.setVideoOrientation(orientation) } diff --git a/HaishinKit/Sources/Mixer/MediaMixer.swift b/HaishinKit/Sources/Mixer/MediaMixer.swift index 4febdfd01..304bc9ea4 100644 --- a/HaishinKit/Sources/Mixer/MediaMixer.swift +++ b/HaishinKit/Sources/Mixer/MediaMixer.swift @@ -126,11 +126,16 @@ public final actor MediaMixer { #endif /// Attaches a video device. + /// + /// If you want to use the multi-camera feature, please make create a MediaMixer with a multiCamSession mode for iOS. + /// ``` + /// let mixer = MediaMixer(multiCamSessionEnabled: true, multiTrackAudioMixingEnabled: false) + /// ``` @available(tvOS 17.0, *) public func attachVideo(_ device: AVCaptureDevice?, track: UInt8 = 0, configuration: VideoDeviceConfigurationBlock? = nil) async throws { return try await withCheckedThrowingContinuation { continuation in do { - try videoIO.attachCamera(track, device: device, configuration: configuration) + try videoIO.attachVideo(track, device: device, configuration: configuration) continuation.resume() } catch { continuation.resume(throwing: Error.failedToAttach(error)) @@ -153,7 +158,8 @@ public final actor MediaMixer { /// - Attention: You can perform multi-microphone capture by specifying as follows on macOS. Unfortunately, it seems that only one microphone is available on iOS. /// /// ``` - /// mixer.setMultiTrackAudioMixingEnabled(true) + /// let mixer = MediaMixer(multiCamSessionEnabled: false, multiTrackAudioMixingEnabled: true) + /// /// var audios = AVCaptureDevice.devices(for: .audio) /// if let device = audios.removeFirst() { /// mixer.attachAudio(device, track: 0) diff --git a/HaishinKit/Sources/Mixer/VideoCaptureUnit.swift b/HaishinKit/Sources/Mixer/VideoCaptureUnit.swift index 14e405342..8a27fdf71 100644 --- a/HaishinKit/Sources/Mixer/VideoCaptureUnit.swift +++ b/HaishinKit/Sources/Mixer/VideoCaptureUnit.swift @@ -103,7 +103,7 @@ final class VideoCaptureUnit: CaptureUnit { } @available(tvOS 17.0, *) - func attachCamera(_ track: UInt8, device: AVCaptureDevice?, configuration: VideoDeviceConfigurationBlock?) throws { + func attachVideo(_ track: UInt8, device: AVCaptureDevice?, configuration: VideoDeviceConfigurationBlock?) throws { guard devices[track]?.device != device else { return }