I have a link that directly starts downloading of the song, but I want to stream that song in my app without downloading. Is it possible? Please help me through.
Link is: http://workintelligentonline.com/church/audio/1New Stories (Highway Blues).wma
For your application to play the song, the decoder has to read the data from memory. So the streaming data has to stored into a buffer or a page-cache implementation which is then fed to the decoder.
Once the song playback is completed, the MediaPlayer engine is closed which will release the allocated memory too. As long as your application doesn't write the contents of the memory into a file, you have technically played a streaming song without downloading.
Related
I am preparing an application that plays playlists of 10 songs in m3u8 format. I am using ResolvingDataSource because I am fetching the m3u8 url to the audio file before starting playback.
Is it possible for ResolvingDataSource.Resolver to invoke every time the track changes?
Thanks for any help
I noticed that when ResolvingDataSource.Resolver takes the url to track in the playlist one time, when I go back to the same position again the exoplayer takes the m3u8 url from memory without calling ResolvingDataSource.Resolver.
I have to Playlist of songs by fetching them from the server. I am using MediaPlayer OnCompletionListner to play the next song. But each time it taking time to connect to the server. Which feels like lagging in playing in audio. Is there any solution to play files from the server one after another without ant lag.?
My question is about media player live streaming from the url in my application?
I'm trying to play live stream mp3 audio by media player.
The problem is that when i am using default URL as given in this link , then it works fine. But i changed the following mp3 link ,
then after playing 1 seconds it taking buffering and after completion its play the song, but i need that it plays the song with the buffering as well.
please help.
Thanks in advance.
It is not easy task to accomplish.
You can use this link https://code.google.com/p/mp3tunes/source/browse/
as reference app to develop your own progressive mediaplayer app.
From the above link you will get the whole architecture for your app.Song downloading and playing is happens at the same time.The architecture developed in the reference app is more robust and reusable.
Specially look at following classes
NanoHTTD.java
HttpServer.java
PlaybackService.java
PlaybackQueue.java
TrackDownloader.java
Thank You.
I want to stream an audio mp3 file and then play it through android media player plus I also want to cache this file, so that mediaplayer don't have to stream for recently played tracks.
I have tried using prepareAsync method but it doesn't give me access to buffer content, so I have decided to stream the audio file myself and then pass it to the media player for playing. I have achieved this by following this article here but this approach has a problem i.e. while transferring the file to media player it goes into error mode which causes my player to behave inconsistently.
When media player enters its error mode it doesn't come out of it automatically so I am forced to create a new media player and then re-provide it the downloaded file, this workaround causes the user to experience an undesired pause in the song playing.
So, does any one have improved an version of code given in above link? or do they know a better solution to this problem or is there is actually a library for streaming an audio file in android?
Thanks
The link you provided looks like a less than ideal solution (not to mention outdated). What you probably want is a local proxy server that gives you access to byte data before the MediaPlayer gets it. See my answer here for a little more explanation.
I am streaming from an mp3 stream using the MediaPlayer.
I set the datasource, call preparyAsync(), call start() on the onPrepared() callback.
Now I want to know the number of bytes downloaded by the mediaplayer when streaming a song.
Is there a way to track the number of bytes?
Its not going to be one song but instead an mp3 stream.
I understand you want to know the number of bytes of downloaded compressed data, not the number the bytes of uncompressed data inside MediaPlayer which is proportional to the lenght of audio played. (The compressed data may not be proportional in case of using VBR for example).
To get the number of bytes of downloaded compressed data you need to count the bytes of stream downloaded by MediaPlayer, but I believe the only way to have access to the stream downloaded is to implement a local streamproxy that feeds the MediaPlayer, or a second solution is to save the stream to a local file and open this file with MediaPlayer, but the later solution has some limitations as MediaPlayer locks the local file and data cannot be appended.
For the first solution see this solution on how to implement a proxy to feed MediaPlayer: MediaPlayer stutters at start of mp3 playback