I'm writing an android audio player and on my nexus 5 running android 5.0 the MedaPlayer stops playing audio tracks around 2 to 5 seconds early. It's not predictable. It can change on the same track. Is there anyone else experiencing this, that found a workaround. I know this is not just my app that's having this issue on this device, because I tested it in Vanilla Music Player and it did the same thing. I've seen a few other people post on things sort of similar, but in most cases I see it has to do with steaming.
According to this answser:
https://stackoverflow.com/a/27827402/1415199
This is a bug in Android.
Ok it looks like the issue is Android 5.0.1's experimental MediaPlayer
called NuPlayer. NuPlayer is being enabled by default on all Android
5.0.1 devices and is only disabled through Developer Options. I've filed a bug against Android here:
https://code.google.com/p/android/issues/detail?id=94069&thanks=94069&ts=1420659450
The link above contains a suggested workaround
Related
I have an app built with Unity. There seems to be an issue with audio on Android 12. When the app loses focus (minimized) and is brought back to focus again, the sound/audio no longer plays, almost as if it's been muted.
Is anyone else experiencing this issue? And is there a fix?
I'm testing on a Samsung A22-5G.
Unity version is: 2020.3.35f1
Still investigating the problem, but here's a quick workaround (tested with Unity 2021.2.19f1).
Go to Project Settings > Player > Other Settings, enable "Mute Other Audio Sources".
Still working on a softer solution...
Currently can't check the issue with the newest Unity version.
Update 1
Seems like the issue is related to FMOD and should have been fixed in the newest Unity versions. https://issuetracker.unity3d.com/issues/android-player-crashing-in-fmod-when-targetting-sdk-level-31
OK, this one is a bit odd.
My app is an OpenGL ES 2.0 game and uses MediaPlayer to play the background music (not on a service as I want the music to stop when the app is send into the background) and SoundPool to play the (various, short) sound effects.
It's been tested on aprox 18 devices and a wide range of OS versions with no problems. However I recently ran it on a Hudl2 tablet with Lollipop installed and the performance was pretty bad (very choppy).
If I use my games settings to turn off the sound, it runs fine (strangely, if I leave the sound on and turn off the music, it also runs fine).
However, there are a lot of questions here relating to SoundPool causing lag, so I'm going with SoundPool being the likely cause.
Things I've tried are:
Playing a muted sound in my gameloop
Using MP3's instead of .OGG's
Reducing the number of simultaneous streams
Playing the sounds from the UI Thread (normally I call 'play' from the GL Thread)
Checking for API Level and using SoundPool.Builder when it detects API 21+ and the older constructor method when it finds an API of <21
Turning off USB Debugging and disconnecting from my dev computer
Removing my AdViews (in case they were causing the problem - clutching at straws here)
Disabling Hardware Acceleration in my manifest (more clutching at straws)
Unfortunately, nothing that I've listed makes any difference.
After much research, I found some people saying that soundPool should be run on a new thread, however, I already tried it on the UI thread and it made no difference at all.
The only other thing I can think of is that this is some kind of compatibility issues between the Hudl2 and Lollipop.
Does anyone have any other ideas as to what may be causing this lag on one specific device, with this specific OS Version (Lollipop)), or has anyone come across anything remotely similar? And if so are there any more suggestions?
Edit
I forgot to mention that I ran it on the same device (Hudl 2) with KitKat installed and it was perfectly fine. And on my Nexus 10 with Lollipop again, it's perfectly fine.
I am developing an advertisement application which plays multiple videos. I have faced a very strange problem: nor the simple Video nor the StageVideo are not visible when I run the app on target android device. Even FLVPlayback is not visible.
I can hear the audio but the only way to get the video is to press back button and then get back to app. In this case the video is displayed on the top of the rest display objects. This happens only on a target device which is a chinese sibo android tablet. It has android 4.1 on board. As I see a lot of people had the similar issue with different devices:
http://forums.adobe.com/message/5429125
but the solution they have mentioned there -adding true to the manifest xml doesn't fix my issue.
Adobe also advises to do it
http://forums.adobe.com/message/4914005
I am using adobe air 4.0 sdk and the air 4.0 runtime on the device. I have tried to change renderMode to CPU/Direct/Auto but it doesn change anything.
The other three android devices I have - toshiba thrive tablet(4.0.4)/ eken tablet(4.2.2)/ htc desire c smartphone(4.0.3) play all the video content just fine.
I guess the problem is re: their custom firmware(it auto hides all system bars..etc in order to make it work in 'kiosk' mode) but wanted to try all the variants before give up on this.
Any advice will be highly appreciated.
Thanks,
Max
After hours of scouring I did find a solution for AIR 4.6.0.
add backgroundAlpha to application node in the FLEX xml:
<s:Application backgroundAlpha="0.0" ... >
in the app.xml, change the namespace to highest version (3.7)
<application xmlns="http://ns.adobe.com/air/application/3.7">
and under the <android> node, add this
<containsVideo>false</containsVideo>
these are the references I found:
https://community.adobe.com/t5/flash-player/12-11-2012-air-3-5-runtime-and-sdk-update/td-p/4661723
https://help.adobe.com/en_US/air/build/WSfffb011ac560372f2fea1812938a6e463-8000.html#WS1B1ABBB6-F1D9-43f0-BC3E-0135F15FFAC4
No video when using spark VideoPlayer AS3
https://issues.apache.org/jira/browse/FLEX-33856
https://issues.apache.org/jira/browse/FLEX-33896
I have found a way how to force this unfriendly tablet to play the video in Adobe Air app by encoding it into FLV format and then embedding it into a swf via Flash pro. In this case I had to sync the app and video framerate(24fps). I have also set usingVideo flag to false in app descriptor.
Playback quality and performance are not very good but it's the only working method at the moment - I guess those can be improved by tweaking flv encoder params.
Update 4/3/2014
As the video playback embedded into swf was awful on the target device I have decided to download all the android versions of air runtimes starting from 3.1 and test normal video playback on these. Finally I have got the following results:
3.1.0.557 - NO
3.2 - YES
3.3.0.365 - YES
3.4.0.254 - NO
3.5.0.60 - NO
3.6.0.609 - NO
3.7.0.186 - NO
3.8.0.147 - NO
3.9.0.141 - NO
4.0 - NO
In the end I have found the solution - I have uninstalled all modern versions downloaded from google play and installed 3.3.0.365. I think my experience can be useful for those who develop AIR apps for android where target devices are noname low-end android tablets.
PS. I found another possibility to make video playing by using an swf embedded into an html page and displayed by StageWebView but this method has so much obstacles(FP security rules, ExternallInterface barriers) so it has no sense to implement it.
our new game seems to be smooth on other phones but on samsung gaxalxy s2 it always freezes and crashes. the application uses gdx lib. the issue seems to be connected with the music.
while the music is turned off from the code the gameplay is smooth, but after turning it on the whole series of crashes and freezes start.
Any solutions or advice on this ?
You can check the game here Fish vs Pirates
Thanks in advance.
The Samsung Galaxy S2 has a known audio bug: http://code.google.com/p/android/issues/detail?id=17623
Supposedly using the MediaPlayer API instead of the SoundPool API is supposed to work-around the issue. There are also reports that this is fixed in the ICS update. (If you're not using the SoundPool API, then you're probably not seeing this particular issue.)
I got the MediaPlayer error code as (1,-110) on BeagleBoard Hardware running ICS.The code runs fine on android tablets with ICS but I get a dialog box as "Sorry,this video cannot be played" error on BeagleBoard only.Any suggestions.
This is a time out error from the MediaPlayer:
http://developer.android.com/reference/android/media/MediaPlayer.html#MEDIA_ERROR_TIMED_OUT
Also, it may happen with an issue with Samsung firmware on Android 4.1.2, I've seen it in Galaxy S2 mini and Galaxy S3. Take a look here:
https://stackoverflow.com/a/18378273/3032209
You could solve it if you play the file it with another library, which will have the adequate codecs, like aacdecoder-android
I know my answer is too late to your question and I think you were able to fix this problem by now, but if not and for those people who are struggling with the Media Player Error (1, -110) (like I did the whole day today, Android HTC Desire X Jelly Bean 4.1.1), maybe this is the solution for you:
Just reboot your android (or close all the apps, which are using the Media Player).
In my case it was not a programming error, I just had to many apps open using the Media Player Instance, which led to that time out and I could not use it anymore.