I'm having problems playing audio streaming. The application has been tested with differents APIs.
The media player in gingerbread(API 10) takes about 30-40 seconds on preparing state, however on API 7 takes only about 5-10 seconds on preparing state. Anyone know how to fix it?
I have looked in differents forums but don't get an answer.
Thanks in advanced.
The problem has to do with the fact that the buffering in Gingerbread is based upon fixed bytes rather than anything that has to do with the time it takes to play the stream. If the stream is low-fidelity, it will take a very long time to buffer. There is no fix other than to write your own streaming player.
Thanks. Find enclosed an example. ¿Could be ok to improve the performance?
http://blog.infidian.com/2009/12/27/android-streaming-mediaplayer-tutorial-updated-to-v1-5-cupcake/
Related
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
So I have an app that plays a video.
And I have a time sync server for setting the datetime of the device. It seems that whenever I call SystemClock.setCurrentTimeMillis(millis) the video stops.
I am using android.media.MediaPlayer.MediaPlayer() object to play the video?
Has anyone else experienced this? I was planning on creating a watchdog thread that just monitors the current duration. But just wanted to know if anyone had come across this already?
Yes, I came across the same situation on some devices. Probably hardware libs use the system time clock in the in decoding or av sync implementation; it happens. Only solution on those devices was to stop/restart the MediaPlayer. But it probably depends on the implementation of the lower levels.
I'm trying to create an app to stream live TV. Currently the problem I'm facing is that after say 10 minutes of playing, the video will freeze but the audio will carry on. This is on a 1.3mbps stream. I also have lower streams, such as a 384kbps stream, that might last an hour or so, but will still do the same. I've tested this with a local video, that is high quality (file size is 2.3gb) and that has no lag and doesn't freeze at all, so it must be something to do with the way HLS is streamed to android.
Does anyone have any idea on how to solve this problem?
Thanks
I try to implement a simple media player to play an audio stream from an external URL. Pretty simple I guess. Tried to implement this sample from Androïd dev site http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Audio.html
It works just fine with 2.1.
Then, with 2.2 it gets weird. Starts just well, but takes almost 10 seconds to stop.
With 2.3, it's not better. This time might take up to a minute to start playing, but stops OK.
Does anyone have a clue why ? I also did try the prepareAsync way with the listner, but it never get called. Any help would be appreciated at this point. Thanks !
Register setOnInfoListener() and control start buffering, end buffering and so on.
Look at the android documentation link
This is a tough one :/
I'm making a music-based Android game a la Audiosurf. It works all nice except a few seconds before end of a song (that is being played with a normal MediaPlayer) the music stops aprubtly and the whole game (including UI) freezes for several seconds.
Each time that happens I see an "AudioHardware pcm playback is going to standby"-error in logcat.
Googling has led me to the conclusion that
this could be a HTC Hero specific issue (cannot be reproduced on emulator or other devices)
this message is normally logged when a http stream isn't fast enough for MediaPlayer
Audio in Android sucks in general
As I am decoding the mp3 with the NDK + libmpg123 for audio analysis already I might aswell just play the audio myself (using a very ugly interface between NDK C code and an AudioTrack in Java).
Is there a fix/workaround for this bug or should I really go that way? (I only have limited time left to complete this project)
I appreciate every hint!
You might be stopping the music when you've buffered it all in your C code. Since the AudioTrack has a delay in it, you may need to wait longer for it to finish.
I'd need more detail about your code to help, though.