public class AsyncPlayer
Plays a series of audio URIs, but does all the hard work on another thread
so that any slowness with preparing or loading doesn't block the calling thread.
|Constructor and Description
Construct an AsyncPlayer object.
|Modifier and Type
||Method and Description
Start playing the sound.
We want to hold a wake lock while we do the prepare and play.
Stop a previously played sound.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void play(Context context,
Start playing the sound. It will actually start playing at some
point in the future. There are no guarantees about latency here.
Calling this before another audio file is done playing will stop
that one and start the new one.
context - Your application's context.
uri - The URI to play. (see
looping - Whether the audio should loop forever.
stream - the AudioStream to use.
public void setUsesWakeLock(Context context)
We want to hold a wake lock while we do the prepare and play. The stop probably is
optional, but it won't hurt to have it too. The problem is that if you start a sound
while you're holding a wake lock (e.g. an alarm starting a notification), you want the
sound to play, but if the CPU turns off before mThread gets to work, it won't. The
simplest way to deal with this is to make it so there is a wake lock held while the
thread is starting or running. You're going to need the WAKE_LOCK permission if you're
going to call this.
This must be called before the first time play is called.
Java Enterprise Edition (EE)
Java Standard Edition (SE)
RFC (standard status)
RFC (proposed standard status)
RFC (draft standard status)
RFC (informational status)
RFC (experimental status)
RFC (best current practice status)
RFC (historic status)
RFC (unknown status)
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 404 / 158852406. Delta: 0.03582 с