Hi, I have identified the issue, which is caused by some code setting the OpenGL viewport to the size of the played Video within the libVuforiaMedia.so library, which is the piece of software that allows playing the Videos on texture using OpenGL native code;
that library is located here:
YOUR_PROJECT\Assets\Plugins\Android\libs\armeabi-v7a\
since that library is not part of the "core" SDK and is only built on purpose for the VideoPlayback sample, we distribute the source code of it (located in YOUR_PROJECT\Android\VuforiaMediaSource\jni), so you could fix this by recompiling that C++ code using NDK-BUILD and bulding an updated libVuforiaMedia.so to replace the original one.
The proper fix would consist in adding the following lines at the beginning of the _copyTexture() function:
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
and this line at the end of the same function (_copyTexture):
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
However, a much simpler (and equally effective) solution is to simply modify the UpdateVideoData() method in VideoPlayerHelper.cs script in your Unity project, by adding a call to GL.Viewport() right after calling videoPlayerUpdateVideoData:
public MediaState UpdateVideoData()
{
MediaState ms = (MediaState) videoPlayerUpdateVideoData();
// FIX: RESET THE VIEWPORT WITH THIS LINE
GL.Viewport (new Rect(0,0,Screen.width, Screen.height));
return ms;
}
Let me know if that solves your issue (it did solve it for me, based on the tests with the sample).
Hi,
the GUITexture is a legacy feature of Unity, but since Unity 2.0 a better way of handling GUI elements is by overriding OnGUI() method of MonoBehaviou class... (and in Unity 4.6 there will also be a new GUI system).
The stretching issue is also discussed here in the Unity website:
http://answers.unity3d.com/questions/390728/guitextures-appear-stretched.html
in there, they seem to suggest to set the scale to (0,0,0 and use the Pixel Inset approach.