Log in or register to post comments

How to change Size of Video Frame in " VideoPlayback app"

December 9, 2016 - 9:05pm #1

hey guys, i am fully new to Unity/ vuforia/ C# , and  i am creating a simple VideoPlayback app , everything is working properly, but i am trying to give aspect ratio to my video which will appear after tracking the image target, i have written following code but it's not working, although is there any way i can achieve this functionality ? and anyhow i can change the SCALE of the video( static) ?

Please Help me !

#region PUBLIC_MEMBER_VARIABLES



/// <summary>

/// keep aspect ratio.

/// </summary>



public bool KeepAspectRatio = true;

 

 

// Get the video width and height

int videoWidth = mVideoPlayer.GetVideoWidth();

int videoHeight = mVideoPlayer.GetVideoHeight();



if (KeepAspectRatio && videoWidth > 0 && videoHeight > 0) // <-- Edit this line

{

    // 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 have used this thread for full aspect ratio :- https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/modifying-scale-video-plane-video-playback-sample-app

 

Thanks

Log in or register to post comments