InnerAudioContext.seek收藏我的收藏
收藏
我的收藏基础库 1.0.0 开始支持本方法。
跳转到指定位置播放。
语法
InnerAudioContext.seek(options)
参数说明
Number options
含义:跳转的时间(单位:s)。
代码示例
预期表现:播放 1s 后跳转到音频 3s 的位置继续播放。
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);
});
setTimeout(() => innerAudioContext.seek(3), 1000);
Bug & Tip
暂无。