Saturday, April 27, 2013

Re: [android-developers] Re: HLS audio and getDuration / seekTo strangeness

Because downloading a 12 hour audiobook is not exactly a good user experience.

Hls allows them to have the experience of having it locally without the massive download.

Larry

On Apr 27, 2013 9:38 PM, "bob" <bob@coolfone.comze.com> wrote:
Why are you using HTTP Live Streaming for pre-recorded audio?

This doesn't sound like the best tool for the job.

Thanks.


On Saturday, April 27, 2013 10:10:55 PM UTC-5, Larry Meadors wrote:
Yes, I call prepareAsync after I register a OnPreparedListenter - this
is happening after that gets triggered (as a test, in the onPrepared
method, I log the duration: It's zero there, too).

What's really strange to me (here's a snippet) is that it takes a few
seconds to determine the duration.

---
mediaPlayer.start();
mediaPlayer.pause();
Log.d(TAG, "waiting 10 seconds for duration to be known...");
long waitForIt = System.currentTimeMillis() + 10000;
while (System.currentTimeMillis() < waitForIt) {
  if (mediaPlayer.getDuration() > 0) break;
}
Log.d(TAG, "now:       " + System.currentTimeMillis());
Log.d(TAG, "waitForIt: " + waitForIt);
Log.d(TAG, "duration:  " + mediaPlayer.getDuration());

Log.d(TAG, "seeking to: " + milliseconds);
Log.d(TAG, "playing:    " + mediaPlayer.isPlaying());
mediaPlayer.seekTo(milliseconds);
---

This hideous mess takes anywhere from 2-6 seconds to break out of the
while loop. Once it does, I get a duration and can call seekTo().

Also, even though the start() and pause() calls are executed that
close together, they still cause the player to play 1-2 seconds of
audio.

Without those calls, the full 10 seconds elapse and I *still* don't
get a duration and seekTo doesn't work. :-/

Larry

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate