webaudio 不适用于在 Android 设备上使用人行横道的离子 [英] webaudio not working with ionic using crosswalk on android device

查看:32
本文介绍了webaudio 不适用于在 Android 设备上使用人行横道的离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 ionic webrtc 应用程序,它在使用 ionic serve 时运行完美(在网络浏览器上,巫婆是正常的).但由于 getUserMedia 函数无法执行,因此根本无法在设备上运行.

I created an ionic webrtc app that runs perfectly when using ionic serve (on web browser, witch is normal). but was not working at all on the device since the getUserMedia function was not able to execute.

我找到的解决方案是安装 crosswalk,更新 AndroidManifest.xml 中的权限,并在 index.html 上添加元标记以确保内容安全:<meta http-equiv="Content-Security-Policy: media-src: 'self' mediastream">

The solution i found is to install crosswalk, update permissions in the AndroidManifest.xml and add the meta tag on the index.html for content security: <meta http-equiv="Content-Security-Policy: media-src: 'self' mediastream">

现在,我有一个可用的 ionic webrtc 应用程序,但只有视频,音频无法正常工作.android 应用程序能够通过音频播放视频,但似乎只发送没有音频的视频!

Now, i have a working ionic webrtc app but only video, the audio is not working. the android app is able to diplay video with its audio, but seems to only send video without audio !

我的设置:

AndroidManifest.xml 文件的权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />

ionic info 命令的输出:

Your system information:

Cordova CLI: 5.4.1
Gulp version:  CLI version 3.9.0
Gulp local:
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.13
Ionic App Lib Version: 0.6.5
OS: Windows 8.1
Node Version: v0.12.2

ionic browser list 命令的输出:

iOS - Browsers Listing:

Not Available Yet - WKWebView
Not Available Yet - UIWebView


Android - Browsers Listing:


Available - Crosswalk - ionic browser add crosswalk
         Version 8.37.189.14 Published
         Version 9.38.208.10 Published
         Version 10.39.235.15 Published
         Version 11.40.277.7 Published
         Version 12.41.296.5 Published
(beta)   Version 13.42.319.6 Published
(canary) Version 14.42.334.0 Published

Available - Crosswalk-lite - ionic browser add crosswalk-lite
(canary) Version 10.39.234.1 Published
(canary) Version 10.39.236.1 Published

Available - Browser (default) - ionic browser revert android
Not Available Yet - GeckoView

ionic.project 文件的内容:

{
  "name": "WebRtc app",
  "app_id": "",
  "browsers": [
    {
      "platform": "android",
      "browser": "crosswalk",
      "version": "16.45.421.19"
    }
  ]
}

我不明白的是,在crosswalk插件文件夹中的README.md文件中,我可以阅读以下内容:

what i dont understand is that in the README.md file in the crosswalk plugin folder i can read the following :

    ### Benefits

* WebView doesn't change depending on Android version
* Capabilities: such as WebRTC, WebAudio, Web Components
* Performance improvements (compared to older system webviews)

那么,crosswalk 怎么会声称 webrtc 和 webaudio 正在工作,但只有视频在我的应用程序上工作,而不是音频??

so, how it comes that crosswalk claims that webrtc and webaudio is working, but only the video is working on my app, not the audio ??

由于缺少其他设备,该应用仅在两部 armv7 安卓智能手机上进行了测试,我无法说在 x86 上会发生什么.

For the lack of other devices, the app was only tested on two armv7 android smartphones, i cant say what happens in an x86.

感谢您的回答,因为我真的需要知道我是否朝着正确的方向前进,或者只是退回到本机代码.

Thanks for your answers, since i really need to know if im in the right direction, or just fallback to native code.

推荐答案

找到了.它与人行横道无关,这是一个许可问题.刚刚将以下行添加到权限列表中,视频和音频都可以正常工作.

Found it. It had nothing to do with crosswalk, it was a permission problem. Just added the following line to the list of permissions and the video and the audio are both working fine.

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

这篇关于webaudio 不适用于在 Android 设备上使用人行横道的离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