playForegroundAudio
Introduction
Play audio.
Input Parameters
Attribute | Type | Required | Description |
---|---|---|---|
audioPlayerID | String | Yes | Unique identifier for the audio task. |
success | Function | No | Callback function for a successful call. |
fail | Function | No | Callback function for a failed call. |
complete | Function | No | Callback 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");
},
});
},
});