diff --git a/pages.json b/pages.json index 51b55cb9aa485c3a619e811e3597bb40669fee93..83a147d4dfda0ca1c34483c76a1b91f4a72661ff 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 d1894fa4fa6e21e881f8f2517ecc0f920ec84c97..0dbb55f5082070a0219acfe55dccd7a3f48d962f 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); },