Open HatimPresswala opened 6 days ago
If I understood correctly, your issue is not on iOS but on safari. Is that‘a right? Did you try with safari on another device (Linux, macOS, windows,…)? I will do some tests tomorrow, recording aac-mp4 on safari.
I am experiencing an issue with audio recording in a Flutter web app using the Flutter Sound package. The audio recording functionality works perfectly on all other devices and browsers, but when I attempt to record audio on iOS browsers (e.g., Safari), the voice is not recognized properly. Additionally, the conversion of the recorded audio to a byte list fails.
Steps to Reproduce :-
Expected Behavior
Actual Behavior
Here is a relevant functions of my implementation for recording audio :-
@override void initState() { _mPlayer!.openPlayer().then((value) { setState(() { _mPlayerIsInited = true; }); });
}
Future openTheRecorder() async {
if (!kIsWeb) {
var status = await Permission.microphone.request();
if (status != PermissionStatus.granted) {
throw RecordingPermissionException('Microphone permission not granted');
}
}
}
// ---------------------- Here is the code for recording and playback -------
void record() async { stopAudio(); await session.setActive(true);
}
void stopRecorder() async { // Stop the recorder and get the Blob URL final blobUrl = await _mRecorder!.stopRecorder();
}
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("Audio Recorder")), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: _isRecording ? null : record, child: Text("Start Recording"), ), ElevatedButton( onPressed: !_isRecording ? null : stopRecorder, child: Text("Stop Recording"), ), if (_audioBytes != null) Text("Audio bytes length: ${_audioBytes!.length}"), ], ), ), ); }
Additional Information
I kindly request assistance in diagnosing and resolving this issue, as it significantly affects the functionality of my Flutter web app on iOS devices. Thank you for your attention to this matter.