HomeDocs
Skip to main content

getAudioEffectOption

Introduction​

Get audio effect parameters.

Parameters​

ParameterTypeRequiredDescription
idStringtrueThe unique identifier for task.
optionNameStringtrueThe audio parameter to get.

Possible optionName Values​

ParameterReturn TypeDescription
srcStringSource address for playback; local file paths only support absolute paths, not relative paths.
volumeNumberVolume; range from 0 to 1 (default: 1.0f).
rateNumberPlayback speed; range from 0.5 to 2 (default: 1.0f).
priorityNumberPlayback 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);
},
});
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_private.mi@dlightek.com © 2024 MiniApp. All Rights Reserved.