package your.package.name;
//we will need this stuff...
import android.app.Activity;
import android.os.Bundle;
import android.net.Uri;
import android.view.WindowManager;
import android.widget.MediaController;
import android.widget.VideoView;
public class YourActivityName extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.player_layout); //You need the layout defined, check the last part of the paste
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //This is to keep the screen on
VideoView vPlayer = (VideoView)findViewById(R.id.videoPlayer);
Uri vUri = Uri.parse("https://..."); //Put your URL here
vPlayer.setVideoURI(vUri);
MediaController vControl = new MediaController(this); //Now we will attach some buttons to control the playback
vControl.setAnchorView(vPlayer);
vPlayer.setMediaController(vControl);
vPlayer.start(); //And that's it... Play the file :)
}
}
XML layout needed to run this paste: http://bitbin.it/d76ZWU1q