Hello
In my android application i am playing live rtsp links.
The issue is at times if the player gets struck somewhere then the videoplayer doesnot exit even if we press back.
The only option will be to close the program from task manager.
Is there any way that i can make it better?
Please share your valuable suggestions.
Thanks in advance :)
If it is your code getting stuck, be sure that you are not doing anything (especially network operations) that can block or take more than a few milliseconds in the UI thread - you need to be doing that in loopers or services.
If it's the underlying android video player engine that is hanging, sorry, no idea.
Related
Hello stackoverflow's members !!
I have terrible problem, I don't know how to implement service to play sound in background in my whole application.
I followed this tutorial but it seems to be not working for me.
Have you guys any idea how to do that?
I was looking at the Media Player application found in the Android 2.1 platform samples. I gave a link of the URL for the media file i wanted to play. Now it played fine, but the app gave a "taking too long" warning dialog, meaning too much work was been done on the UI. Is there a better approach to prepare the file async, when streaming from the internet, so as not to bug the UI thread more then needed.
Thanks.
PrepareAsync() is performed on another thread (hence the name). I don't think the problem is here.
I use Service to for player. It doesn't require UI so you can be sure it's not blocking ui and it's not killed when you leave activity.
I am doing a streamed musicplayer for android.
I have tried with MediaPlayer
mp.setDataSource("http://www.myServerPage.com/songUrl.mp3");
mp.prepare();
mp.start();
and it works but not good.
The prepare state is very slow and often the application is freezing.
I have searched a lot on forums and tutorials and as far as I can see this is the common way of doing it.
Do anyone know is it is another way of opening up a stream to play music from a server or have any good advices, maybe in NDK or by some other inputstream?
Thanks for the help.
/micke
The Media Playback article is pretty clear about how to deal with remote media sources: call prepareAsync() and set a listener to get notified when the source is ready for playing.
The reason for this is exactly what you're experiencing:
(...) the call to prepare() can take a long time to execute, because it
might involve fetching and decoding media data. So, as is the case
with any method that may take long to execute, you should never call
it from your application's UI thread. Doing that will cause the UI
to hang until the method returns, which is a very bad user experience
and can cause an ANR (Application Not Responding) error.
I suggest you go over the mentioned article for some more information and pointers that may help you with further development.
I need some help in the concept of Services in Android? Actually i want to Play some sounds with animation in Android. I'm done with frame by frame animation successfully but want to play some audio with animation. I got some ideas about Services from google but I'm unable to get their point, so that i am posting it over here. If anyone has any idea about how can i do this please give me some suggestion to do this. It would be very helpful to me.
Have a nice day ahead...
Thank you!!
You'd need to take a look at,
MediaPlayer
I think the documentation given is self-explanatory. Also you need not make use of a separate Service for playing the sounds, unless of course you have a special need.
I want to make a music player, it can play music and appear music lyrics, I can't find any api regarding this, can you give me some open-source app about this, or any example. I only know when i play music in a thread, and show lyrics in other thread, then Refresh user interface. my knowledge about is lil , could you guys suggest me.
I got the same question as yours, but why nobody wanna answer it? The only thing I found was http://tika.apache.org/0.10/api/org/apache/tika/parser/mp3/LyricsHandler.html, hopefully, it can help you.