start abstract method
- int effectId, {
- required String filePath,
- AudioEffectPlayerConfig config = const AudioEffectPlayerConfig(),
Starts to play the audio effect file.
This API can be called multiple times with different IDs and file paths for multiple effects at the same time.
effectId
: Audio effect ID. Used for identifying the audio effect, please ensure that the audio effect ID is unique.
If this API is called repeatedly with the same ID, the previous effect will stop and the next effect will start, and you'll receive RTCAudioEffectPlayerEventHandler.onAudioEffectPlayerStateChanged.
filePath
: Audio effect file paths.
URL of online file, URI of local file, full path to local file, or path to local file starting with /assets/
are supported. For URL of online file, only the https protocol is supported.
Recommended sample rate for audio effect files: 8KHz、16KHz、22.05KHz、44.1KHz、48KHz.
Local audio effect file formats supported by different platforms:
mp3 | mp4 | aac | m4a | 3gp | wav | ogg | ts | wma | |
---|---|---|---|---|---|---|---|---|---|
Android | Y | Y | Y | Y | Y | Y | Y | ||
iOS/macOS | Y | Y | Y | Y | Y | Y | |||
Windows | Y | Y | Y | Y | Y | Y | Y | Y |
mp3 | mp4 | aac | m4a | 3gp | wav | ogg | ts | wma | |
---|---|---|---|---|---|---|---|---|---|
Android | Y | Y | Y | Y | Y | ||||
iOS/macOS | Y | Y | Y | Y | |||||
Windows | Y | Y | Y | Y | Y | Y | Y |
config
: See AudioEffectPlayerConfig{@link #AudioEffectPlayerConfig}.
Return value:
0
: Success.<0
: Failure.
Notes:
- If the file has been loaded into memory via RTCAudioEffectPlayer.preload, make sure that the ID here is the same as the ID set by RTCAudioEffectPlayer.preload.
- After starting to play an audio effect file, you can call the RTCAudioEffectPlayer.stop API to stop playing the audio effect file.
Implementation
Future<int?> start(
int effectId, {
required String filePath,
AudioEffectPlayerConfig config = const AudioEffectPlayerConfig(),
});