Search Results for

    Show / Hide Table of Contents

    Video Player AVPro

    alt-text

    The VideoPlayer_AVPro component is meant to act as an out of the box replacement for the Unity VideoPlayer component. It acts as a wrapper for converting VideoPlayer variables/functions to their MediaPlayer equivalents.

    Conversion

    To convert a VideoPlayer to the VideoPlayer_AVPro component, you can either use the context menu on the VideoPlayer to automatically convert it, or use the context menu on an already added VideoPlayer_AVPro.
    See Usage Guide for more information.

    Properties

    Property Function
    Source Specifies the type of source - either Media Reference or Path. Media Reference allows selection of an existing media asset. Path allows specifying media direct into the VideoPlayer_AVPro
    Media Reference The MediaReference asset to use for loading
    Source Path The location of the media (URL or file path)
    Play On Awake Play the media as soon as it has loaded
    Auto Open Open/Load the media on Start
    Loop Loop the playback
    Playback Speed Speed up or slow down playback by this rate
    Render Mode Selects the rendering mode to be used (See Render Mode)
    Audio Output Mode Selects the audio output mode to be used (See Audio Output Mode)

    Render Mode

    Unlike Unity's VideoPlayer AVPro does not display the video in the unity scene. To do this you need to select one of the options from the RenderMode dropdown which will automatically add the required component to the current object.

    • Mesh

      alt text

      The mesh option will apply the video to the selected renderer through its materials. See Apply To Mesh for more information.

      Property Function
      Renderer The target Renderer (eg MeshRenderer) to apply the video texture to
      Texture Property The name of the Material texture to set. The default texture property depends on the render pipeline used. Standard shaders use _MainTex. URP shaders use _Basemap. HDRP shaders use _BasecolorMap
    • Material

      alt text

      The Material option will apply the video to the selected material. See Apply To Material for more information.

      Property Function
      Material The target Material to apply the video texture to
      Texture Property The name of the Material texture to set. The default texture property depends on the render pipeline used. Standard shaders use _MainTex. URP shaders use _Basemap. HDRP shaders use _BasecolorMap
    • uGUI

      alt text

      alt text

      The uGUI option will display the video on screen using the standard unity UI system. This render mode works differently to the rest, and as such the componenet will have to be added manually by the user. This is because it needs to be attached to a canvas with a canvas renderer to function correctly. See Display uGUI for more information.

      Property Function
      uGUI Component The Display uGUI component that is being used
      Color The color to multiply the video by. Useful for fading to black or fading to transparent
      UV Scaling and offset to apply to the texture
      Set Native Size Adjust the size of the RectTransform to match the resolution of the video texture
      Aspect Ratio Aspect ratio fitting mode to use
    • IMGUI

      alt text

      The IMGUI option will display the video on screen using the legacy IMGUI rendering system. See Display IMGUI for more information.

      Property Function
      Full Screen Whether to display across the entire screen or allow a rectangle area to be specified
      Color The color to multiply the video by. Useful for fading to black or fading to transparent
      Aspect Ratio Aspect ratio fitting mode to use
    • Camera Far Plane

      alt text

      The CameraFarPlane option will display the video at the camera far plane, i.e. behind all other objects in the scene. See Apply To Far Plane for more information. Note - This does not work if the background clear mode of the camera is set to Skybox

      Property Function
      Color The color to multiply the video by. Useful for fading to black or fading to transparent
      Aspect Ratio Aspect ratio fitting mode to use
      Alpha The alpha of the displayed video
    • Render Texture

      alt text

      The RenderTexture option will render the video to a Unity RenderTexture. See ResolveToRenderTexture for more information.

      Property Function
      Render Texture Render Texture to render the video out to
      Aspect Ratio Aspect ratio fitting mode to use
    • None

      When None is selected, no componenet will be added. Instead it is presumed that you have created a custom script that will handle the rendering of the video.

    Audio Output Mode

    The audio output mode will allow the you to select how the audio is played.

    Global Properties Function
    Volume Volume in 0..1 range
    Mute Whether to mute audio playback
    • System

      alt text

      Will play the audio directly from the system.

    • Unity

      alt text

      Will play the audio through a Unity AudioSource which is automatically added to the gameobject upon selection, as well as an AudioOutput Component.

      Unique Properties Function
      AudioSource The AudioSource to use for audio playback
    • Facebook Audio 360

      alt text

      Will play the audio using Facebooks 360 audio. See 360 Audio For more information.

      Unique Properties Function
      Channel Mode Channel Mode to use during audio playback
      Audio Device name Audio Device to use for playback
    • None Audio

      When None is selected no audio will be played.

    Api

    Unity Wrapper

    following is a list of all properties/methods/events/delegates of the Unity VideoPlayer that have been wrapped, as well as a explanation of the funconality differences and a compatability ranking.

    Unity's VideoPlayer scripting API can be found Here

    Icon Meaning
    - AVPro does not contain any similar functionality, a warning will show on use
    ! AVPro has similar functionality, but it may be a differernt Type / workings under the hood.
    # Full Functionality

    Static Properties

    Property Functonality Compatability
    controlledAudioTrackMaxCount No Similar Functionality -

    Properties

    Property Functonality / Differences Compatability
    aspectRatio Uses ScaleMode to set how a video fits the target area, unless using CameraFarPlane or RenderTexture which both use VideoResolveOptions.AspectRatio !
    audioOutputMode automatically converts VideoAudioOutputMode to correct AVPro audio output depending on the platform, stored in audioOutputModeAVPro !
    audioTrackCount N/A #
    canSetDirectAudioVolume N/A #
    canSetPlaybackSpeed N/A #
    canSetSkipOnDrop Although this functions, canSetSkipOnDrop has no functionality within AVPro #
    canSetTime N/A #
    canSetTimeUpdateMode Although this functions timeUpdateMode has no functionality within AVPro #
    canStep N/A #
    clip Uses MediaReference insted of VideoClip, video clips will be converted when converting between VideoPlayer and VideoPlayer_AVPro, but will have to be done manually elseware. !
    clockTime When not using the resampler it is possible to reset the total number of frames, which would cause this calcualted value to be incorrect. #
    controlledAudioTrackCount AVPro only supports 1 active audio track !
    externalReferenceTime No Similar Functionality -
    frame N/A #
    frameCount N/A #
    frameRate N/A #
    height N/A #
    isLooping N/A #
    isPaused N/A #
    isPlaying N/A #
    isPrepared Returns true if the content can be played #
    length N/A #
    pixelAspectRatioDenominator No Similar Functionality -
    pixelAspectRatioNumerator No Similar Functionality -
    playbackSpeed N/A #
    playOnAwake N/A #
    renderMode Automatically Converts VideoRenderMode to DisplayType, stored in rendererMode #
    sendFrameReadyEvents No Similar Functionality -
    skipOnDrop No Similar Functionality -
    source Automatically converts VideoSource to MediaSource, stored in sourceAVPro #
    targetCamera N/A #
    targetCamera3DLayout No Similar Functionality -
    targetCameraAlpha Changes the alpah setting for each of the DisplayTypes #
    targetMaterialProperty N/A #
    targetMaterialRenderer N/A #
    targetTexture N/A #
    texture N/A #
    time N/A #
    timeReference No Similar Functionality -
    timeUpdateMode No Similar Functionality -
    url uses MediaPath, but will allow getting/setting as string. #
    waitForFirstFrame No Similar Functionality -
    width N/A #

    Public Methods

    Public Method Functonality / Differences Compatability
    EnableAudioTrack Set active audio track, AVPro does not currently support more than 1 audio track being active. !
    GetAudioChannelCount N/A #
    GetAudioLanguageCode N/A #
    GetAudioSampleRate returns the global audio sameple rate !
    GetDirectAudioMute N/A #
    GetDirectAudioVolume N/A #
    GetTargetAudioSource N/A #
    IsAudioTrackEnabled N/A #
    Pause N/A #
    Play N/A #
    Prepare N/A #
    SetDirectAudioMute N/A #
    SetDirectAudioVolume N/A #
    SetTargetAudioSource N/A #
    StepForward N/A #
    Stop N/A #

    Events

    Event Functonality / Differences Compatability
    clockResyncOccurred No Similar Functionality -
    errorReceived N/A #
    frameDropped No Similar Functionality -
    frameReady No Similar Functionality -
    loopPointReached No Similar Functionality -
    prepareCompleted N/A #
    seekCompleted N/A #
    started N/A #

    Delegates

    Delegate Functonality / Differences Compatability
    ErrorEventHandler N/A #
    EventHandler N/A #
    FrameReadyEventHandler N/A #
    TimeEventHandler N/A #

    Custom Methods/Properties

    Properties

    Property Functonality
    sourceAVPro The source that the VideoPlayer_AVPro will use for playback
    targetMaterial Material that is targeted when rendererMode is set to DisplayType.Material
    rendererMode Where/how the video content will be drawn.
    Will create the desired components when renderer mode is changed
    audioOutputModeAVPro Destination for the audio embedded in the video.
    color Color property which is targeted when rendererMode is set to:
    DisplayType.IMGUI, DisplayType.uGUI, DisplayType.RenderTexture
    fullScreen used to toggle fullscreen when rendererMode is set to: DisplayType.IMGUI
    volume Increase/Decrease the global volume of the audio
    muted Toggle the audio
    audioSource The AudioSource to use when audioOutputModeAVPro is set to play though Unity
    uvRect The Rect to use to control texture scaling/offset when rendererMode is set to DisplayType.uGUI

    Public Methods

    Method Functonality
    VideoPlayerTo_AVPro_MenuItem Converts the attached VideoPlayer componenet to a VideoPlayer_AVPro component, through the context menu of the VideoPlayer.
    VideoPlayertoAVProConversion Adds a context menu option to VideoPlayer_AVPro that will copy all of the data from a Unity VideoPlayer into the VideoPlayer_AVPro. making conversions where neccessary.
    ConvertToMediaPlayer This method will convert a VideoPlayer_AVPro component to a MediaPlayer component.
    CreateAudioComponents Creates an AudioOutput component that will be used to play audio when selecting the Unity option from the list of audio output modes.
    CreateRendererComponents Creates the components for the differernt rendering modes. This method also calls DestroyRendererBehaviours to handles the destruction of the previous rendering mode components.
    DestroyAudioOutputBehaviour Destroys the AudioOutput component attached to this object.
    DestroyRendererBehaviours Destroys the rendering mode components attatched to the current object, can handle more than 1 type but not multiple of the same type.
    SetOutputModeContextual This will set the output mode based on the context.
    Material - Object containing a Renderer component with material attache
    UGUI - Object containing both a CanvasRenderer and RectTransform
    IMGUI - Default Option
    OutputModeSet returns true if any output mode has been set otherwise returns false

    Video Clip

    Unity VideoClip AVPro MediaReference
    alt-text alt-text

    Unity's VideoPlayer and AVPro use "clips" in very differernt ways. The Unity VideoClip contains the media itself, whereas AVPro's MediaReference holds the path to the media, and its properties. This means that most calls to VideoClip functions will have to be changed manually to make them have the correct functionality. See MediaReference for more information.

    VideoClip VideoPlayer_AVPro Equivalent
    VideoClip.audioTrackCount VideoPlayer_AVPro.audioTrackCount
    VideoClip.frameCount VideoPlayer_AVPro.frameCount
    VideoClip.frameRate VideoPlayer_AVPro.frameRate
    VideoClip.height VideoPlayer_AVPro.height
    VideoClip.length VideoPlayer_AVPro.length
    VideoClip.originalPath Path is stored within MediaReference
    VideoClip.pixelAspectRatioDenominator VideoPlayer_AVPro pixelAspectRationDenominator
    VideoClip.pixelAspectRatioNumerator VideoPlayer_AVPro.pixelAspectRationNumerator
    VideoClip.sRGB VideoPlayer_AVPro.Info.PlayerSupportsLinearColorSpace
    VideoClip.width VideoPlayer_AVPro.width
    VideoClip.GetAudioChannelCount(ushort audioTrackIdx) VideoPlayer_AVPro.GetAudioChannelCount(audioTrackIdx)
    VideoClip.GetAudioLanguage(ushort audioTrackIdx) VideoPlayer_AVPro.GetAudioLanguageCode(audioTrackIdx)
    VideoClip.GetAudioSampleRate(ushort audioTrackIdx) VideoPlayer_AVPro.GetAudioSampleRate(audioTrackIdx)
    In This Article