benz-amr-recorder icon indicating copy to clipboard operation
benz-amr-recorder copied to clipboard

在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止

Open LuffyXiao6 opened this issue 3 years ago • 12 comments

LuffyXiao6 avatar Aug 27 '20 03:08 LuffyXiao6

遇到了同样的问题,解决了吗?

github-yitao avatar Sep 25 '20 02:09 github-yitao

没有,暂时没头绪。

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: github-yitao [email protected] 发送时间: Friday, September 25, 2020 10:01:16 AM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Author [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44)

遇到了同样的问题,解决了吗?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/BenzLeung/benz-amr-recorder/issues/44#issuecomment-698678226, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHOGIN5657BNDEUOJJTSHP2WZANCNFSM4QMQEFLA.

LuffyXiao6 avatar Sep 25 '20 08:09 LuffyXiao6

应该是源码有问题,要改源码

github-yitao avatar Sep 30 '20 07:09 github-yitao

哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试……

@LuffyXiao6 @github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。

BenzLeung avatar Oct 09 '20 06:10 BenzLeung

慢慢来吧,目前也不是百分百出现,但几率也算蛮大。

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: BenzLeung [email protected] 发送时间: Friday, October 9, 2020 2:25:00 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44)

哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试……

@LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/BenzLeung/benz-amr-recorder/issues/44#issuecomment-705994695, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHNCRJ6SNEQAY6XAYYLSJ2UDZANCNFSM4QMQEFLA.

LuffyXiao6 avatar Oct 09 '20 06:10 LuffyXiao6

哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试……

@LuffyXiao6 @github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。

也复现了这个问题,查了好久源码,目前这样解决了,可以测试

ETTTTT avatar Oct 27 '20 05:10 ETTTTT

腻害腻害,我找时间测测。

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: ETTTTT [email protected] 发送时间: Tuesday, October 27, 2020 1:21:59 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44)

哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试……

@LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。

也复现了这个问题,查了好久源码,目前这样解决了,可以测试

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/BenzLeung/benz-amr-recorder/issues/44#issuecomment-716989382, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHLPTNQQW2UURUKII5DSMZKHPANCNFSM4QMQEFLA.

LuffyXiao6 avatar Oct 27 '20 07:10 LuffyXiao6

腻害腻害,我找时间测测。 获取 Outlook for iOShttps://aka.ms/o0ukef ________________________________ 发件人: ETTTTT [email protected] 发送时间: Tuesday, October 27, 2020 1:21:59 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44) 哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试…… @LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。 也复现了这个问题,查了好久源码,目前这样解决了,可以测试 ― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHLPTNQQW2UURUKII5DSMZKHPANCNFSM4QMQEFLA.

这样操作之后会有另外一个问题, 参考文章:

  • 1:https://www.mdeditor.tw/pl/2Baa(直接定位到’safari下多次调用audioCtx.xxx后报错null is not an object‘这里查看详细介绍)
  • 2:https://stackoverflow.com/questions/45528945/audiocontext-samplerate-returning-null-after-being-read-8-times 优化后的代码
  constructor(){
        if (AudioContext) {
            if(ctx) {
                ctx.close()
                ctx = null
            }
            ctx = new AudioContext();
        } else {
            isSupport = false;
        }
    }

ETTTTT avatar Oct 27 '20 09:10 ETTTTT

腻害腻害,我找时间测测。 获取 Outlook for iOShttps://aka.ms/o0ukef ________________________________ 发件人: ETTTTT [email protected] 发送时间: Tuesday, October 27, 2020 1:21:59 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44) 哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试…… @LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。 也复现了这个问题,查了好久源码,目前这样解决了,可以测试 ― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHLPTNQQW2UURUKII5DSMZKHPANCNFSM4QMQEFLA.

这样操作之后会有另外一个问题, 参考文章:

  constructor(){
        if (AudioContext) {
            if(ctx) {
                ctx.close()
                ctx = null
            }
            ctx = new AudioContext();
        } else {
            isSupport = false;
        }
    }

我要测试这个改动有没有效果,是不是要把src下的三个文件,拷贝到自己项目下,然后引用 我试了下,一触发play就会报错” ReferenceError: Can't find variable: _imul2 “。

LuffyXiao6 avatar Oct 28 '20 08:10 LuffyXiao6

是可以先把src下面的那几个文件复制到你自己的目录下,引入到自己的项目中让其跑起来,后续测试没问题了之后,你在把改好的文件打包成压缩包,在你的项目中引入压缩包即可, 最终我们经过测试,IOS的解决方案是这样的: 作者之前代码

修改之后的代码:

经过我们测试发现,IOS播放一旦暂停,或者播放完毕,切到后台,在切回来的时候,AudioContext就已经失效了,所以我们的操作是把resetAudioContext放在window下面,等在IOS从后台切回到我们页面的时候,重新生成一个AudioContext即可,前提得先关闭之前创建的那个失效的AudioContext。目前我们测试环境没问题了

