AudioEffectPlayer class

AudioEffectPlayer

Inheritance

Constructors

AudioEffectPlayer()
constructor

Properties

$instance → dynamic
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

$createInstance(List args) → dynamic
Factory method for creating instances
override
$destroy() → void
inherited
$init(List args) → void
inherited
findOverrideIndices(List args, List<List<int>> indicesList) List<int>
查找重载参数下标列表 @desc android 构造函数存在重载 此方法通过实际传入参数与构造函数参数列表集合的比对,来获取当前实际的需要使用的参数列表
inherited
fn2AndroidClass(Function callback, dynamic nativeClass(), String methodName) → dynamic
与 ts runtime 中的 fn2AndroidClass 功能一致 将 Dart 函数转换为 Android 回调类实例供 Android 侧使用
inherited
getDuration(int effectId) Future<int?>
@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}.
inherited
getPosition(int effectId) Future<int?>
@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}.
inherited
getVolume(int effectId) Future<int?>
@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}.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause(int effectId) Future<int?>
@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.
inherited
pauseAll() Future<int?>
@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.
inherited
preload(int effectId, string filePath) Future<int?>
@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}.
inherited
resume(int effectId) Future<int?>
@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.
inherited
resumeAll() Future<int?>
@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.
inherited
setEventHandler(IAudioEffectPlayerEventHandler handler) Future<int?>
@detail api @brief Set the event handler. @param handler See IAudioEffectPlayerEventHandler{@link #IAudioEffectPlayerEventHandler}. @return - 0: Success. - < 0: Failed.
inherited
setPosition(int effectId, int position) Future<int?>
@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}.
inherited
setVolume(int effectId, int volume) Future<int?>
@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}.
inherited
setVolumeAll(int volume) Future<int?>
@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.
inherited
start(int effectId, string filePath, AudioEffectPlayerConfig config) Future<int?>
@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:
inherited
stop(int effectId) Future<int?>
@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.
inherited
stopAll() Future<int?>
@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.
inherited
toString() String
A string representation of this object.
inherited
transformToPlatformConstructorArgs(List args, List<int> indices, Map<String, dynamic> typeMap, Map<String, dynamic> enumMap, Map<String, dynamic> classMap, String platformVar) List
实例化参数处理 将 pack 过后的 enum / class 转成 android / ios 平台侧的 enum / class
inherited
unload(int effectId) Future<int?>
@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}.
inherited
unloadAll() Future<int?>
@detail api @brief Unloads all audio effect files. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
inherited
updateInstance(dynamic instance) → void
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited