HomeDocs
Skip to main content

playForegroundAudio

Introduction

Play audio.

Input Parameters

AttributeTypeRequiredDescription
audioPlayerIDStringYesUnique identifier for the audio task.
successFunctionNoCallback function for a successful call.
failFunctionNoCallback function for a failed call.
completeFunctionNoCallback function for the completion of the call (executed for both successful and failed calls).

Usage Example

// pages/index/index.js
Page({
playForegroundAudio() {
dlt.playForegroundAudio({
audioPlayerID: "bgmId",
success: function () {
console.log("success");
},
fail: function () {
console.log("fail");
},
complete: function () {
console.log("complete");
},
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.