[ACCEPTED]-playback video full screen-playback
No need to do any coding for playing video 6 to full screen mode
Apply the following layout 5 format over the xml containing the videoview 4 it will for sure will play the video in 3 full screen mode. as it is running mine.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView android:id="@+id/myvideoview"
android:layout_width="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent">
</VideoView>
</RelativeLayout>
Plus 2 adding the mediacontroller will also give 1 you the controller to use.
I have solved the problem:
1.
To remove the 5 continue/pause buttons remove the media 4 controller. For the looping issue
put OnCompletionListener
so 3 that when the video reaches the end, it 2 starts again:
videoView.setOnCompletionListener(
new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
videoView.start();
}
});
2.
To resize the video, override 1 method onMeasure()
in VideoView
like this:
public class MyVideoView extends VideoView {
public MyVideoView(Context context) {
super(context);
}
@Override
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
{
setMeasuredDimension(480,800);
}
}
I know this thread is a few weeks old, but 4 you don't have to copy the video file to 3 the SD card just to play it. Use the following 2 but insert your package name instead of 1 "com.yourcompany.yourproject":
videoView.setVideoURI(Uri.parse("android.resource://com.yourcompay.yourproject/" + R.raw.yourvideoresource));
If you want to play video in full screen, then 5 just add these line of code in your Androidmanifest.xml 4 file, in the activity where this video is 3 going to play. Just add these two lines 2 in android manifest file.
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|screenSize"
Like in my androidmanifest.xml 1 file i have added it
<activity
android:name="com.appliconic.straminglivevideo.MainActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Modified @Javanator's answer a bit, this 2 won't stretch the video:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView android:id="@+id/myvideoview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
</VideoView>
</RelativeLayout>
Hope this helps 1 someone :)
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.