91-9990449935 0120-4256464 |
Android Video Player ExampleBy the help of MediaController and VideoView classes, we can play the video files in android. MediaController classThe android.widget.MediaController is a view that contains media controls like play/pause, previous, next, fast-forward, rewind etc. VideoView classThe android.widget.VideoView class provides methods to play and control the video player. The commonly used methods of VideoView class are as follows:
activity_main.xmlDrag the VideoView from the pallete, now the activity_main.xml file will like this: File: activity_main.xml
Activity classLet's write the code of to play the video file. Here, we are going to play 1.mp4 file located inside the sdcard/media directory. File: MainActivity.java
You need to run it on the real device (e.g. mobile) to test the application.
Next TopicAndroid Mediarecorder Example
|