Downloading audio to play on android






















Viewed 12k times. I'm aware of the MediaPlayer 's capability to stream directly, but I don't want to use that: The obvious advantage you get by downloading and simultaneously streaming from file is that this way, the file gets stored and is available locally afterwards. This works in principle - the MediaPlayer starts to play the file even if it not fully downloaded. The problem is that when the MediaPlayer gets to the position where the download status just was when it started playing, it stops and calls onCompletion.

Quick side note: OnBufferingUpdateListener. Hinton Hinton 2, 2 2 gold badges 25 25 silver badges 30 30 bronze badges. How are you doing the streaming? By implementing a simple localhost server that reads data from the downloading file and feeds it to a MediaPlayer that has been set to stream from localhost? In that case, couldn't you make your server return a Content-Length that matches or exceeds the full length of the file? So I don't have a server currently. Hi Hinton, I have to do the same thing you are asking can you post an answer with some detail how you did it so that I can implement it on my side.

I'm quite busy at the moment but I'll try to answer in a few days if you still want it after you've read this. Problem: The thing I implemented at last is quite ugly. I tried Oren's approach which is obviously the best, and correct solution , but it wasn't too important to me so I just decided to stream from the URL by default and let the user tell me if they wanted to download.

In the latter case, I'd stream from the URL while downloading yes: waste of bandwidth , and when the download was finished, I'd switch from streaming to the downloaded file when the user would pause. Continued: This works remarkably well. The problem is the wasted bandwidth. If you're doing this for a customer who is not very attentive and not knowledgeable about android programming, they'll never notice.

Don't worry the audio-book is still on your device. Listening to the audio-book from downloads is still very easy.

Click on the apps icon on your phone. Then go find the downloads icon. Click on that and you will see a list of all your downloaded files. The audiobook should be shown in this list.

Did you find it helpful? Yes No. Related Articles. Article Summary. This article has been marked as historical. Open Google Play. It's the orange triangle-shaped app with a white music note in the center. It's in the top-left of the screen. This takes you to the main page of your Music Library. Go to the album or song or you want to download.

Tap "Artists", "Albums", or "Songs" to browse for the song or album you want to download. Since Google Play is a part of the Google Community, it needs to be logged in with your Google account. By the way, I don't think it's necessary to log in again, as at the beginning when you start using your phone and create an account with Google, all the applications Google provides will be available. If it asks you for your account password and email address, log in!

Not Helpful 6 Helpful Does this cost money to download music? I want to make sure so I don't spend any. You certainly con download songs for free, but not from Google Play. Instead, go to Chrome and go to the address "m. Select your song like you do on Google Play music. Uri; import android. Bundle; import android. Activity; import android. Menu; import android. MediaController; import android. Environment; import android. View; import android. OnClickListener; import android.

Reinforcement Learning. R Programming. React Native. Python Design Patterns.



0コメント

  • 1000 / 1000