Android 3.0 r1 API Chinese Document (107) -- AsyncPlayer

Source: Internet
Author: User

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.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.