Search Results for

    Show / Hide Table of Contents

    Video Player AVPro Usage Guide

    Conversion

    Video Player convert Video Player AVPro copy
    alt-text alt-text

    There are menu items on both the Unity VideoPlayer and the VideoPlayerAVPro that will automatically convert between the two, ensuring that the same values are kept.

    Media Reference

    alt-text

    When upgrading, the VideoClip (if used) is automatically converted to an AVPro MediaReference. This will function, but the MediaReference in question will be internal. It is best if you create your own MediaReference and assign it.
    See MediaReference for more detailed information.

    Display Mode

    Unity Display Option AVPro Converted Option
    CameraFarPlane CameraFarPlane
    CameraNearPlane IMGUI
    RenderTexture RenderTexture
    MaterialOverride Material
    APIOnly None

    See Render Mode for more detailed information.

    Audio Output

    Unity Audio Option AVPro Converted Option
    None None
    AudioSource Unity
    Direct System
    APIOnly System

    See Audio Output Mode for more detailed imformation.

    Scripting

    Unity

    using UnityEngine;
    using UnityEngine.Video;
    public class Example : MonoBehaviour
    {
        void Start()
        {
            GameObject camera = GameObject.Find("Main Camera");
            var videoPlayer = camera.AddComponent<UnityEngine.Video.VideoPlayer>();
            videoPlayer.playOnAwake = false;
            videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
            videoPlayer.targetCameraAlpha = 0.5F;
            videoPlayer.url = "Example.mov";
            videoPlayer.frame = 100;
            videoPlayer.isLooping = true;
            videoPlayer.loopPointReached += EndReached;
            videoPlayer.Play();
        }
        void EndReached(UnityEngine.Video.VideoPlayer vp)
        {
            vp.playbackSpeed = vp.playbackSpeed / 10.0F;
        }
    }
    

    AVPro

    using UnityEngine;
    using RenderHeads.Media.AVProVideo;
    public class TestingScript : MonoBehaviour
    {
        void Start()
        {
            GameObject camera = GameObject.Find("Main Camera");
            // the only needed change
            var videoPlayer = camera.AddComponent<VideoPlayer_AVPro>();
            videoPlayer.playOnAwake = false;
            videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
            videoPlayer.targetCameraAlpha = 0.5F;
            videoPlayer.url = "Example.mov";
            videoPlayer.frame = 100;
            videoPlayer.isLooping = true;
            videoPlayer.loopPointReached += EndReached;
            videoPlayer.Play();
        }
        void EndReached(VideoPlayer_AVPro vp)
        {
            vp.playbackSpeed = vp.playbackSpeed / 10.0F;
        }
    }
    

    Example code from https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Video.VideoPlayer.html

    Converting to Media Player

    alt-text

    If you desire the higher level of customizability and control that AVPro offers, you will need to convert from the VideoPlayerAVPro to the MediaPlayer. This can be done through a menu item on the VideoPlayerAVPro.
    Once converted, see MediaPlayer for more information on its usage.

    In This Article