belongs to Maven artifact


public abstract class MediaPlayer2
extends Object


MediaPlayer2 class can be used to control playback of audio/video files and streams.

Topics covered here are:

  1. State Diagram
  2. Permissions
  3. Register informational and error callbacks

State Diagram

Playback control of audio/video files and streams is managed as a state machine. The following diagram shows the life cycle and the states of a MediaPlayer2 object driven by the supported playback control operations. The ovals represent the states a MediaPlayer2 object may reside in. The arcs represent the playback control operations that drive the object state transition. There are two types of arcs. The arcs with a single arrow head represent synchronous method calls, while those with a double arrow head represent asynchronous method calls.

MediaPlayer State diagram

From this state diagram, one can see that a MediaPlayer2 object has the following states: