My VideoView works but my MediaController doesn't work. I'm pretty sure I'm doing the positions wrong or probably not...
Here's my code:
public class Main2Activity extends Activity {
VideoView resultvideo;
MediaController mediacontroller;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String uri = getIntent().getStringExtra("VIDEO_URI");
Uri videoUri = Uri.parse(uri);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main2);
mediacontroller = new MediaController(Main2Activity.this);
mediacontroller.setAnchorView(resultvideo);
mediacontroller.show();
mediacontroller.setAnchorView(resultvideo);
resultvideo = (VideoView)findViewById(R.id.videoView2);
resultvideo.setVideoURI(videoUri);
resultvideo.start();
}
}
MediaController should be set with VideoView in order to work.You should have called the below: