Android mediaplayer API method

Source: Internet
Author: User

Method: Create (context, Uri URI)
Explanation: The static method creates a multimedia player through Uri.

Method: Create (context, int resid)
Explanation: The static method creates a multimedia player using the resource ID.

Method: Create (context, Uri, surfaceholder holder)
Explanation: The static method creates a multimedia player through Uri and the specified surfaceholder [abstract class ].

Method: getcurrentposition ()
Explanation: int is returned to obtain the current playback position.

Method: getduration ()
Explanation: int is returned to obtain the file time.

Method: getvideoheight ()
Explanation: int is returned to get the video height.

Method: getvideowidth ()
Explanation: int is returned to obtain the video width.

Method: islooping ()
Explanation: Boolean is returned, indicating whether to play cyclically.

Method: isplaying ()
Explanation: Boolean is returned, indicating whether the video is being played.

Method: Pause ()
Explanation: no return value. Pause.

Method: Prepare ()
Explanation: no return value. Prepare for synchronization.

Method: prepareasync ()
Explanation: no return value. Prepare asynchronous

Method: release ()
Explanation: no return value. Release the mediaplayer object.

Method: reset ()
Explanation: no return value. Reset the mediaplayer object.

Method: seekto (INT msec)
Explanation: no return value indicates the playback position (in milliseconds)

Method: setaudiostreamtype (INT streamtype)
Explanation: no return value indicates the streaming media type.

Method: setdatasource (string path)
Explanation: no return value. Set the multimedia data source (based on path]

Method: setdatasource (filedescriptor FD, long offset, long length)
Explanation: no return value. Set the multimedia data source according to filedescriptor]

Method: setdatasource (filedescriptor FD)
Explanation: no return value. Set the multimedia data source according to filedescriptor]

Method: setdatasource (context, Uri URI)
Explanation: no return value. Set the multimedia data source according to Uri]

Method: setdisplay (surfaceholder SH)
Explanation: no return value. Set surfaceholder to display multimedia.

Method: setlooping (Boolean looping)
Explanation: no return value indicates whether to enable loop playback.

Event: setonbufferingupdatelistener (mediaplayer. onbufferingupdatelistener listener)
Explanation: listening events and network streaming media buffer listening

Event: setoncompletionlistener (mediaplayer. oncompletionlistener listener)
Explanation: Listener event, network Streaming Media Playback End listener

Event: setonerrorlistener (mediaplayer. onerrorlistener listener)
Explanation: listens to events and sets the error message listener.

Event: setonvideosizechangedlistener (mediaplayer. onvideosizechangedlistener listener)
Explanation: monitoring events and video size monitoring

Method: setscreenonwhileplaying (Boolean screenon)
Explanation: no return value. Set whether to use surfaceholder for display.

Method: setvolume (float leftvolume, float rightvolume)
Explanation: no return value. Set the volume.

Method: Start ()
Explanation: no return value. start playing.

Method: Stop ()
Explanation: no return value. 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.