IT. Expert System.

Android Reference


Class AsyncPlayer

  • public class AsyncPlayer
    extends Object
    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 Detail

      • AsyncPlayer

        public AsyncPlayer(String tag)
        Construct an AsyncPlayer object.
        tag - a string to use for debugging
    • Method Detail

      • play

        public void play(Context context,
                Uri uri,
                boolean looping,
                int stream)
        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 MediaPlayer.setDataSource(Context, Uri))
        looping - Whether the audio should loop forever. (see MediaPlayer.setLooping(boolean))
        stream - the AudioStream to use. (see MediaPlayer.setAudioStreamType(int))
      • stop

        public void stop()
        Stop a previously played sound. It can't be played again or unpaused at this point. Calling this multiple times has no ill effects.
      • setUsesWakeLock

        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.


Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)





Java Script








Design patterns

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)

IT dictionary

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 с