1***@qq.com
1***@qq.com
  • 发布:2019-05-06 15:03
  • 更新:2024-10-19 13:04
  • 阅读:7991

uniapp音频组件在iOS不能播放 createInnerAudioContext

分类:HBuilderX

使用uni.createInnerAudioContext(),播放语音

1.在windows版本的hbuiderx 1.9.3打包的iOS可以播放音频,但是报以下错误信息,并且循环播放,安卓正常播放
[ERROR] : appServiceSDKScriptError
14:54:53.714 Can't find variable: nan;at api onAudioStateChange callback function
14:54:53.714 eval code
14:54:53.714 eval@[native code]
14:54:53.715 execSync
14:54:53.715 execSync2
14:54:53.715 getDuration
14:54:53.715 getAudioState@app-service.js:3:75645
14:54:53.715 Un@app-service.js:3:77415
14:54:53.716 app-service.js:4:844
14:54:53.716 invoke@app-service.js:4:889
14:54:53.716 invoke@app-service.js:4:105643
14:54:53.716 X@app-service.js:4:163217
14:54:53.717 app-service.js:4:170670
14:54:53.717 hc@app-service.js:4:310445
14:54:53.717 app-service.js:4:311579
14:54:53.718 app-service.js:4:164893
14:54:53.718 subscribeHandler@app-service.js:4:1563
14:54:53.718 P@app-service.js:3:5118
14:54:53.718 callbackFromNative
14:54:53.719 nativeEval
14:54:53.719 global code
14:54:53.768 [ERROR] : appServiceSDKScriptError
14:54:53.769 Can't find variable: nan;at api onAudioStateChange callback function
14:54:53.769 eval code
14:54:53.770 eval@[native code]
14:54:53.770 execSync
14:54:53.771 execSync2
14:54:53.772 getDuration
14:54:53.772 getAudioState@app-service.js:3:75645
14:54:53.773 Un@app-service.js:3:77415
14:54:53.773 app-service.js:4:844
14:54:53.773 invoke@app-service.js:4:889
14:54:53.773 invoke@app-service.js:4:105643
14:54:53.774 X@app-service.js:4:163217
14:54:53.774 app-service.js:4:170670
14:54:53.774 hc@app-service.js:4:310445
14:54:53.774 app-service.js:4:311579
14:54:53.775 app-service.js:4:164893
14:54:53.775 subscribeHandler@app-service.js:4:1563
14:54:53.775 P@app-service.js:3:5118
14:54:53.775 callbackFromNative
14:54:53.776 nativeEval
14:54:53.776 global code
14:54:53.776 [ERROR] : appServiceSDKScriptError
14:54:53.777 Can't find variable: nan;at api onAudioStateChange callback function
14:54:53.777 eval code
14:54:53.777 eval@[native code]
14:54:53.778 execSync
14:54:53.778 execSync2
14:54:53.778 getDuration
14:54:53.779 getAudioState@app-service.js:3:75645
14:54:53.779 Un@app-service.js:3:77415
14:54:53.779 app-service.js:4:844
14:54:53.779 invoke@app-service.js

2.在Mac版的hbuiderx 1.9.4版本中,iOS不能正常语音播放,但是打印播放结束的回调,没有报错,安卓可以正常播放

2019-05-06 15:03 负责人:无 分享
已邀请:
ZGH0709

ZGH0709

测试Bug未复现,你手机系统版本是多少?另外可以升级下 hbuilderx 的版本测试是否仍有问题。如果仍有问题,请提供dmeo。

  • 1***@qq.com (作者)

    iOS12.2,苹果5s

    2019-05-14 14:22

q***@163.com

q***@163.com

