MediaPlayer
suggest changeSyntax
- void setAudioStreamType(int streamtype)
- void setDataSource(Context context, Uri uri)
- void prepare()
- void prepareAsync()
- void start()
- void stop()
Remarks
The MediaPlayer usage is mainly based on the State diagram:
That means that in order to play audio or video, a defined sequence of actions must occur in a specific order. It also states what actions can be made in which state.
The MediaPlayer API lacks flexibility (adding a custom decoder and rendering logic) and lacks support for Dynamic Adaptive Streaming over HTTP (DASH) and SmoothStreaming. For these, look into ExoPlayer.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents