Skip to content

Commit

Permalink
Updating the api documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Dec 1, 2024
1 parent 24074c2 commit 54785cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Examples/iOS/IngestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 8 additions & 2 deletions HaishinKit/Sources/Mixer/MediaMixer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion HaishinKit/Sources/Mixer/VideoCaptureUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 54785cf

Please sign in to comment.