How to stream authenticated content with MediaPlayer on Android
Posted
by 102790073222983779908
on Stack Overflow
See other posts from Stack Overflow
or by 102790073222983779908
Published on 2010-05-28T20:39:29Z
Indexed on
2010/05/28
20:42 UTC
Read the original article
Hit count: 155
I've seen quite a few posts askign this question on SO but there doesn't seem to be a definitive answer (or at least an answer I like!)
I've got content protected behind basic auth (username/password) -- I can download it fine using the various HTTP download clases but for the life of me I can't sort out how to tell media player to stream it (and provide the authentication). I saw one post that suggested it wasn't possible since the MediaPlayer is all native code and doesn't things like the Authenticator.
There are plenty of examples of how to first download to a cached copy and then play that back but....That sort of sucks (and the files maybe 100's of MB's). I saw at least one proposal to download it in smalish chunks and then start & stop the playback (redirecting to the new file) but that sort of sucks also since there would (I presume) be a stutter (I haven't tried it though)
The best idea I have at this point is to start downloading to a cache file and then when it's 'full enough' start up playback while I continue to fill the file.... I hope that this works (but again, haven't tried it).
Am I missing something obvious? It's so painful to have all the various pieces almost working and I sort of convinced myself that there had to be a way to natively stream protected content (or have it take a already established & qualified InputStream) but it appears no joy.
BTW I'm a Mac/iPhone guy and a newb at Android so I'm still fighting a bit of Java learning.... Excuse me if I'm missing somthing obvious.
-john
© Stack Overflow or respective owner