setAudioEffectOption
Introduction
Set audio effect options.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | String | true | The unique identifier for task. |
option | JsonObject | true | The audio effect option data. |
option Properties
Property | Type | Required | Description |
---|---|---|---|
src | String | true | The source address to play. Local file paths are supported, but only absolute paths are allowed, relative paths are not supported. |
volume | Number | false | The volume of the audio effect. It takes a value between 0 and 1. Default value is 1.0. |
rate | Number | false | The playback speed of the audio effect. It takes a value between 0.5 and 2. Default value is 1.0. |
priority | Number | false | The 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);
},
});
});
},
});