play video on center

February 27, 2015   ·   0 Comments

Screen Shot 2015-02-27 at 8.46.15 AM

VideoView’s onMeasure to scale up the video to fit inside a fullscreen view.

  setContentView(R.layout.wellcome);
        VideoView videoView = (VideoView) this.findViewById(R.id.videoView1);
        uri = "android.resource://" + getPackageName() + "/" + R.raw.tour;
        videoView.setVideoURI(Uri.parse(uri));
        videoView.requestFocus();
        videoView.setOnPreparedListener(new OnPreparedListener(){
        	public void onPrepared(MediaPlayer mp){
        		mp.setLooping(true);
        	}
        });
        videoView.start();
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">
<!-- Video player -->
<VideoView android:id="@+id/surface_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center">
</VideoView>
</FrameLayout>

Screen Shot 2015-02-27 at 8.46.15 AM

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon