Cordova sound bug on android - android

i made a simple android app with cordova to play audio whenever a button is clicked. it works on my huawei phone (android 5.1.1) and the google emulator, but it does NOT work on any other android phones (android 4.x [4.1;4.2;4.4]).
i have the media plugin installed into the project, haven't done any android-version specific restrictions
index.js: http://puu.sh/mrY3g/9d4a99d3e9.txt
config.xml: http://puu.sh/mrY7a/ae9b06aa51.txt
thanks a lot
ps. if u need more files for investigation/troubleshooting, leave a comment :)
EDIT
It was something with Content Security Policy, fixed that, but now when i logcat my phone, when i try to play the .mp3 file, it says Permission Denied. This happens ONLY on android 4.x (On browser and android 5 works perfectly). Any help is appreciated.

I changed the way sound is played from onclick(function a) where in a() was made an audio/media control (backend) which played the sound. now i made an <audio> control in the html and via javascript i play it

Related

Cordova Media Capture Android error no.3 issue

I am currently developing a mobile application that is all about very short sound recordings and for the time sake I decided to build it with Cordova (not Phonegap). Unfortunately today I have been fighting with the actual sound recording on my Nexus 5.
I am using the Cordova media-capture plugin, The code currently running is exactly the code from their documentation.
On older device, everything runs great. On my Nexus 5 though, when I click on button to record audio, it just returns error code number 3 (No media files recorded) even without opening the audio recorder. I thought it might be problem with new Android, but on simulator it runs fine. I also thought that somehow it could be connected to that I cannot find any audio recording app on my device, so I installed one and still nothing.
Then I thought maybe I am doing something wrong, so I installed this app: https://github.com/Icenium/sample-capture and the same problem.
There has been some advice around here to update the Capture Java file, which I did and still didn't help. What can I try next?
This is because there is no application installed, by default, to handle the intent (as explained above by others).
Try installing an application that handles that intent. For example I used this one:
https://play.google.com/store/apps/details?id=com.brightattic.soundrecorder&hl=en
(Please note I offer no endorsement of the app other than it worked to prove that the problem was a lack of sound recorder app).
Maybe try to set the targetsdk to 18 instead of 19 in androidmanifest.xml (and of course be sure to have installed api 18 in android sdk manager).
This should force the new kitkat chrome webview to operate in quirk mode and behave like the webview in jellybean.
I had the same issue, running adb logcat is useful:
W/System.err(22102): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.provider.MediaStore.RECORD_SOUND }
...
D/CordovaLog(22102): file:///android_asset/www/js/index.js: Line 77 : Capture ERROR: {"message":"Canceled.","code":3}
For me the problem is that Nexus 5 (android 4.4.2) doesn't handle the Intent, i.e. doesn't seem to have a default audio recorder.
On devices which do have a default audio recorder, you might see this error if that application doesn't include a receiver for RECORD_SOUND..

Worklight audio play, and control

Worklight 6.1
I have a worklight application that will be deployed to both Android, and iOS devices. A feature of the application is to play & control fixed audio files stored within the application. The files are in .wav format, but can be converted to mp3 if necessary (mpeg). Using the audio tag the audio play & control works fine in Android emulators (Chrome), but when the app is deployed to an Android device (ex: Nexus-7 4.1.2) the audio tag is not working.
I've read that there are issues with Android devices 4.X playing audio using the audio tag. Can someone please suggest the best approach to playing, and controlling audio (start, stop, pause, reset to beginning) that will work across both Android, and iOS devices.
Thank You.
From past experience, Cordova's Media API worked for me in both iOS and Android 4.
You can try that.

What does "install Flash plugin" in WebView mean?

In a small WebView app I wrote, I am able to load YouTube and see the picture the represents a video clip, with the familiar right-pointing arrow that is supposed to start playing the video:
But... when I touch that arrow, nothing happens (the video is NOT played).
I did enable the plugins setting in WebView, but that didn't help:
mWebView.getSettings().setPluginsEnabled(true);
So, I searched for more clues about how to make Flash (YouTube) run embedded in my WebView and I found the following hint:
I think you also need Flash to be
installed, like in Android 2.2 and
above.
I am OK with the requirement for Android 2.2 but what I don't understand is what "install Flash plugin" means: YouTube plays fine in Android's default browser (which is based on WebView AFAIK) and also in the YouTube app that's also installed in my device. Doesn't that mean that the Flash plugin is already installed?
If the answer is "no", what do I need to do to install it?
The Adobe Flash plugin is available from the Android Market for Android 2.2+ devices.
It may come pre-installed on a few devices, but on most it does not.
Search for "Adobe Flash" in the Android market to download it, then try running your app again.
Youtube got a HTML5 version, which means you can watch their videos without having flash installed. So better check flash suppport on a site where you can be sure that only flash is being used, eg http://www.adobe.com/software/flash/about/ which also tells you what version of flash you got installed.
Could it be a problem related to Javascript not being enabled on the webview?
myWebView.getSettings().setJavaScriptEnabled(true);

How to play a sound file under Android browser

Is there any way to play a sound file under Android browser?
Not yet, based on this:
http://textopiablog.wordpress.com/2010/06/25/browser-support-for-html5-audio/
Judging by the emulator in the android 2.3 SDK, HTML5 audio works fine (all common formats) in android 2.3. But unless all your users have Nexus S phones, that doesn't help you much at the moment. :/

what audio formats are supported by the android browser?

What audio formats can be played using the html5 'audio' tag in the android browser? Does anyone know where to find official specs on what the android browser supports and not?
For the record, the android media formats page does not seem to cover this - I have soundfiles (3gp) playing fine in a native app, but they won't play in my webapp.
The webkit docs also do not seem to help. My soundfiles play fine in my webapp on iphone, so that version of webkit handles them fine. Shouldn't the android browser have some official documentation somewhere?
Probably there should be official documentation. If you want to test it, why not make a web page on some domain you have access to, with links to all of the different sound files you can think of, and point your browser at it.
After some testing, I've concluded that support for the HTML5 audio element is broken in Android 2.1. Details of my testing can be found on my blog. I tested on an HTC Desire running Android 2.1 and HTC Sense, whereas Amos confirmed the same error on his HTC Heor running a custom 2.1 ROM (thanks, Amos!). If anyone will try the testpage in different configurations and report back either here or on my blog, I will update with any new information.

Categories

Resources