------------------ 原始邮件 ------------------ 发件人: "LuffyXiao6"<[email protected]>; 发送时间: 2020年10月28日(星期三) 下午4:04 收件人: "BenzLeung/benz-amr-recorder"<[email protected]>; 抄送: "闭眼呼吸ヽ微笑掩饰悲伤。"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44)

腻害腻害,我找时间测测。 获取 Outlook for iOShttps://aka.ms/o0ukef … ________________________________ 发件人: ETTTTT [email protected] 发送时间: Tuesday, October 27, 2020 1:21:59 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44) 哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试…… @LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。 也复现了这个问题,查了好久源码,目前这样解决了,可以测试 ― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHLPTNQQW2UURUKII5DSMZKHPANCNFSM4QMQEFLA.

这样操作之后会有另外一个问题, 参考文章:

1:https://www.mdeditor.tw/pl/2Baa(直接定位到’safari下多次调用audioCtx.xxx后报错null is not an object‘这里查看详细介绍)

2:https://stackoverflow.com/questions/45528945/audiocontext-samplerate-returning-null-after-being-read-8-times 优化后的代码 constructor(){ if (AudioContext) { if(ctx) { ctx.close() ctx = null } ctx = new AudioContext(); } else { isSupport = false; } }
我要测试这个改动有没有效果,是不是要把src下的三个文件,拷贝到自己项目下,然后引用 我试了下,一触发play就会报错” ReferenceError: Can't find variable: _imul2 “。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ETTTTT avatar Oct 28 '20 09:10 ETTTTT

是可以先把src下面的那几个文件复制到你自己的目录下,引入到自己的项目中让其跑起来,后续测试没问题了之后,你在把改好的文件打包成压缩包,在你的项目中引入压缩包即可, 最终我们经过测试,IOS的解决方案是这样的: 作者之前代码 修改之后的代码: 经过我们测试发现,IOS播放一旦暂停,或者播放完毕,切到后台,在切回来的时候,AudioContext就已经失效了,所以我们的操作是把resetAudioContext放在window下面,等在IOS从后台切回到我们页面的时候,重新生成一个AudioContext即可,前提得先关闭之前创建的那个失效的AudioContext。目前我们测试环境没问题了 ------------------ 原始邮件 ------------------ 发件人: "LuffyXiao6"<[email protected]>; 发送时间: 2020年10月28日(星期三) 下午4:04 收件人: "BenzLeung/benz-amr-recorder"<[email protected]>; 抄送: "闭眼呼吸ヽ微笑掩饰悲伤。"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44) 腻害腻害,我找时间测测。 获取 Outlook for iOShttps://aka.ms/o0ukef … ________________________________ 发件人: ETTTTT [email protected] 发送时间: Tuesday, October 27, 2020 1:21:59 PM 收件人: BenzLeung/benz-amr-recorder [email protected] 抄送: LuffyXiao6 [email protected]; Mention [email protected] 主题: Re: [BenzLeung/benz-amr-recorder] 在ios上,正常能播放,但是一旦手机去了一次后台,再回来,就播放没有声音,而且一直不停止 (#44) 哎,苦恼了,目前我暂时不开发移动端应用了,所以手头上没有ios机器用于测试…… @LuffyXiao6https://github.com/LuffyXiao6 @github-yitaohttps://github.com/github-yitao 如果你们有解决方案或者思路的话记得告知我,或者欢迎给我 pull request。 也复现了这个问题,查了好久源码,目前这样解决了,可以测试 ― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3SZHLPTNQQW2UURUKII5DSMZKHPANCNFSM4QMQEFLA. 这样操作之后会有另外一个问题, 参考文章: 1:https://www.mdeditor.tw/pl/2Baa(直接定位到’safari下多次调用audioCtx.xxx后报错null is not an object‘这里查看详细介绍) 2:https://stackoverflow.com/questions/45528945/audiocontext-samplerate-returning-null-after-being-read-8-times 优化后的代码 constructor(){ if (AudioContext) { if(ctx) { ctx.close() ctx = null } ctx = new AudioContext(); } else { isSupport = false; } } 我要测试这个改动有没有效果,是不是要把src下的三个文件,拷贝到自己项目下,然后引用 我试了下,一触发play就会报错” ReferenceError: Can't find variable: _imul2 “。 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

好吧,你们测试没问题就行,等着你们发新版本了我再试试。

LuffyXiao6 avatar Oct 29 '20 00:10 LuffyXiao6

@ETTTTT @LuffyXiao6 @github-yitao 各位,有位热心git友 @jenny-wang 貌似提了PR修复了这个问题,现已发布v1.1.3,你们可抽空试一试?

BenzLeung avatar Jan 22 '21 02:01 BenzLeung