HomeDocs
跳到主要内容

playAudioEffect

简介

播放音效

入参

参数类型是否必填说明
idStringtrue播放该音频任务的唯一标识

示例代码

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);
},
});
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.