@detail api
@brief Get the duration of the audio effect file.
@param effectId Audio effect ID
@return
- >0: Success, the duration of the audio effect file in milliseconds.
- < 0: failed.
@note Call this API after start{@link #IAudioEffectPlayer#start}.
@detail api
@brief Gets the current position of audio effect file playback.
@param effectId Audio effect ID
@return
- >0: Success, the current progress of audio effect file playback in milliseconds.
- < 0: Failure.
@note
- When playing online files, calling this API may cause a delay in playback.
- Call this API after start{@link #IAudioEffectPlayer#start}.
@detail api
@brief Gets the current volume.
@param effectId Audio effect ID
@return
- >0: Success, the current volume value.
- < 0: Failed.
@note Call this API after start{@link #IAudioEffectPlayer#start}.
@detail api
@brief Pauses the playback of audio effect files.
@param effectId Audio effect ID
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- After calling the start{@link #IAudioEffectPlayer#start} API to start playing the audio effect file, you can pause the audio effect file by calling this API.
- After calling this API to pause the audio effect file, you can call the resume{@link #IAudioEffectPlayer#resume} API to resume playback.
@detail api
@brief Pauses the Playback of all audio effect files.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- After calling the start{@link #IAudioEffectPlayer#start} API to start playing audio effect files, you can pause playing all audio effect files by calling this API.
- After calling this API to pause the playback of all audio effect files, you can call the resumeAll{@link #IAudioEffectPlayer#resumeAll} API to resume all playback.
@detail api
@brief Preloads specified music files into memory to avoid repeated loading when playing the same file frequently and reduce CPU usage.
@param 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 later one will overwrite the previous one.
If you call start{@link #IAudioEffectPlayer#start} first and then call this API with the same ID, the SDK will stop the previous effect and then load the next one, and you will receive onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged}.
After calling this API to preload A.mp3, if you need to call start{@link #IAudioEffectPlayer#start} to play B.mp3 with the same ID, please call unload{@link #IAudioEffectPlayer#unload} to unload A.mp3 first, otherwise SDK will report an error AUDIO_MIXING_ERROR_LOAD_CONFLICT.
@param filePath The filepath of effect file. URI of local file, full path to local file, or path to local files starting with /assets/ are supported.
The length of the pre-loaded file must not exceed 20s.
Audio effect file formats supported are the same as start{@link #IAudioEffectPlayer#start}.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- This API just preloads the specified audio effect file, and only calls the start{@link #IAudioEffectPlayer#start} API to start playing the specified audio effect file.
- The specified audio effect file preloaded by calling this API can be unloaded by unload{@link #IAudioEffectPlayer#unload}.
@detail api
@brief Resumes the playback of audio effect files.
@param effectId Audio effect ID
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note After calling the pause{@link #IAudioEffectPlayer#pause} API to pause the audio effect file, you can resume playback by calling this API.
@detail api
@brief Resumes the playback of all audio effect files.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note After calling the pauseAll{@link #IAudioEffectPlayer#pauseAll} API to pause all the audio effect files being played, you can resume playback by calling this API.
@detail api
@brief Set the event handler.
@param handler See IAudioEffectPlayerEventHandler{@link #IAudioEffectPlayerEventHandler}.
@return
- 0: Success.
- < 0: Failed.
@detail api
@brief Sets the start position of the audio effect file.
@param effectId Audio effect ID
@param position The starting playback position of the audio effect file in milliseconds.
You can get the total duration of the audio effect file by calling getDuration{@link #IAudioEffectPlayer#getDuration}, the value of position should be less than the total duration of the audio effect file.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- When playing online files, calling this API may cause a delay in playback.
- Call this API after start{@link #IAudioEffectPlayer#start}.
@detail api
@brief Adjusts the volume level of a specified audio effect, including audio effect file and PCM effect.
@param effectId Audio effect ID
@param volume The ratio of the volume to the original volume in % with overflow protection. The range is [0, 400] and the recommended range is [0, 100].
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note Call this API after start{@link #IAudioEffectPlayer#start}.
@detail api
@brief Sets the volume of all audio effect, including audio effect files and PCM effects.
@param volume The ratio of the volume to the original volume in % with overflow protection. The range is [0, 400] and the recommended range is [0, 100].
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note This API has a lower priority than setVolume{@link #IAudioEffectPlayer#setVolume}, i.e. the volume of the audio effect set by setVolume{@link #IAudioEffectPlayer#setVolume} is not affected by this API.
@detail api
@brief Starts to play the audio effect file.
This API can be called multiple times with different IDs and filepaths for multiple effects at the same time.
@param 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 onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged}.
@param 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:
@detail api
@brief Stops the playback of audio effect files.
@param effectId Audio effect ID
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- After calling the start{@link #IAudioEffectPlayer#start} API to start playing the audio effect file, you can call this API to stop playing the audio effect file.
- After calling this API to stop playing an audio effect file, the audio effect file will be unloaded automatically.
@detail api
@brief Stops playback of all audio effect files.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- After calling start{@link #IAudioEffectPlayer#start} to start playing audio effect files, you can call this API to stop playing all audio effect files.
- After calling this API to stop playing all audio effect files, the audio effect files will be unloaded automatically.
@detail api
@brief Unloads the specified audio effect file.
@param effectId Audio effect ID
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note Call this API after start{@link #IAudioEffectPlayer#start} or preload{@link #IAudioEffectPlayer#preload}.