Skip to content

Commit 01052a9

Browse files
Fix audio recorder init method (#3783)
1 parent 81a1d10 commit 01052a9

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
## StreamChat
7+
### 🐞 Fixed
8+
- Fix `StreamAudioRecorder` not overridable because of init method [#3783](https://github.com/GetStream/stream-chat-swift/pull/3783)
79

810
# [4.85.0](https://github.com/GetStream/stream-chat-swift/releases/tag/4.85.0)
911
_August 13, 2025_

Sources/StreamChat/Audio/AudioRecorder/AudioRecording.swift

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,34 @@ open class StreamAudioRecorder: NSObject, AudioRecording, AVAudioRecorderDelegat
145145
self.init(configuration: .default)
146146
}
147147

148-
/// Initialises a new instance of StreamAudioRecorder
148+
/// Initializes a new `StreamAudioRecorder`.
149+
///
149150
/// - Parameters:
150-
/// - audioSessionConfigurator: The configurator to use to interact with `AVAudioSession`
151-
/// - audioRecorderSettings: The settings that will be used any time a new `AVAudioRecorder` is instantiated
152-
/// - audioFileName: The name of the file that will be used by every `AVAudioRecorder` instance to store in progress recordings.
153-
/// - audioRecorderBaseStorageURL: The path in where we would like to store temporary and finalised recording files.
154-
/// - audioRecorderMeterNormaliser: The normaliser that will be used to transform `AVAudioRecorder's` updated meter values.
155-
public convenience init(
156-
configuration: Configuration
151+
/// - configuration: Configuration for the recorder.
152+
/// - audioSessionConfigurator: The object used to interact with `AVAudioSession`. Defaults to `StreamAudioSessionConfigurator()`.
153+
public init(
154+
configuration: Configuration,
155+
audioSessionConfigurator: AudioSessionConfiguring = StreamAudioSessionConfigurator()
157156
) {
158-
self.init(
159-
configuration: configuration,
160-
audioSessionConfigurator: StreamAudioSessionConfigurator(),
161-
audioRecorderMeterNormaliser: AudioValuePercentageNormaliser(),
162-
appStateObserver: StreamAppStateObserver(),
163-
audioRecorderAVProvider: AVAudioRecorder.init
164-
)
157+
self.audioSessionConfigurator = audioSessionConfigurator
158+
self.configuration = configuration
159+
audioRecorderMeterNormaliser = AudioValuePercentageNormaliser()
160+
appStateObserver = StreamAppStateObserver()
161+
audioRecorderAVProvider = AVAudioRecorder.init
162+
multicastDelegate = .init()
163+
164+
super.init()
165+
166+
setUp()
165167
}
166168

169+
/// Initialises a new instance of StreamAudioRecorder
170+
/// - Parameters:
171+
/// - configuration: Configuration for the recorder.
172+
/// - audioSessionConfigurator: The object used to interact with `AVAudioSession`.
173+
/// - audioRecorderMeterNormaliser: Transforms meter values emitted by `AVAudioRecorder` into a normalised range for UI/logic.
174+
/// - appStateObserver: Observes application lifecycle events that the recorder reacts to.
175+
/// - audioRecorderAVProvider: Factory closure used to construct `AVAudioRecorder` instances for a given file URL and settings dictionary.
167176
internal init(
168177
configuration: Configuration,
169178
audioSessionConfigurator: AudioSessionConfiguring,

0 commit comments

Comments
 (0)