Fix silent watch recordings: async session activation, encoder settings, error surfacing
Watch recordings arrived on the phone as 28-byte header-only m4a files (record() reported success but no audio was ever captured). Activate the audio session via watchOS's async activate(options:), drop the .spokenAudio mode experiment, match the phone recorder's proven AAC settings (44.1 kHz / 48 kbps), and surface silent failures: an AVAudioRecorderDelegate catches encode errors mid-take, and a stop-time guard detects a dead header-only file, deletes it, and shows the failure on the watch instead of shipping an unplayable note to the phone. Claude-Session: https://claude.ai/code/session_014esDWi42URLEC6Cj17hGQ3
This commit is contained in:
@@ -21,6 +21,11 @@ final class WatchAppServices {
|
||||
recorder.onInvoluntaryFinish = { [weak self] recording in
|
||||
self?.transfer.enqueue(recording)
|
||||
}
|
||||
// A capture that silently produced no audio (encode error, dead input)
|
||||
// surfaces on screen — there's no console on a real watch.
|
||||
recorder.onCaptureFailure = { [weak self] message in
|
||||
self?.lastError = message
|
||||
}
|
||||
}
|
||||
|
||||
/// Single-button behaviour: start if idle, stop-and-queue if recording.
|
||||
@@ -48,7 +53,7 @@ final class WatchAppServices {
|
||||
return
|
||||
}
|
||||
do {
|
||||
try recorder.startRecording()
|
||||
try await recorder.startRecording()
|
||||
lastError = nil
|
||||
} catch {
|
||||
logger.error("could not start recording: \(error, privacy: .public)")
|
||||
|
||||
Reference in New Issue
Block a user