This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
Page({
onShareAppMessage() {
return {
title: 'Audio',
path: 'packageAPI/pages/audio/audio',
};
},
onReady(e) {
// 使用 xhs.createAudioContext 获取 audio 上下文 context
this.audioCtx = xhs.createAudioContext('myAudio');
this.audioCtx.setSrc('https://dldir1.qq.com/music/release/upload/t_mm_file_publish/2339610.m4a');
this.audioCtx.play();
},
data: {
src: '',
},
audioPlay() {
this.audioCtx.play();
},
audioPause() {
this.audioCtx.pause();
},
audio14() {
this.audioCtx.seek(14);
},
audioStart() {
this.audioCtx.seek(0);
},
});

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "音频",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index"
}
}

View File

@@ -0,0 +1,12 @@
<view class="container">
<showbox title="默认">
<box>
<audio src="{{src}}" id="myAudio" ></audio>
<button type="primary" bindtap="audioPlay">播放</button>
<button type="primary" bindtap="audioPause">暂停</button>
<button type="primary" bindtap="audio14">设置当前播放时间为14秒</button>
<button type="primary" bindtap="audioStart">回到开头</button>
</box>
</showbox>
</view>