playEffect method Null safety
- int effectId,
- NERtcAudioEffectOptions options
Play a specified audio effect file
The method plays a specified local or online audio effect file.
- If you call the method and the playback ends, the onAudioEffectFinished playback is triggered.
- Supported audio formats: MP3, M4A, AAC, 3GP, WMA, and WAV. Files that are stored in local storage or URLs are supported.
Call this method after you join a room.
You can call the method multiple times. You can play multiple sound effect files simultaneously by passing different effectId and options. Various sound effects can be mixed. To gain optimal user experience, we recommend you play no more than three sound effect files at the same time.
specified audio effect file effectId. Each audio effect has a unique ID.
option audio effect parameters, such as the type of audio mixing tasks, and path of a mixing audio file. For more information, see NERtcCreateAudioEffectOption。
Return value 0 indicates a successful call.
Implementation
Future<int> playEffect(int effectId, NERtcAudioEffectOptions options) async {
IntValue reply = await _api.playEffect(PlayEffectRequest()
..effectId = effectId
..path = options.path
..loopCount = options.loopCount
..sendEnabled = options.sendEnabled
..sendVolume = options.sendVolume
..playbackEnabled = options.playbackEnabled
..playbackVolume = options.playbackVolume);
return reply.value ?? -1;
}