Fix sing-to-Blobbi mic access on Android and preview playback on iOS
The sing action uses getUserMedia + MediaRecorder, which in a browser is gated only by the standard web mic prompt. In Capacitor's Android WebView it additionally requires the RECORD_AUDIO permission to be declared in AndroidManifest.xml; without it the WebView rejects with NotAllowedError and no system prompt is ever shown, so tapping record silently fails on the Android app while working fine in the browser. Also add MODIFY_AUDIO_SETTINGS, which some devices require for the echoCancellation / noiseSuppression / autoGainControl constraints that InlineSingCard passes to getUserMedia. Separately, reorder AUDIO_MIME_CANDIDATES to prefer audio/mp4/aac over audio/webm;codecs=opus. iOS WKWebView cannot decode WebM/Opus in an <audio> element, so the recorded Blob's preview URL failed to load on iOS. Android WebView and desktop Chromium both support mp4/aac, so preferring it first is safe cross-platform. This mirrors the ordering already used by useVoiceRecorder.ts.
This commit is contained in:
@@ -58,4 +58,6 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
</manifest>
|
||||
|
||||
@@ -39,10 +39,16 @@ interface InlineSingCardProps {
|
||||
|
||||
// ─── MIME Type Selection ──────────────────────────────────────────────────────
|
||||
|
||||
// Prefer mp4/aac first so the recorded Blob can be decoded by <audio> on
|
||||
// iOS WKWebView (which does not support WebM/Opus playback). Android WebView
|
||||
// and desktop Chromium still support mp4/aac, so putting it first is safe
|
||||
// cross-platform. See also useVoiceRecorder.ts which follows the same order.
|
||||
const AUDIO_MIME_CANDIDATES = [
|
||||
'audio/mp4',
|
||||
'audio/mp4;codecs=aac',
|
||||
'audio/aac',
|
||||
'audio/webm;codecs=opus',
|
||||
'audio/webm',
|
||||
'audio/mp4',
|
||||
'audio/ogg;codecs=opus',
|
||||
'audio/ogg',
|
||||
] as const;
|
||||
|
||||
Reference in New Issue
Block a user