1

I am playing the video from the Assets in my application. I am developing the application for the tablet. I am having mp4 videos. my videoview in xml is below.

MY PROBLEM IS THAT I AM GETTING THE CENTER ALIGN VIDEO and GAP in TWOSIDE RIGHT AS WELL AS IN LEFT. Th video needs to be played in full screen.

  <VideoView
    android:id="@+id/videoview1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true" />

And here id the code i am using for playing the video.

videoPaths.add("android.resource://" + getPackageName() + "/"
            + R.raw.intro);
    videoPaths.add("android.resource://" + getPackageName() + "/"
            + R.raw.show_buttons);
    videoPaths.add("android.resource://" + getPackageName() + "/"
            + R.raw.loop);

    videoView = (VideoView) findViewById(R.id.videoview1);
    playVideos();

}

private Runnable playerRunnable = new Runnable() {

    @Override
    public void run() {
        // TODO Auto-generated method stub
        int videoDuration = videoView.getCurrentPosition();
        Log.e(this.getClass().getSimpleName(),
                "videoDuration == " + videoDuration + " total time == "
                        + videoView.getDuration());
        if (isFirstVideo == 0) {

            if (videoDuration > 8500) {
                Log.e(this.getClass().getSimpleName(),
                        "video duration is above 8500");

                isFirstVideo = 1;

                videoView.setVideoURI(Uri.parse(videoPaths
                        .get(isFirstVideo)));


            }

        }

    }
};

private void playVideos() {
    isFirstVideo = 0;
    videoView.setVideoURI(Uri.parse(videoPaths.get(isFirstVideo)));
    videoView.start();
    // handler.post(playerRunnable);
    handler.postDelayed(playerRunnable, 500);
}
Arpit Patel
  • 1,561
  • 13
  • 23

0 Answers0