01:12:49.647 [ERROR] : appServiceSDKScriptError
01:12:49.647 undefined is not an object (evaluating 'n.src');at api onAudioStateChange callback function
01:12:49.648 getAudioState@app-service.js:3:75555
01:12:49.648 Un@app-service.js:3:77415
01:12:49.648 app-service.js:4:844
01:12:49.648 invoke@app-service.js:4:889
01:12:49.648 invoke@app-service.js:4:105643
01:12:49.648 X@app-service.js:4:163217
01:12:49.648 app-service.js:4:170670
01:12:49.648 hc@app-service.js:4:310445
01:12:49.648 app-service.js:4:311579
01:12:49.648 app-service.js:4:164893
01:12:49.648 subscribeHandler@app-service.js:4:1563
01:12:49.648 P@app-service.js:3:5118
01:12:49.648 callbackFromNative
01:12:49.648 nativeEval
01:12:49.648 global code

我的ios12.2的版本,hx是1.9.4版本,报这个错

q***@163.com

q***@163.com

我的还会报这个错,。。。
音频组件的 onError事件里
msg:MediaError; errCode:-4

ZGH0709

ZGH0709

升级至最新版本 HBuilderX, 测试是否正常。如果仍有该问题,请提供系统版本,可复现 demo。

  • 今天回复我了吗

    2.1.4 alp版本,

    appServiceSDKScriptError

    09:50:39.189 Can't find variable: nan;at api onAudioStateChange callback function

    09:50:39.189 eval code

    09:50:39.189 eval@[native code]

    09:50:39.189 execSync

    09:50:39.189 execSync2

    09:50:39.189 getDuration

    09:50:39.189 getAudioState@app-service.js:2:81027

    09:50:39.189 zn@app-service.js:2:82739

    09:50:39.189 app-service.js:3:844

    09:50:39.189 invoke@app-service.js:3:889

    09:50:39.189 invoke@app-service.js:3:104451

    09:50:39.189 X@app-service.js:3:162045

    09:50:39.189 app-service.js:3:169498

    09:50:39.189 hc@app-service.js:3:310066

    09:50:39.189 app-service.js:3:311200

    09:50:39.189 app-service.js:3:163721

    09:50:39.190 subscribeHandler@app-service.js:3:1563

    09:50:39.190 P@app-service.js:2:5382

    09:50:39.190 app-service.js:2:80777

    09:50:39.190 callbackFromNative

    09:50:39.190 global code ERROR

    09:50:39.210 appServiceSDKScriptError

    09:50:39.210 Can't find variable: nan;at api onAudioStateChange callback function

    09:50:39.210 eval code

    09:50:39.210 eval@[native code]

    09:50:39.210 execSync

    09:50:39.210 execSync2

    09:50:39.210 getDuration

    09:50:39.210 getAudioState@app-service.js:2:81027

    09:50:39.210 zn@app-service.js:2:82739

    09:50:39.210 app-service.js:3:844

    09:50:39.210 invoke@app-service.js:3:889

    09:50:39.210 invoke@app-service.js:3:104451

    09:50:39.210 X@app-service.js:3:162045

    09:50:39.210 app-service.js:3:169498

    09:50:39.210 hc@app-service.js:3:310066

    09:50:39.210 app-service.js:3:311200

    09:50:39.210 app-service.js:3:163721

    09:50:39.210 subscribeHandler@app-service.js:3:1563

    09:50:39.210 P@app-service.js:2:5382

    09:50:39.210 app-service.js:2:80777

    09:50:39.211 callbackFromNative

    09:50:39.211 global code
    ERROR

    2019-08-07 09:54

今天回复我了吗

今天回复我了吗 - uniapp 粉丝条

2.1.4 alp版本,
appServiceSDKScriptError
09:50:39.189 Can't find variable: nan;at api onAudioStateChange callback function
海会出现,请问解决了吗

Junn

Junn - 面向金钱编程

HBuilder X 2.2.2.20190816 H5出现ios不能播放的问题 , android 能播放

Junn

Junn - 面向金钱编程

HBuilder X 2.2.2.20190816 H5出现ios不能播放的问题 , android 能播放

Junn

Junn - 面向金钱编程

HBuilder X 2.2.2.20190816 H5 ios报 Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

PurityChan

PurityChan

