Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Like Tree2Likes
  • 1 Post By mrichards957
  • 1 Post By jonbonazza

test: Reply
 
LinkBack Thread Tools
Old November 5th, 2012, 04:23 AM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 35
 
Device(s):
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Default how to play video in Full Screen??!

Hi all,

can someone help me how t play video in full-Screen android.
my video play but not in fullScreen.



here is my code;
MainActivity.java
--------------------

public
class MainActivity extends Activity {


@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView vd = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(vd);
vd.setMediaController(mediaController);
vd.setKeepScreenOn(true);
vd.setVideoPath("android.resource://com.video.pideo/raw/"+R.raw.number);
vd.start();
vd.requestFocus();


}
}

Activity_main.xml
--------------------
<?xmlversion="1.0"encoding="utf-8"?>

<



LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"


android:layout_width


="fill_parent"

android:layout_height


="fill_parent"

>



<


VideoView

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


VideoView>
</LinearLayout>


ihope toget a reply
thnks in advance

Advertisements
wounded is offline  
Reply With Quote
sponsored links
Old November 7th, 2012, 09:01 AM   #2 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

your android:layout_height attribute for your VideoView is set to 666dip. For fullscreen, you should set it to fill_parent.
__________________
My blog, Inverted Keystrokes, is looking for aspiring developers (not necessarily with Android) to post articles. If you have any development experience and are interested in participating, please PM me. =)
jonbonazza is offline  
Reply With Quote
Old November 10th, 2012, 12:23 PM   #3 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 35
 
Device(s):
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jonbonazza View Post
your android:layout_height attribute for your VideoView is set to 666dip. For fullscreen, you should set it to fill_parent.

Welcome jonbonazza,

it doesnt work

as you saw Previous picture,,my actual video is in the black color and it leave a gap or blank space between video and buttons(play/stop...) who can i remove this space?

thnkx
wounded is offline  
Reply With Quote
Old November 14th, 2012, 02:53 PM   #4 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

Did you try this?

Code:
Activity_main.xml
--------------------
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<VideoView
android:id="@+id/VideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</VideoView>
</LinearLayout>
jonbonazza is offline  
Reply With Quote
Old November 16th, 2012, 01:29 AM   #5 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 35
 
Device(s):
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jonbonazza View Post
Did you try this?

Code:
Activity_main.xml
--------------------
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<VideoView
android:id="@+id/VideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</VideoView>
</LinearLayout>

i got this , still the same

wounded is offline  
Reply With Quote
Old November 17th, 2012, 05:31 PM   #6 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

Hmm thinking about it, VideoView is probably coded to retain a certain aspect ratio, so it likely won't go fullscreen in portrait mode. Does it work as intended in landscape mode?

EDIT: Moved to main Android App Dev forums.
jonbonazza is offline  
Reply With Quote
Old November 19th, 2012, 02:32 PM   #7 (permalink)
New Member
 
Join Date: Nov 2012
Location: Littleton, CO
Gender: Male
Posts: 6
 
Device(s): HTC Sensation, Archos 70, ASUS Transformer Prime
Carrier: T-Mobile

Thanks: 0
Thanked 1 Time in 1 Post
Default

I did a project a while back where I had to be able to control the aspect ratio of a VideoView control. What I ended up doing was create a class that extends VideoView and then override the "onMeasure" method to calculate the width and height I wanted and call "setMeasuredDimension" with those values. Otherwise I think jonbonazza is right, the VideoView will try to keep a set aspect ratio.

To set the video to full screen, I think you need to use something like this:

[HIGH]
public class MyVideoView extends VideoView {

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int containerWidth = MeasureSpec.getSize(widthMeasureSpec);
int containerHeight = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(containerWidth, containerHeight);
}

}
[/HIGH]
wounded likes this.
mrichards957 is offline  
Reply With Quote
The Following User Says Thank You to mrichards957 For This Useful Post:
jonbonazza (November 20th, 2012)
Old November 20th, 2012, 09:29 AM   #8 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

I agree with mrichards957. I did some more searching and this is the only conclusion I could seem to come up with, albeit not exactly convenient.
wounded likes this.
jonbonazza is offline  
Reply With Quote
Old November 20th, 2012, 02:22 PM   #9 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 35
 
Device(s):
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Default

it doesnt work with me..
i will try to use webview to play .swf files that contains video
so if you any idea
thnks to all for ur reply
wounded is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:39 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.