I'm developing an Android App using the SoundPool. Every time I play a sound, an error gets logged in LogCat of the type:
E/SoundPool(11873): sampleID=33, leftVolume=0.779528, rightVolume=0.779528, priority=1, loop=0, rate=1.000000
What does this error mean? Is it possible to disable these logs, I guess logging these errors is quite time consuming since I play a lot of sounds.
Thanks
I'm using API 8 and test the App on a Samsung Galaxy S Plus with Android 2.3.6
A took a quick look over the SoundPool class and didn't find anything immediately, but you should definitely look into what type of audio files you are playing. I think you should try maybe uncompressed file types like .wav to see if that alleviates the problem.
Related
I have an app with a VideoView to display an MP4 file. Everything was working perfectly fine, on all devices and all Android versions, until Android 12.
We have one user reporting that the VideoView is unable to play the videos, for every video he gets the following popup (the app doesn't crash, just this popup is shown):
My question: does anyone know what the problem might be? I'm expecting - or hoping - it has to do with the fact that it's the beta version of Android 12. If that's not the case, then how can I solve this issue? Anything that changed for Android 12 w.r.t. displaying videos?
Many thanks.
EDIT: The video files are located in local storage (R.raw folder)
EDIT 2: When running the emulator with Android 12, I get the MediaPlyaer error (1, -2147483648). This corresponds to MediaPlayer.MEDIA_ERROR_UNKNOWN and UNKNOWN_ERROR respectively, as explained in this SO post. However, the proposed solutions there don't solve the problem here (the format should not be the issue, since they are .mp4 files). Any ideas?
EDIT 3: I submitted an issue with Google about this. If you're interested in a solution, star it here. Hope we can find the cause soon!
What fixed it was saving the video in AVC/H264 format and using that file.
From reporting this issue on Google's Issuetracker here, it turned out that the problem was actually with the encoding of the video files in this case. The video that wasn't playing was encoded in MPEG-4 format (.mp4) and exceeded the capabilities of the MPEG-4 software decoder.
I don't know why this wasn't an issue before Android 12 (videos were playing fine before), but at least this does fix the issue.
I'm trying to make a radio app. Everything is ok, except playing radios. I'm getting play link from a page with Jsoup. When i press play, (in real device)it takes 40-50 seconds to start playing. But in genymotion device (Google Nexus 4- 4.4.4- API 19) it takes just 3-4 second. I couldn't find what is wrong.
I'm new on Android and I couldn't find a solution for days. Thanks id advance.
I really recommend you to use google exo player instead of default android player for streaming. its too fast and you will never have problems like this.
https://github.com/google/ExoPlayer
You must try it without emulator, as they themselves are slow.
Also give below links a read.
https://developer.android.com/reference/android/media/AudioManager.html
https://developer.android.com/guide/topics/media/mediaplayer.html
For Best performance native is good:
https://developer.android.com/ndk/guides/audio/index.html
I'm trying to test this sample in my galaxy S3 and everything seems to work well but when i try to play the recorded file, no player can play the file.
I send the video to my computer and tried with VLC, gom player, etc and always get an error like " entry format no recognized"
The file has the right size.
What is happening?
Edit: I tested the same sample in a moto G and works ok. Can be a galaxy S3 related issue?
Thanks
I'm sure that this is not the best way to overcome this. But anyway, anything is better than a infinite loop and a corrupted file so... i put a counter for EOS waiting iterations with a limit, if it is reached breaks the loop.
File is playable now.
No secondary problems for now.
Thanks
While testing an app that I was making to play videos in a loop from a playlist using the MediaPlayer, I found that one video caused my app to freeze. It didn't force close or anything just froze. After I took the video out it ran fine. But the video didn't cause it to crash every time. I was stability testing the app and it would run for at least 5 hours so it played the video a number of times before freezing. After I took out the video and put in different ones it worked fine (some were bigger and I added more than one). All the videos I was testing were mp4's and there was nothing noticeably different about the one that was crashing.
Any ideas why the video was causing the crash? It's not a huge issue but it would be nice to know so I could maybe check for it before adding a video to a playlist.
I am currently trying to make a Soundboard application for my Android.
Using Eclipse, I have successfully made buttons and coded them so that when pressed, they play .ogg sounds in the res/raw folder. All is okay.
Now, I have discovered that any files over about 6 seconds long aren't playing fully.
Is there any way to correct this problem? I would normally just trim the files, but some of them need to be a bit longer, but none are over 50 seconds.
Thanks alot!
What is happening is the mediaPlayer.start() instruction is being called before the file has finished fully loading. Assuming you are using mediaPlayer.create(this, resid) followed by .start() there are a few things that can help. The "right" way to do it is to put the .start() instruction inside of an onPreparedListener since .create calls .onPrepared the first time, but honestly when I put that in my soundboards I got tons of crash reports, so I reverted to just using .start after .create.
I found the problem usually occurs if the sound file is very high bitrate, or if the app is installed on a slow sdcard. I use mp3's, but usually cap the bitrate at 96k and put in the app description that if the clips aren't playing fully to move the app back to internal memory and the complaints seem to have stopped.