Created
February 11, 2018 07:00
-
-
Save AasemJS/7b6e5bf84083f2eeba4e58e484f1a5d3 to your computer and use it in GitHub Desktop.
Video file tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.aasemjs.videoplaydemo; | |
| import android.net.Uri; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.View; | |
| import android.widget.MediaController; | |
| import android.widget.VideoView; | |
| public class MainActivity extends AppCompatActivity { | |
| //create class reference | |
| VideoView vid; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| vid = (VideoView)findViewById(R.id.videoView); | |
| } | |
| public void playVideo(View v) { | |
| MediaController m = new MediaController(this); | |
| vid.setMediaController(m); | |
| String path = "android.resource://com.aasemjs.videoplaydemo/"+R.raw.trial; | |
| Uri u = Uri.parse(path); | |
| vid.setVideoURI(u); | |
| vid.start(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment