Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
isEncoderSupported()
isEncoderSupported()
Dart API: isEncoderSupported
This verb is useful to know if a particular codec is supported on the current platform; Return a Future.
Example:
</div>
setSubscriptionDuration()
setSubscriptionDuration()
Dart API: setSubscriptionDuration
This verb is used to change the default interval between two post on the "Update Progress" stream. (The default interval is 0 (zero) which means "NO post")
Example:
</div>
pauseRecorder()
Dart API: pauseRecorder
On Android this API verb needs al least SDK-24. An exception is thrown if the Recorder is not currently recording.
Example:
</div>
`recorderState`, `isRecording`, `isPaused`, `isStopped`.
recorderState
, isRecording
, isPaused
, isStopped
Dart API: recorderState
Dart API: isRecording
Dart API: isPaused
Dart API: isStopped
This four attributs is used when the app wants to get the current Audio State of the recorder.
recorderState
is an attribut which can have the following values :
isStopped /// Recorder is stopped
isRecording /// Recorder is recording
isPaused /// Recorder is paused
isRecording is a boolean attribut which is true
when the recorder is in the "Recording" mode.
isPaused is a boolean atrribut which is true
when the recorder is in the "Paused" mode.
isStopped is a boolean atrribut which is true
when the recorder is in the "Stopped" mode.
Example:
</div>
setAudioFocus()
setAudioFocus()
Dart API: setAudioFocus
focus:
parameter possible values areAudioFocus.requestFocus (request focus, but do not do anything special with others App)
AudioFocus.requestFocusAndStopOthers (your app will have exclusive use of the output audio)
AudioFocus.requestFocusAndDuckOthers (if another App like Spotify use the output audio, its volume will be lowered)
AudioFocus.requestFocusAndKeepOthers (your App will play sound above others App)
AudioFocus.requestFocusAndInterruptSpokenAudioAndMixWithOthers
AudioFocus.requestFocusTransient (for Android)
AudioFocus.requestFocusTransientExclusive (for Android)
AudioFocus.abandonFocus (Your App will not have anymore the audio focus)
Please look to openAudioSession() to understand the meaning of the other parameters
Example:
</div>
onProgress
onProgress
Dart API: onProgress
The attribut onProgress
is a stream on which FlutterSound will post the recorder progression. You may listen to this Stream to have feedback on the current recording.
Example:
</div>
startRecorder()
startRecorder()
Dart API: startRecorder
You use startRecorder()
to start recording in an open session. startRecorder()
has the destination file path as parameter. It has also 7 optional parameters to specify :
codec: The codec to be used. Please refer to the Codec compatibility Table to know which codecs are currently supported.
toFile: a path to the file being recorded
toStream: if you want to record to a Dart Stream. Please look to the following notice. This new functionnality needs, at least, Android SDK >= 21 (23 is better)
sampleRate: The sample rate in Hertz
numChannels: The number of channels (1=monophony, 2=stereophony)
bitRate: The bit rate in Hertz
audioSource : possible value is :
defaultSource
microphone
voiceDownlink (if someone can explain me what it is, I will be grateful ;-) )
path_provider can be useful if you want to get access to some directories on your device.
Flutter Sound does not take care of the recording permission. It is the App responsability to check or require the Recording permission. Permission_handler is probably useful to do that.
Example:
</div>
`openAudioSession()` and `closeAudioSession()`
openAudioSession()
and closeAudioSession()
Dart API:
Dart API:
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();
Example:
</div>
The four optional parameters are used if you want to control the Audio Focus. Please look to to understand the meaning of those parameters