playAudioEffect
简介
播放音效
入参
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
id | String | true | 播放该音频任务的唯一标识 |
示例代码
Page({
data: {
id: '1',
},
onReady() {
this.setAudioEffectOption({ src: 'xxxx/xxx.mp3' }).then((res) => {
this.play().then((res) => {
console.log('playAudioEffect===', 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);
},
});
});
},
play() {
return new Promise((resolve, reject) => {
dlt.playAudioEffect({
id: this.id,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
},
});