HomeDocs
Skip to main content

setAudioEffectOption

Introduction

Set audio effect options.

Parameters

ParameterTypeRequiredDescription
idStringtrueThe unique identifier for task.
optionJsonObjecttrueThe audio effect option data.

option Properties

PropertyTypeRequiredDescription
srcStringtrueThe source address to play. Local file paths are supported, but only absolute paths are allowed, relative paths are not supported.
volumeNumberfalseThe volume of the audio effect. It takes a value between 0 and 1. Default value is 1.0.
rateNumberfalseThe playback speed of the audio effect. It takes a value between 0.5 and 2. Default value is 1.0.
priorityNumberfalseThe playback priority of the audio effect. 0 is the lowest priority, and a higher value indicates a higher priority. Default value is 0.

Example

Page({
data: {
id: '1',
},
onReady() {
this.setAudioEffectOption({ src: 'xxxx/xxx.mp3' }).then((res) => {
console.log('setAudioEffectOption===', res);
});
},
setAudioEffectOption(option) {
return new Promise((resolve, reject) => {
dlt.setAudioEffectOption({
id: this.id,
option: JSON.stringify(option),
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.