getAudioEffectOption
Introduction
Get audio effect parameters.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | String | true | The unique identifier for task. |
optionName | String | true | The audio parameter to get. |
Possible optionName Values
Parameter | Return Type | Description |
---|---|---|
src | String | Source address for playback; local file paths only support absolute paths, not relative paths. |
volume | Number | Volume; range from 0 to 1 (default: 1.0f). |
rate | Number | Playback speed; range from 0.5 to 2 (default: 1.0f). |
priority | Number | Playback priority, with 0 being the lowest; the higher the number, the higher the priority (default: 0). |
Example
Page({
data: {
id: '1',
},
onReady() {
this.setAudioEffectOption({ src: 'xxxx/xxx.mp3' }).then((res) => {
this.getAudioEffectOption('src').then((res) => {
console.log('getAudioEffectOption===', 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);
},
});
});
},
getAudioEffectOption(optionName) {
return new Promise((resolve, reject) => {
dlt.getAudioEffectOption({
id: this.id,
optionName,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
},
});