The τ Recorder API
`openAudioSession()` and `closeAudioSession()`
openAudioSession()
and closeAudioSession()
openAudioSession()
and closeAudioSession()
Dart API: openAudioSession
Dart API: closeAudioSession
A recorder must be opened before used. A recorder correspond to an Audio Session. With other words, you must open the Audio Session before using it. When you have finished with a Recorder, you must close it. With other words, you must close your Audio Session. Opening a recorder takes resources inside the OS. Those resources are freed with the verb closeAudioSession()
.
You MUST ensure that the recorder has been closed when your widget is detached from the UI. Overload your widget's dispose()
method to close the recorder when your widget is disposed. In this way you will reset the player and clean up the device resources, but the recorder will be no longer usable.
You maynot openAudioSession many recorders without releasing them. You will be very bad if you try something like :
openAudioSession()
and closeAudioSession()
return Futures. You may not use your Recorder before the end of the initialization. So probably you will await
the result of openAudioSession()
. This result is the Recorder itself, so that you can collapse instanciation and initialization together with myRecorder = await FlutterSoundPlayer().openAudioSession();
The four optional parameters are used if you want to control the Audio Focus. Please look to FlutterSoundPlayer openAudioSession() to understand the meaning of those parameters
Example:
</div>
Last updated
Was this helpful?