VideoView也在其他活动中播放视频

时间:2014-07-23 20:04:08

标签: android video android-activity android-tabhost android-videoview

我在标签Activity中有三个活动。我必须在两个活动中使用视频视图。当我在一个活动中播放视频时,它会自动播放其他活动中的视频。如何解决此问题?

活动一码:

        final VideoView videoView1= (VideoView)v.findViewById(R.id.videoViewPreviewVideos);
        final MediaController controller;
        String uriPath = "android.resource://com.robin.musicplayer/"+R.raw.bigsure30;

        final   Uri uri = Uri.parse(uriPath);

        controller   = new MediaController(MainActivity.this);

        controller.setMediaPlayer(videoView1);
        videoView1.setMediaController(controller);
        videoView1.setVideoURI(uri);
        controller.setAnchorView(videoView1);

Code Acitvity 2:

    String uriPath = "android.resource://com.robin.musicplayer/"+R.raw.treadmil;
    final   Uri uri = Uri.parse(uriPath);

    controller   = new MediaController(this);
    controller.setMediaPlayer(this.videoView1);
    this.videoView1.setVideoURI(uri);

    controller.setAnchorView(videoView1);
    controller.setPadding(10, 500,10, 100);
    videoView1.seekTo(1);


    videoView1.start();

0 个答案:

没有答案