Class of android.media · MediaPlayer.java · Android's reference
public class MediaPlayer
Plays audio, through the runtime's audio (snx.android.media.Audio): prepare reads the source and opens a stream of it, which FFmpeg decodes as it plays. A source with no audio that decodes (a video's picture alone, a format the runtime lacks) prepares as a clip with no length, and its playback completes at once, so an app's flow goes on as after a short clip. No picture is drawn.
Page 1 2
public static final int MEDIA_ERROR_UNKNOWN = 1 sourcepublic static final int MEDIA_ERROR_SERVER_DIED = 100 sourcepublic static final int MEDIA_ERROR_IO = -1004 sourcepublic static final int MEDIA_ERROR_MALFORMED = -1007 sourcepublic static final int MEDIA_ERROR_UNSUPPORTED = -1010 sourcepublic static final int MEDIA_ERROR_TIMED_OUT = -110 sourcepublic static final int MEDIA_INFO_UNKNOWN = 1 sourcepublic static final int MEDIA_INFO_VIDEO_RENDERING_START = 3 sourcepublic static final int MEDIA_INFO_BUFFERING_START = 701 sourcepublic static final int MEDIA_INFO_BUFFERING_END = 702 sourcepublic static final int SEEK_PREVIOUS_SYNC = 0 sourcepublic static final int SEEK_NEXT_SYNC = 1 sourcepublic static final int SEEK_CLOSEST_SYNC = 2 sourcepublic static final int SEEK_CLOSEST = 3 sourcepublic MediaPlayer() sourcepublic static MediaPlayer create(Context context, Uri uri) sourcepublic static MediaPlayer create(Context context, int resid) sourcepublic void setDataSource(Context context, Uri uri) throws IOException sourcepublic void setDataSource(String path) throws IOException sourceA path, or a file: URI, is opened as Android opens it before its decoder sees it, so a missing file is FileNotFoundException; another scheme (http, rtsp) is taken as it is, with no audio. A drive's path ("C:\..." or "C:/...") is a path, not a URI of scheme "C": the app's files have such paths on a Windows host
public void setDataSource(FileDescriptor fd) throws IOException sourcepublic void setDataSource(FileDescriptor fd, long offset, long length) throws IOException sourcepublic void setDataSource(android.content.res.AssetFileDescriptor afd) throws IOException sourcepublic void prepare() throws IOException sourcepublic void prepareAsync() sourcepublic void start() sourcepublic void pause() sourcepublic void stop() sourcepublic void reset() sourcepublic void release() sourcepublic void seekTo(int msec) sourcepublic void seekTo(long msec, int mode) sourcepublic boolean isPlaying() sourcepublic int getCurrentPosition() sourcepublic int getDuration() sourcepublic int getVideoWidth() sourcepublic int getVideoHeight() sourcepublic int getAudioSessionId() sourcepublic void setAudioSessionId(int sessionId) sourcepublic boolean isLooping() sourcepublic void setLooping(boolean looping) sourcePage 1 2
Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.