-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Takes time for recorder to start on web #321
Comments
So welcome! Unfortunatly, I don't reproduce the same lag on my machine (either Edge or Firefox). |
Yup, I experience this in release, I have tried it on both Chrome and Edge. Upon clicking the button it takes about 1-2 seconds before the recorder is active. This also occurs when trying to stop the recorder. |
Are you still experiencing this issue with latest record_web 1.1.1? |
In my case the start method does not work on the web because it needs a file and the web does not support this, on the web I used the startStream method receiving pcm16bits and converting to wav with the pcmtowav library |
@Eduardo-Mateus-Da-Costa you can use start method on Web platform, just leave path empty. The blob Url has to be retrieved from stop method. |
You should rely on state stream to properly forward recorder status to UI. Are you experiencing the same with example project? |
I save the audio as a file and allow the user to playback the audio, so I believe I don't need to use stream in this case? correct me if I'm wrong I'm still new to this. I am going to try it with the example project to see if it happens. |
Hello, could you please send your logic that you have implemented to handle the web recording audio? I have implemented it for mobile completely but on the web wasn't successful. Actually I wanted to record and then Parse into XFile?
|
This is a simple example, not complete, starting the recorder can be any way you want, you just need to save the bytes of the stream and convert it to wav later, with the bytes you can see what you want to do, if you want to download it you can turn it into a Blob from these bytes with dart:html, in my case I send the bytes directly to the server import 'package:pcmtowave/convertToWav.dart'; Future<Stream> startStream({ Uint8List? bytes; Future awaitStreamClose() async { Future awaitStreamConvert() async { @OverRide TO STOPstopRecording() |
You don't have to do anything to record WAVE file on web platform. |
This is my first time raising an issue on github.
Package version
record: 5.1.0
record_web: 1.1.0
Environment
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 stopRecording() async {
try {
} 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:
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.
The text was updated successfully, but these errors were encountered: