From 330acb26e1de398ff7f6857781474ffa998dd356 Mon Sep 17 00:00:00 2001 From: zhaofengliang Date: Thu, 21 Nov 2024 20:17:00 +0800 Subject: [PATCH] =?UTF-8?q?iOS=EF=BD=9C=E8=B0=83=E6=95=B4=20create-inner-a?= =?UTF-8?q?udio-context=20=E7=A4=BA=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 10 +++++----- .../create-inner-audio-context.uvue | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pages.json b/pages.json index 51b55cb9..83a147d4 100644 --- a/pages.json +++ b/pages.json @@ -1299,7 +1299,7 @@ } }, // #endif - // #ifdef APP-ANDROID || WEB || MP-WEIXIN + // #ifdef APP || WEB || MP-WEIXIN { "path": "pages/API/create-inner-audio-context/create-inner-audio-context", "group": "1,7,9", @@ -1308,7 +1308,7 @@ } }, // #endif - // #ifdef APP-ANDROID || WEB || MP-WEIXIN + // #ifdef APP || WEB || MP-WEIXIN { "path": "pages/API/create-inner-audio-context/inner-audio-format", "style": { @@ -1316,7 +1316,7 @@ } }, // #endif - // #ifdef APP-ANDROID || WEB || MP-WEIXIN + // #ifdef APP || WEB || MP-WEIXIN { "path": "pages/API/create-inner-audio-context/inner-audio-path", "style": { @@ -1324,7 +1324,7 @@ } }, // #endif - // #ifdef APP-ANDROID || WEB || MP-WEIXIN + // #ifdef APP || WEB || MP-WEIXIN { "path": "pages/API/create-inner-audio-context/inner-audio-mult", "style": { @@ -3279,4 +3279,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue index d1894fa4..0dbb55f5 100644 --- a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue @@ -14,7 +14,7 @@ 当前音频播放位置(保留小数点后 6 位):{{currentTime}} s 音频的长度(单位:s):{{duration}} s 当前是否停止状态:{{isPaused}} - 音频缓冲的时间点:{{buffered}} + 音频缓冲的时间点:{{buffered}} s 当前音量:{{volume}} @@ -116,6 +116,7 @@ this.onTimeUpdateCb = (res : any) => { if (this._isChanging) { return; } this.currentTime = this._audioContext!.currentTime; + this.buffered = this._audioContext!.buffered; console.log('onTimeUpdateCb', this.currentTime) if (this.currentTime > this.buffered) { console.log('缓冲不足'); @@ -250,21 +251,21 @@ }); }, pause() { - this._audioContext!.pause(); this._audioContext!.onPause(() => { console.log('音频暂停事件'); this.isPaused = true; }); + this._audioContext!.pause(); this.isPlaying = false; }, stop() { console.log('stop'); - this._audioContext!.stop(); this._audioContext!.onStop(() => { // 第一次点停止时,不触发 this.isPaused = true; console.log('音频停止事件'); }); + this._audioContext!.stop(); this.isPlaying = false; console.log('stop', this.isPaused); }, -- GitLab