媒体控制器不工作

MediaController not working

我的 VideoView 可以工作,但我的 MediaController 不工作。我很确定我做错了位置或者可能没有...

这是我的代码:

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 应设置为 VideoView 以便 work.You 应调用以下内容:

resultVideo.setMediaController(mediacontroller);