Closed GoogleCodeExporter closed 9 years ago
That's actually what we do for internal files, getting the FileDescriptor and
passing that to MediaPlayer.setSource(). Can you tell us what devices/os
version this happened on?
Original comment by badlogicgames
on 12 Oct 2011 at 6:34
Unfortunate I can't at this time. I'm using a crummy crash reporting tool that
doesn't give me enough info. I'm switching to ACRA in my next build so
hopefully I can give you much more info in the future, since this seems to be
happening somewhat regularly for my users (at least a few times a day).
Original comment by Infoalki...@gmail.com
on 12 Oct 2011 at 6:50
I have this issue on Samsung Galaxy S (2.3.5)
Original comment by mongr...@gmail.com
on 10 Nov 2011 at 12:09
My java.io exception was :
E/AndroidRuntime( 7184): Caused by: java.io.FileNotFoundException: This file can
not be opened as a file descriptor; it is probably compressed
E/AndroidRuntime( 7184): at android.content.res.AssetManager.openAssetFd(
Native Method)
E/AndroidRuntime( 7184): at android.content.res.AssetManager.openFd(Asset
Manager.java:330)
E/AndroidRuntime( 7184): at com.badlogic.gdx.backends.android.AndroidAudi
o.newSound(AndroidAudio.java:125)
E/AndroidRuntime( 7184): ... 8 more
Original comment by mongr...@gmail.com
on 10 Nov 2011 at 12:20
It seems this is a common problem with some batches of Samsung phones. I'm
afraid we have no way of fixing it. One solution would be to copy your
resources to the external storage and play them back from there.
Original comment by badlogicgames
on 3 Dec 2011 at 6:20
I know there is quite some time since someone posted here but since I stumbled
on this post in a search for similar (or possible same problem) I decided to
share a potential work-around (not a fix since I can not guarantee it will
never happen, but it seems to happen less often).
Tested on:
Samsung Galaxy S2 (Defiantly makes a big difference).
HTC Desire HD (Probably helped, it was less frequent before so hard to
really know).
The original poster did include a stack-trace however only the actual error. In
my case some rows above gives a dissent hint to the problem.
02-10 21:33:05.485: E/MediaPlayer(20132): Unable to to create media player
02-10 21:33:05.485: W/AudioSystem(16141): AudioFlinger server died!
02-10 21:33:05.485: W/AudioSystem(10913): AudioPolicyService server died!
02-10 21:33:05.485: W/IMediaDeathNotifier(20132): media server died
02-10 21:33:05.485: E/MediaPlayer(20132): error (100, 0)
02-10 21:33:05.485: W/IMediaDeathNotifier(2834): media server died
02-10 21:33:05.490: I/ServiceManager(2579): service 'media.yamahaplayer' died
02-10 21:33:05.490: I/ServiceManager(2579): service 'media.audio_flinger' died
02-10 21:33:05.490: I/ServiceManager(2579): service 'media.player' died
02-10 21:33:05.490: I/ServiceManager(2579): service 'media.audio_policy' died
02-10 21:33:05.490: I/ServiceManager(2579): service 'media.camera' died
02-10 21:33:05.490: E/SoundPool(20132): Unable to load sample: (null)
02-10 21:33:05.490: I/ServiceManager(20132): Waiting for service media.player...
02-10 21:33:05.515: E/MediaPlayer(20132): Error (100,0)
02-10 21:33:05.520: I/GLThread(20132): exiting tid=10
... The original posters trace follows
This suggest to me that the media-player somehow is used, blocked or for some
other reason not accessible by the program. This problem appears to happen more
frequently when the program runs without a cable plugged in, i.e. not connected
to the computer.
What I did to reduce/remove the problem:
1. Dispose all Sounds and Musics (when the program exits, i.e when the global
dispose is called).
2. Put a try-catch around all your Sound and Music loads and if there is an
exception redo the load
i.e. run the same code you did in the catch block again! If it fails again call exit (Gdx.app.exit) or
(display a message to the user and then exit).
Exemple:
try {
load(); // Load sounds and musics.
} catch (final Exception ex) {
try {
Gdx.app.log("Sound Load Error", "Failed to load sounds, trying again!");
load();
} catch (final Exception ex1) {
Gdx.app.log("Sound Load Error", "Failed to load sounds (second time), exiting application!");
Gdx.app.exit();
}
}
Original comment by jox...@gmail.com
on 10 Feb 2012 at 9:14
I had this problem with an .ogg file, and it turned out to be because I had a
shared top-level project with my assets and hadn't followed this guide:
http://www.badlogicgames.com/wordpress/?p=1537
The toplevel project contains the assets and the Android project just had the
assets specified as a source folder. I guess this bypasses aapt altogether, so
the .ogg was being compressed.
I followed the guide and used an Eclipse link to the assets folder instead, and
now ADT/aapt handles it and leaves my oggs uncompressed.
Something to check if you're having this issue (it was happening for me on HTC
Desire).
Original comment by nickhowes
on 25 Mar 2012 at 11:06
Has someone found a solution to this problem yet? This still seems to happen on
certain HTC and Samsung phones
Original comment by pgu...@kiwiup.com
on 15 Apr 2012 at 2:10
Could you reopen this issue? I am getting a lot of those via flurry - about 3%
of phones, and I would appreciate a fix.
Original comment by dpowa...@gmail.com
on 17 Aug 2012 at 8:44
Also from me: Could you reopen this issue? Because I am also getting a lot of
those via ACRA - at me it is about 5% of devices, but what I've noticed at me:
all of this issue in my libGDX-powered game are always only Toshiba AT100
devices with Android 3.1 and 3.2.1 versions, so all other users (with another
devices), which've installed my game, have not this issue.
Original comment by rosse...@gmail.com
on 18 Aug 2012 at 8:09
there is nothing we can do about this. we don't do anything fancy, we use
MediaPlayer and SoundPool as they are intended to be used. i can reopen the
issue so people are aware of it, but there is zero things i can do about it
Original comment by badlogicgames
on 18 Aug 2012 at 8:22
I've got this bug on Acer Iconia Tab with ICS.
Original comment by synda...@gmail.com
on 18 Oct 2012 at 3:54
I had an issue that might be similar - and Samsung S3 with Jelly Bean. The
sound files failed to load, no crash, they just didn't play. Worked fine on
desktop.
The "fix" was easy, although it eludes me why it worked: Simply use
Gdx.files.internal("foo/bar.ogg") and NOT Gdx.files.classpath("foo/bar.ogg");
Original comment by mikkel.k...@gmail.com
on 6 Dec 2012 at 11:18
You can't load audio files from the classpath on Android, must use internal.
Nothing we can do to fix Android not playing some audio files, sorry.
Original comment by nathan.s...@gmail.com
on 29 Dec 2012 at 10:51
is my problem same as yours , i have a sound problem , i load it and reuse it
in the entire game, but the longer the game takes the sounds will fail to play,
happens on htc, samsung note 2... no problem with desktop.. do i have any other
alternatives?
Original comment by montecil...@gmail.com
on 12 Sep 2013 at 1:57
Same problem on Android
public void create() {
bordSound = Gdx.audio.newSound(Gdx.files.internal("data/sounds/bord.ogg"));
....
public void dispose() {
// dispose of all the native resources
bordSound.dispose();
the first time the application is launched, there is no problem.
Sometimes when restarting the application was the message: unable to load
sample (null)
Looks like the memory is not always released.
Seen on Acer liquid e2, not on Nexus S
...
Original comment by andromaq...@gmail.com
on 15 Sep 2013 at 2:17
If this is of any help to anybody, here is my experience.
I had this same issue. The game worked fine on desktop, but when trying it on
my Samsung S3, it crashed. Checking the log cat would show the same error:
"Unable to to create media player", when uncaught.
The problem was that I was playing some weird kind of mp3 file. When you took a
look at it an Audio Editor (Audacity for example), you wouldnt see your normal
alternating graph. Intead you were shown a graph that didnt alternate and had
very few points.
I think this might have happened because I was given an ogg file that was later
converted to mp3 dubiously...
Anyway, I replaced this mp3 for another file and everything worked smoothly.
Original comment by cavpo...@gmail.com
on 13 Jan 2014 at 3:52
Its me again. I ran into this problem again... but this time it was different.
I had a bunch of mp3 and loded them all to LibGDX as a Music class as soon as
the app started. I did this because... well, nobody taught me better. I had
been using short sounds as a Music class because of the 'has finished playing'
property.
Anyway, after loading about 4 of those sounds/music I began to obtain
exceptions. They said the sound didnt load and that I should place them on the
assets directory. It confused me because they were there. I checked each mp3 to
see they were properly formated and didnt have any error, but they were all
good.
So after some time I realized that loading that many sounds as a Music class
made the MediaPlayer go nuts. This didnt happened on my Sanmsung S3, so I
never noticed the error, but when somebody tried it on less powerful phones
like the Galaxy Ace, the error came up. So I guess its a problem of how much
memory can be used to store music.
So to solve this now I load the music only when it is necesary and as soon as
it is finished using it is disposed. Also, all those sounds that I loaded as a
Music class now I load them as a Sound class, and dispose of them as they are
not needed.
Everything seems to work fine now. ^_^
Original comment by cavpo...@gmail.com
on 10 Feb 2014 at 6:21
I had this problem as well. It could be your sound file's Sample Rate. One of
my sound files was doing this and its Sample Rate was 96000 Hz, I changed it to
44100 Hz (in Audacity) and it solved the issue. This file was a .wav but it
might carry over to .mp3 .
Original comment by wsillo...@gmail.com
on 8 Apr 2014 at 5:36
Issue on Android 4.0 may be on below version also.
I tried to create sound from internal application folder
(getApplicationContext().getFilesDir().toString()+"/"+fileName
and it was working fine but in the same file if I try to create music it gives
ioException 1.0.
if i put same file in sdcard and try to create music its working fine
Original comment by develope...@gmail.com
on 30 May 2014 at 9:16
Original issue reported on code.google.com by
Infoalki...@gmail.com
on 8 Oct 2011 at 7:07