Preface
This chapter covers android. media. AsyncPlayer and Android 3.0 r1! I look forward to your participation in Android API translation, contact me over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://goo.gl/6vJQl
Body
I. Structure
Public class AsyncPlayer extends Object
Java. lang. Object
Android. media. AsyncPlayer
Ii. Overview
Playing a continuous (multiple) Audio URLs, but the heavy work of those tasks is completed in another thread, so any preprocessing or loading delay does not prevent the thread from calling.
Iii. Constructor
PublicAsyncPlayer(String tag)
Construct an AsyncPlayer object.
Parameters
String used for debugging by tag
Iv. Public Methods
Public voidPlay(Context context, Uri uri, boolean looping, int stream)
Start playing the sound. You can start playing on a certain point. There may be a delay. This method is called when another audio file is played, which causes the current audio to stop playing and start playing new audio.
Parameters
Context application context
Uri (seesetDataSource(Context, Uri)
)
Whether looping allows infinite loop playback. (SeesetLooping(boolean)
)
Stream audio stream (AudioStream) type (seesetAudioStreamType(int)
) (For exampleAudioManager.STREAM_MUSIC
)
Public voidStop()
The sound played before it is stopped. It cannot be paused at a certain point and then played. Multiple calls have no adverse effect.
5. Supplement
Article Selection
Android multimedia ----- AsyncPlayer
Android game development tour 16 asynchronous music playback [Android123]
Today I made a stupid mistake.