遇到同样的问题,2.3.3,目前最新的版本,测试机iPhone7 ios12.1.3,Android很好,ios不能愉快播放, {"errMsg":"MediaError","errCode":-5},用了https://ext.dcloud.net.cn/plugin?id=182 百度语音合成插件,用他的例子 报你们上面一样的错,

  • 8***@qq.com

    我也遇到了同样的问题,然后用downloadFile下载下来的临时文件路径依旧不行

    2023-06-19 16:06

  • 求了个解

    回复 8***@qq.com: 你这个报错解决了吗

    2024-04-25 18:34

  • 1***@qq.com

    兄弟,这个问题有解决方案吗

    2024-06-24 11:48

3***@qq.com

3***@qq.com

ios 下修改volume 后,重头开始播放,安卓正常.有没有遇到这个的

3***@qq.com

3***@qq.com

2.3.3版了IOS12.1还是报这个错 ,怎么那么久还没修复好呢?
appServiceSDKScriptError
20:57:47.878 Can't find variable: nan;at api onAudioStateChange callback function
20:57:47.878 eval code
20:57:47.878 eval@[native code]
20:57:47.878 execSync
20:57:47.878 execSync2
20:57:47.878 getDuration
20:57:47.878 getAudioState@app-service.js:2:47177
20:57:47.878 Xn@app-service.js:2:83674
20:57:47.878 app-service.js:3:1445
20:57:47.879 invoke@app-service.js:3:1490
20:57:47.879 invoke@app-service.js:3:105099
20:57:47.879 X@app-service.js:3:162705
20:57:47.879 app-service.js:3:170158
20:57:47.879 hc@app-service.js:3:310862
20:57:47.879 app-service.js:3:311996
20:57:47.879 app-service.js:3:164381
20:57:47.879 subscribeHandler@app-service.js:3:2164
20:57:47.879 C@app-service.js:2:4946
20:57:47.879 app-service.js:2:46927
20:57:47.879 callbackFromNative
20:57:47.879 global code __ERROR

JohnsonCheng

JohnsonCheng

楼主解决了吗?我也遇到同样的问题,安卓和H5都可以,就是IOS不行

  • 3***@qq.com

    好像是获取的时长不成功,又用了。做下处理就可 以了

    2019-12-22 23:20

  • 匣与桔

    回复 3***@qq.com: 楼主怎么解决的,大概是同样的问题

    2020-11-12 17:33

  • JohnsonCheng

    回复 匣与桔: 我的问题是特殊字符引起的,将URL做一个encodeURI编码就可以了

    2020-11-13 19:04

以何为家

以何为家 - 这个人很烂,暂无介绍

http://hkscjd.clappyun.com/_Framework/GetFile/c28bfbd1-7f01-4a74-bab3-0a97c223a60b
这种路径iOS不能播放,Android能播放,有解决办法吗请问

  • JohnsonCheng

    尝试一下做一个编码,this.innerAudioContext.src = encodeURI(audioUrl);

    2020-11-13 19:02

  • 2***@qq.com

    请问您解决了吗,这种路径在IOS端播放的问题

    2021-12-01 14:18

1***@qq.com

1***@qq.com

在ios大部分设置了audio.autoplay = true;是不够的,达不到自动播放的效果;还需要增加audio.play();最好每次修改src或播放时都加一下;

2***@qq.com

2***@qq.com

2021年了 这个bug还没修复吗
ios中“ https://cos.ap-shanghai.myqcloud.com/6126-shanghai-007-shared-05-1256635546/f359-1400565535/1a3b-854/da3ca18b56d245830e23fc96d64c921d-854 ”的音频链接 不能播放。
一直报这个错: "errMsg": "MediaError","errCode": -6

9***@qq.com

9***@qq.com

ios端网络音频地址无法播放(audio组件和createInnerAudioContext都无法播放),安卓一切正常

4***@qq.com

4***@qq.com

23年了还不行吗?

Diligent_UI

Diligent_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序

项目运行到什么平台

糖分至上

糖分至上

24年了也存在此问题

要回复问题请先登录注册