record
record copied to clipboard
Takes time for recorder to start on web
This is my first time raising an issue on github.
Package version record: 5.1.0 record_web: 1.1.0
Environment
- OS: Windows - Web App
- Chrome
When I click on the button to record, It takes about 1-2 seconds for it to start. Is this the intended behavior or is there something that i'm doing wrong.
I have a record button that calls start.
Future<void> startRecording() async { try { if (await widget._recorder.hasPermission()) { await widget._recorder.start( const RecordConfig(encoder: AudioEncoder.opus), path: '', ); setState(() { _isRecording = true; }); } } catch (e) { if (kDebugMode) { print('cannot record'); } } }
the set state sets the button color when _isrecording is true and also sets the function to stoprecording.
this is my stop record function
``
Future
final path = await widget._recorder.stop();
_audioPath = path!;
setState(() {
_isRecording = false;
});
} catch (e) { if (kDebugMode) { print('cannot stop'); print(e); } } } `` this is my button code ( i am not using elevated button as it caused some problems without my app layout.)
GestureDetector( onTap: () { if (!_isRecording) { startRecording(); } else { stopRecording(); } }, child: Container( margin: const EdgeInsets.all(12), decoration: const BoxDecoration( image: DecorationImage( image: AssetImage(recordIcon), ), ), ), ),
Add your record configuration RecordConfig(encoder: AudioEncoder.opus)
To Reproduce
Steps to reproduce the behavior:
- Click on record button
- recorder takes 1-2 secs to start
Expected behavior it should have a faster response time so that the app feels responsive. If 1-2sec is the best that can be achieved. I will find a UI method to let the user know that they have to wait.