提交 330acb26 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

iOS|调整 create-inner-audio-context 示例。

上级 91cbbabe
...@@ -1299,7 +1299,7 @@ ...@@ -1299,7 +1299,7 @@
} }
}, },
// #endif // #endif
// #ifdef APP-ANDROID || WEB || MP-WEIXIN // #ifdef APP || WEB || MP-WEIXIN
{ {
"path": "pages/API/create-inner-audio-context/create-inner-audio-context", "path": "pages/API/create-inner-audio-context/create-inner-audio-context",
"group": "1,7,9", "group": "1,7,9",
...@@ -1308,7 +1308,7 @@ ...@@ -1308,7 +1308,7 @@
} }
}, },
// #endif // #endif
// #ifdef APP-ANDROID || WEB || MP-WEIXIN // #ifdef APP || WEB || MP-WEIXIN
{ {
"path": "pages/API/create-inner-audio-context/inner-audio-format", "path": "pages/API/create-inner-audio-context/inner-audio-format",
"style": { "style": {
...@@ -1316,7 +1316,7 @@ ...@@ -1316,7 +1316,7 @@
} }
}, },
// #endif // #endif
// #ifdef APP-ANDROID || WEB || MP-WEIXIN // #ifdef APP || WEB || MP-WEIXIN
{ {
"path": "pages/API/create-inner-audio-context/inner-audio-path", "path": "pages/API/create-inner-audio-context/inner-audio-path",
"style": { "style": {
...@@ -1324,7 +1324,7 @@ ...@@ -1324,7 +1324,7 @@
} }
}, },
// #endif // #endif
// #ifdef APP-ANDROID || WEB || MP-WEIXIN // #ifdef APP || WEB || MP-WEIXIN
{ {
"path": "pages/API/create-inner-audio-context/inner-audio-mult", "path": "pages/API/create-inner-audio-context/inner-audio-mult",
"style": { "style": {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<text class="uni-text-box uni-common-mt">当前音频播放位置(保留小数点后 6 位):{{currentTime}} s</text> <text class="uni-text-box uni-common-mt">当前音频播放位置(保留小数点后 6 位):{{currentTime}} s</text>
<text class="uni-text-box">音频的长度(单位:s):{{duration}} s</text> <text class="uni-text-box">音频的长度(单位:s):{{duration}} s</text>
<text class="uni-text-box">当前是否停止状态:{{isPaused}}</text> <text class="uni-text-box">当前是否停止状态:{{isPaused}}</text>
<text class="uni-text-box">音频缓冲的时间点:{{buffered}}</text> <text class="uni-text-box">音频缓冲的时间点:{{buffered}} s</text>
<text class="uni-text-box">当前音量:{{volume}}</text> <text class="uni-text-box">当前音量:{{volume}}</text>
<!-- 设置音量无效 --> <!-- 设置音量无效 -->
<button plain :disabled="volume == 1" @click="increaseVolume">增加音量</button> <button plain :disabled="volume == 1" @click="increaseVolume">增加音量</button>
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
this.onTimeUpdateCb = (res : any) => { this.onTimeUpdateCb = (res : any) => {
if (this._isChanging) { return; } if (this._isChanging) { return; }
this.currentTime = this._audioContext!.currentTime; this.currentTime = this._audioContext!.currentTime;
this.buffered = this._audioContext!.buffered;
console.log('onTimeUpdateCb', this.currentTime) console.log('onTimeUpdateCb', this.currentTime)
if (this.currentTime > this.buffered) { if (this.currentTime > this.buffered) {
console.log('缓冲不足'); console.log('缓冲不足');
...@@ -250,21 +251,21 @@ ...@@ -250,21 +251,21 @@
}); });
}, },
pause() { pause() {
this._audioContext!.pause();
this._audioContext!.onPause(() => { this._audioContext!.onPause(() => {
console.log('音频暂停事件'); console.log('音频暂停事件');
this.isPaused = true; this.isPaused = true;
}); });
this._audioContext!.pause();
this.isPlaying = false; this.isPlaying = false;
}, },
stop() { stop() {
console.log('stop'); console.log('stop');
this._audioContext!.stop();
this._audioContext!.onStop(() => { this._audioContext!.onStop(() => {
// 第一次点停止时,不触发 // 第一次点停止时,不触发
this.isPaused = true; this.isPaused = true;
console.log('音频停止事件'); console.log('音频停止事件');
}); });
this._audioContext!.stop();
this.isPlaying = false; this.isPlaying = false;
console.log('stop', this.isPaused); console.log('stop', this.isPaused);
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册