InnerAudioContext.offCanplay收藏我的收藏
收藏
我的收藏取消 监听 canplay 事件。
语法
InnerAudioContext.offCanplay(callback)
参数说明
Function callback
代码示例
预期表现:音频可以播放时没有弹窗提示。
const dataUrl = "https://someaudiourl"; // 合法的音频资源地址
const innerAudioContext = tt.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = dataUrl;
innerAudioContext.onError((error) => {
tt.showModal({
title: "播放出错",
content: `详细错误信息:${error.errMsg}`,
});
console.log("播放出错", error);
});
function oncanplay() {
tt.showToast({ title: "可以播放了" });
}
innerAudioContext.onCanplay(oncanplay);
innerAudioContext.offCanplay(oncanplay);
Bug & Tip
暂无。