Skip to content

Commit f52b9a0

Browse files
committed
Update MediaMixer.swift
1 parent a398d6f commit f52b9a0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

HaishinKit/Sources/Mixer/MediaMixer.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public final actor MediaMixer {
2929
func makeSession() -> (any CaptureSessionConvertible) {
3030
switch self {
3131
case .single:
32-
var session = CaptureSession()
32+
let session = CaptureSession()
3333
session.isMultiCamSessionEnabled = false
3434
return session
3535
case .multi:
36-
var session = CaptureSession()
36+
let session = CaptureSession()
3737
session.isMultiCamSessionEnabled = true
3838
return session
3939
case .manual:
@@ -141,6 +141,9 @@ public final actor MediaMixer {
141141
multiTrackAudioMixingEnabled: Bool = false
142142
) {
143143
self.captureSessionMode = captureSessionMode
144+
Task {
145+
await _init(multiTrackAudioMixingEnabled: multiTrackAudioMixingEnabled)
146+
}
144147
}
145148

146149
private func _init(
@@ -152,8 +155,9 @@ public final actor MediaMixer {
152155
/// Attaches a video device.
153156
///
154157
/// If you want to use the multi-camera feature, please make create a MediaMixer with a multiCamSession mode for iOS.
155-
/// let mixer = MediaMixer(multiCamSessionEnabled: true, multiTrackAudioMixingEnabled: false)
156-
///
158+
/// ```swift
159+
/// let mixer = MediaMixer(captureSessionMode: .multi)
160+
/// ```
157161
@available(tvOS 17.0, *)
158162
public func attachVideo(_ device: AVCaptureDevice?, track: UInt8 = 0, configuration: VideoDeviceConfigurationBlock? = nil) async throws {
159163
let frameRate = self.frameRate
@@ -185,7 +189,7 @@ public final actor MediaMixer {
185189
/// - Attention: You can perform multi-microphone capture by specifying as follows on macOS. Unfortunately, it seems that only one microphone is available on iOS.
186190
///
187191
/// ```swift
188-
/// let mixer = MediaMixer(multiCamSessionEnabled: false, multiTrackAudioMixingEnabled: true)
192+
/// let mixer = MediaMixer(multiTrackAudioMixingEnabled: true)
189193
///
190194
/// var audios = AVCaptureDevice.devices(for: .audio)
191195
/// if let device = audios.removeFirst() {

0 commit comments

Comments
 (0)