I understand that the Android MediaPlayer cannot handle .pls files, but I am trying to create a streaming radio app and the .pls URL is all I have access to. Is there any way to make this work, or am I out of luck?
Just read the .pls files and get all the URLs there. And thats what you have to use since .pls is just a playlist. Once you have all the URLS, you can already use mediaplayer.
Related
I keep many mp3 files on a server to be able to receive them in my Android application. I am streaming mp3 files one after the other. My problem is that I want to already buffer the next mp3 file while playing the current mp3 file.
I tried it with already downloading the next mp3 file in cache while playing the first one. But the problem is that when the first mp3 file is done playing, the second mp3 file may not be fully downloaded (which can easily happen on a 2g connection). The player will then initialize the part of the mp3 file which is downloaded and the player will play only that part of the downloaded files which is initialized (please correct me if I'm wrong). This causes corrupt files and it is not good performance at all.
Please help me. Thanks in advance.
For the file that you want to buffer, can you create a second MediaPlayer instance using MediaPlayer create (Context context, Uri uri), but not calling .start(), and then use setNextMediaPlayer (MediaPlayer next), to queue this second player to start playing when the first one is finished?
Can anyone give me the sample code for parsing and playing .pls file in android?
[playlist]
NumberOfEntries=1
File1=http://stream.radiosai.net:8002/
You need to download the .pls file and read it to find the media file inside since pls is a playlist not a format.
I've been searching for a solution for 2 days about this issue and I've finally found a radio player which you can implement into your code: https://github.com/iammert/RadioPlayerService that plays .pls files from a radio service link (such as: http://stream.radiosai.net:8002/ ).
However, that url on your question should work on the default MediaPlayer but if anyone ever encounters this problem with urls that contain a .pls file, then they should use a radio player that supports the encoding and format.
.
So I am creating a podcasting app and I was wondering if playing a podcast such as this http://www.npr.org/rss/podcast.php?id=122287224 - will MediaPlayer work to play such a podcast? I have never used MediaPlayer and I am just wondering if that would work.
yea you can , just parsing the xml and get the link of the xml and using the media player in streaming the mp3
this tutorial help you
here how to parse xml
http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/
media player and streaming
http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i
http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/
http://blog.endpoint.com/2011/03/api-gaps-android-mediaplayer-example.html
http://androidstreamingtut.blogspot.com/2012/08/custom-progressive-audio-streaming-with.html
I am developing an app. that will stream the video recorded from camera and stored as mp4 in sdcard...
I know there something called as RTSP which is used for that...
Please tell me where to start . .and is there any library that will do this for me...
I do not understand why you want to stream a local mp4 file, but maybe I misunderstood you problem. RTSP is used for live streaming, but you want to play a local mp4 file.
If you want to capture video and save it as mp4 onto a SD card, you need to use the Android MediaRecorder. Here a link to a simple example.
If you just want to playback a local mp4 file. Have a look at the Android API Demos.
These are part of the Android SDK installation and contain a good example of how to playback local media files.
I'm streaming a live radio url directly through Mediaplayer in a service (SDK 8 and above). Some clients are saying that they are hearing some blips and bloops in between the stream. I'm not doing anything different here and just allowing the MediaPlayer to play the audio. Can someone tell me why is this happening?
-Hari
i'm not sure if it's gonna help, but i can tell you the way i play using http streaming for a mp3, for example:
1: the code
mediaPlayer = MediaPlayer.create(this, Uri.parse("http://vprbbc.streamguys.net:80/vprbbc24.mp3"));
mediaPlayer.start();
2: the .pls file
This URL is from BBC just as an example. It was an .pls file that on linux i downloaded with
wget http://foo.bar/file.pls
and then i opened with vim (use your favorite editor ;) and i've seen the real URLs inside this file. Unfortunately not all of the .pls are plain text like that.
tested with android 1.6 and 2.2.