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.
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">
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 !
My settings :
Permissions on the AndroidManifest.xml
file :
<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" />
Output of the ionic info
command :
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
Output of the ionic browser list
command :
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
Content of the ionic.project
file :
{
"name": "WebRtc app",
"app_id": "",
"browsers": [
{
"platform": "android",
"browser": "crosswalk",
"version": "16.45.421.19"
}
]
}
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)
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 ??
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" />
来源:https://stackoverflow.com/questions/35344819/webaudio-not-working-with-ionic-using-crosswalk-on-android-device