Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Apr 23, 2024
1 parent 6a31596 commit add08ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ stream.play()
```swift
stream.frameRate = 30
stream.sessionPreset = AVCaptureSession.Preset.medium

// Do not call beginConfiguration() and commitConfiguration() internally within the scope of the method, as they are called internally.
stream.configuration { session in
session.automaticallyConfiguresApplicationAudioSession = true
}
```

### 🔊 Audio
Expand All @@ -284,15 +289,18 @@ stream.attachAudio(front, track: 0) { audioUnit, error in
```

#### [AudioMixerSettings](https://shogo4405.github.io/HaishinKit.swift/Structs/IOAudioMixerSettings.html)
When you specify the sampling rate, it will perform resampling. Additionally, in the case of multiple channels, downsampling can be applied.
If you want to mix multiple audio tracks, please enable the Feature flag.
```swift
FeatureUtil.setEnabled(for: .multiTrackAudioMixing, isEnabled: true)
```

When you specify the sampling rate, it will perform resampling. Additionally, in the case of multiple channels, downsampling can be applied.
```swift
// If you want to mix multiple audio tracks, please enable the Feature flag.
// FeatureUtil.setEnabled(for: .multiTrackAudioMixing, isEnabled: true)
stream.audioMixerSettings = IOAudioMixerSettings(
channels: UInt32 = 1,
sampleRate: Float64 = 44100,
channels: UInt32 = 0, // Setting the value to 0 will be the same as the value specified in mainTrack.
sampleRate: Float64 = 44100, // Setting the value to 0 will be the same as the value specified in mainTrack.
)

stream.audioMixerSettings.isMuted = false
stream.audioMixerSettings.mainTrack = 0
stream.audioMixerSettings.tracks = [
Expand Down Expand Up @@ -323,13 +331,13 @@ stream.attachCamera(front, track: 0) { videoUnit, error in
}
```

#### [VideoMixerSettings](https://shogo4405.github.io/HaishinKit.swift/Structs/VideoMixerSettings.html)
#### [VideoMixerSettings](https://shogo4405.github.io/HaishinKit.swift/Structs/IOVideoMixerSettings.html)
```swift
stream.videoMixerSettings = init(
mode: Mode,
cornerRadius: CGFloat,
regionOfInterest: CGRect,
direction: ImageTransform
mode: Mode,
cornerRadius: CGFloat,
regionOfInterest: CGRect,
direction: ImageTransform
)
```

Expand Down
2 changes: 1 addition & 1 deletion Sources/IO/IOStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ open class IOStream: NSObject {

/// Configurations for the AVCaptureSession.
@available(tvOS 17.0, *)
func configuration(_ lambda: (_ session: AVCaptureSession) throws -> Void) rethrows {
public func configuration(_ lambda: (_ session: AVCaptureSession) throws -> Void) rethrows {
try mixer.session.configuration(lambda)
}

Expand Down

0 comments on commit add08ed

Please sign in to comment.