Log in or register to post comments

Unity Vuforia Video Playback Video.prefab custom video resolution iOS issue

June 7, 2016 - 3:15am #1

Hi devs,

we've had this problem in the past and it still occurs right now. Therefore I wanted to see if someone has a solution for this problem. I'm using the Video.prefab from the Vuforia Video Playback sample. When we use a video which is not 16:9 the video won't work on iOS. See screenshot attached.

On Android and iOS the videoplane is resized correctly depending on the video resolution. And the video works fine on Android. On iOs however the plane is gray and nothing happens.

Is there a solution available for this?

Unity 5.3.1p3
vuforia 5.5.9

Thanks

AttachmentSize
Image icon iOS-video-issue.PNG748.49 KB

Unity Vuforia Video Playback Video.prefab custom video resolution iOS issue

May 15, 2017 - 7:01am #3

Hi, I have managed to make work Vuforia Playback with non-standard video size: I simply enforced Graphics API=OpenGL in Unity Player Setting. (Evidently, there are errors in VuforiaPlayerHelper.mm for Metal API). I found this while viewing VideoPlayback native iOS version (there is no any code for Metal in this version).

Kindest

Unity Vuforia Video Playback Video.prefab custom video resolution iOS issue

June 7, 2016 - 5:08am #2

Here's an update on a workaround for now. Our video in this case was 632x540 with the aim to completely overlay the printed AR image. Typically we use 960x540 as maximum resolution for video overlays, because that worked on iOS and Android in the past.

I stretched the width of the video so the resolution is 16:9 again (960x540). I then adjusted the Video.prefab to have the correct size (0.1, 0.1, 0.08544) for our original aspect ratio (632x540). Next I Added the "keepAspectRatio" variable to the VideoPlaybackBehaviour.cs script. I made it public and default to true, so that other videoplanes wouldn't be affected. Now if I set the variable to false, the resizing of the video plane isn't happening and the video is shown on the mesh. It works on iOS and Android.

if (keepAspectRatio && videoWidth > 0 && videoHeight > 0)
{
    // Scale the video plane to match the video aspect ratio
    float aspect = videoHeight / (float) videoWidth;

    // Flip the plane as the video texture is mirrored on the horizontal
    transform.localScale = new Vector3(-0.1f, 0.1f, 0.1f * aspect);
}

I'm still interested in a clean solution for this.
Thanks

Log in or register to post comments