9***@qq.com
9***@qq.com
  • 发布:2023-11-14 19:21
  • 更新:2023-11-14 20:03
  • 阅读:318

【报Bug】uni.createInnerAudioContext()音频播放设置循环播放后,中间会卡顿一下

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX类型: 正式

HBuilderX版本号: 3.96

手机系统: 全部

手机厂商: 苹果

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: https://apps.apple.com/cn/app/%E6%9C%A8%E9%B1%BC%E4%B8%93%E6%B3%A8-peacefocus%E6%9E%81%E7%AE%80%E7%95%AA%E8%8C%84%E9%92%9F%E8%87%AA%E5%BE%8B%E8%80%83%E7%A0%94%E5%AD%A6%E9%9C%B8%E5%BF%85%E5%A4%87/id6466410647

测试过的手机:

iphone 15 pro/11/13/12promax:ios卡顿明显,大概半秒左右, vivo s7/huawei nova7/ 安卓卡顿不明显,但是也有100毫秒左右,不同手机表现不一样

示例代码:
startMIc() {  

                this.whiteAudio = uni.createInnerAudioContext();  
                this.woodAudio = uni.createInnerAudioContext();  
                let soundMic = uni.getStorageSync('micValue');  
                if (soundMic == '') {  

                    console.log('内存没存值')  
                    //初始化  
                    let micValue = {  
                        whiteNoise: '',  
                        micMode: '',  
                        woodMic: ''  
                    };  
                    let isMute = '../../static/noise/yichichunjiulv.mp3'; //初始白噪音路径  
                    let isWood = '../../static/noise/moren.mp3';  
                    micValue.micMode = 1;  
                    micValue.whiteNoise = isMute;  
                    micValue.woodMic = isWood;  
                    this.whiteAudio.src = isMute;  
                    this.woodAudio.src = isWood;  
                    uni.setStorageSync('micValue', micValue);  
                } else {  
                    this.whiteAudio.src = soundMic.whiteNoise;  
                    this.woodAudio.src = soundMic.woodMic;  
                }  
                this.whiteAudio.loop = true;  
                if (uni.getSystemInfoSync().platform != "ios") {  
                    this.whiteAudio._options.sessionCategory = "ambient";  
                    this.woodAudio._options.sessionCategory = "ambient";  
                }  
                this.whiteAudio.autoplay = true;  
                this.whiteAudio.play();  
                //木鱼  
                this.woodAudio.loop = true;  
                this.woodAudio.autoplay = true;  
                this.woodAudio.play();  
                console.log(this.woodAudio)  
            },

操作步骤:

开始播放音乐,app内敲木鱼的声音30s重复一次,但是循环时中间会卡顿,导致敲木鱼节奏会变化,体验很差

预期结果:

循环播放不卡顿

实际结果:

循环播放中间会卡顿

bug描述:

2023-11-14 19:21 负责人:无 分享
已邀请:
9***@qq.com

9***@qq.com (作者)

安卓下载链接:https://sj.qq.com/appdetail/com.dolphinflow.focus

要回复问题请先登录注册