Android MediaPlayer (Multimedia) Method Introduction

Source: Internet
Author: User

AndroidMultimedia Learning Summary

MediaPlayer Method Introduction:

MediaPlayer instantiation MediaPlayer player = MediaPlayer. create (this, R. raw .&&);

Player. getCurrentPosition () to get the current playback position

Player. getDuration () Get the file playback time

Player. getVideoHeight () to get the video height

Player. getVideoWidth () to get the video width

Player. isLooping () Whether to play cyclically

Player. isPlaying () is playing?

Player. pause () pause playing

Player. prepare () Preparation for synchronization

Player. prepareAsync () Prepare asynchronous

Player. release () releases the MediaPlayer object

Player. reset () resets the MediaPlayer object

Player. seekTo () specifies the playing position

Player. setAudioStreamType (int StreamType)

Player. setDataSource (); sets the multimedia data source

Player. setDisplay (SurfaceHolder sh) settings use SurfaceHolder to display multimedia

Player. setLooping (); Sets whether to play cyclically.

Player,. setOnBufferingUpdateListener (MediaPlayer. OnBufferingUpdateListener listener) listens for events and network streaming media buffer listening

Player. setOnErrorListener (MediaPlayer. OnErrorListener listener) listens to events and sets error message listening.

Player. setScreenOnWhilePlaying (boolean screenOn) sets whether to use SurfaceHolder for display.

Player. setVolume (float leftVolume, float rightVolume) has no return value and sets the volume.

Player. start () start playing

Player. stop () stop playing

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.