Log in or register to post comments

Video is stretched when fullscreen playing

June 18, 2013 - 5:51am #1

I have managed to play a video (720*720, square) on a framemarker based on VideoPlayback example, but if I double tap the video, I get a stretched fullscreen view. I tried to change "fill_parent" to "wrap_content" of the VideoView, it does not work.

How can I keep the original video aspect ratio?

Video is stretched when fullscreen playing

August 14, 2013 - 1:46am #12

Sir AlessandroB,

I improvised by comment out "/* /= 2.0f */" in renderFrame and got the output below (attached image). It still connected to texture of image target, how can I possibly get the video to play without the image target  underneath?

And the most important guide I needed is how to fix the video in center of the screen and never suffer from resize/ rescaling?

AttachmentSize
Image icon logged-videoplayback.png116.8 KB

Video is stretched when fullscreen playing

August 13, 2013 - 2:27am #11

Thank you so much I'll update after I finished the assignment. Hopefully asap but with the link you gave now I know whereto start.Bless you :)

Video is stretched when fullscreen playing

August 13, 2013 - 2:17am #10

 For orthographic projection matrix calculation, you can see this:

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

A simpler option, if you want to avoid the use of the orthographic projection, would be to just set the projection matrix to identity matrix; then, you would need to take into account that your video rectangle will be visible if its coordinates are between -1 and +1 in the X and Y axis.

 

Video is stretched when fullscreen playing

August 13, 2013 - 1:47am #9

With the instuctions and patience I'm very thankful with you helping me. Though I'm new to AR and vuforia. Is there another option like displaying the video in the custom dialog?

This is the 1st time I encountered the word "orthographic" and with that maybe you have the idea that with the 1st step it will just be harder with other steps. I just want to know if it is the easiest way track for a newbie?

Peace be with you.

Video is stretched when fullscreen playing

August 13, 2013 - 1:30am #8

Ok, based on your screenshot,

You first need to render the video rectangle as screen-aligned; this can be achieved by:

- setting the projection matrix to orthographic

- then setting the modelview matrix to identity

- then translating the modelview matrix a bit up/down and/or to the right/left (unless you want it to appear exactly centered)

- then applying a scale of 0.8 to the modelview matrix 

- finally render the video rectangle

To position and scale the modelview matrix you can use the SampleUtil functions that are already in use in the sample.

 

Video is stretched when fullscreen playing

August 13, 2013 - 1:14am #7

Hi AlessandroB,

The targetPositiveDimensions are computed via this code:

1
2
3
4
5
  targetPositiveDimensions[currentTarget] = imageTarget.getSize();
  // The pose delivers the center of the target, thus the dimensions
  // go from -width/2 to width/2, same for height
  targetPositiveDimensions[currentTarget].data[0] /= 2.0f;
  targetPositiveDimensions[currentTarget].data[1] /= 2.0f;

is stated in Augmentation rendering (icons and videos) in documentation but please even if I comment out change the value of the 2.0f there is a change. I am gratefulfor your reply but my real question is how can I maintain the video in the center with 80% video display in the android phone while the other 20% shows the live camera feed.
Is this possible?

AttachmentSize
Image icon Scale_Video.png1.48 MB

Video is stretched when fullscreen playing

August 13, 2013 - 1:12am #6

Hi AlessandroB,

The targetPositiveDimensions are computed via this code:

1
2
3
4
5
  targetPositiveDimensions[currentTarget] = imageTarget.getSize();
  // The pose delivers the center of the target, thus the dimensions
  // go from -width/2 to width/2, same for height
  targetPositiveDimensions[currentTarget].data[0] /= 2.0f;
  targetPositiveDimensions[currentTarget].data[1] /= 2.0f;

is stated in Augmentation rendering (icons and videos) in documentation but please even if I comment out change the value of the 2.0f there is a change. I am gratefulfor your reply but my real question is how can I maintain the video in the center with 80% video display in the android phone while the other 20% shows the live camera feed.
Is this possible?

Video is stretched when fullscreen playing

August 13, 2013 - 1:01am #5

Hi reonting,

your question is not strictly related to the current topic of this thread (for the future, please create a new thread if you have a specific question);

however, what you need to do is to look at the code in VideoPlayback.cpp (in the JNI folder), and to check the targetPositiveDimensions variable (see the _renderFrame() function in particular);

the targetPositiveDimensions is the variable that defines the actual size of the video rectangle; in the sample it is defined to be half the size of the image target, but you can adjust the values to your desired ones.

 

Video is stretched when fullscreen playing

August 6, 2013 - 9:00pm #4

Kindly help me I'm having a hard time locating what part of code I need to comment or change on  "VideoPlayback" so that it won't rely on the ImageTarget size instead specify the size of output video in the code.

OUTPUT GOAL LOOKS LIKE THESE: In the image attached there is an IronMan poster and video that don't rely on the size of the image target(ironman poster). link: http://pho.to/3GKsP

[url=http://share.pho.to][img=800x480]http://pho.to/3GKsP[/img][/url]

AttachmentSize
Image icon Scale_Video.png1.48 MB
Image icon Scale_Video.png1.48 MB

Video is stretched when fullscreen playing

June 18, 2013 - 11:19pm #3

I rewrite the fullscreen play activity, and directly use videoview.start() to play video instead of MediaPlayer, then the problem is solved.

Thanks!

Video is stretched when fullscreen playing

June 18, 2013 - 8:25am #2

Hi,

this is an Android layout question:

have you checked this thread ?

http://stackoverflow.com/questions/9962172/videoview-layout-for-playing-video-on-android

 

Log in or register to post comments