Table of Contents

Class VideoPlayer_AVPro

Namespace
RenderHeads.Media.AVProVideo
Assembly
_AVProVideo.Extensions.VideoPlayer.dll
public class VideoPlayer_AVPro : MediaPlayer, ISerializationCallbackReceiver
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
VideoPlayer_AVPro
Implements
ISerializationCallbackReceiver
Inherited Members

Fields

Name Description
_converted
_renderModeComponent
applyToFarPlane
applyToMaterial
applyToMesh
applyToTexture
canvasObj
controlledAudioTrackMaxCount

Maximum number of audio tracks that can be controlled. (Read Only)

currentRenderMode
displayIMGUI
displayUGUI
sendFrameReadyEvents

Warning AVPro does not currently support this

Properties

Name Description
WaitForFirstFrame

Determines whether the VideoPlayer will wait for the first frame to be loaded into the texture before starting playback when VideoPlayer.playOnAwake is on.

Warning AVPro does not currently support this

aspectRatio

Defines how the video content will be stretched to fill the target area.

aspectRatioRenderTexture
audioOutputMode

Destination for the audio embedded in the video.

audioOutputModeAVPro

Destination for the audio embedded in the video.

audioSource

The UnityEngine.AudioSource to use when audioOutputModeAVPro is set to Unity

audioTrackCount

Number of audio tracks found in the data source currently configured. (Read Only)

canSetDirectAudioVolume

Whether direct-output volume controls are supported for the current platform and video format. (Read Only) only possible when the video has been prepared

canSetPlaybackSpeed

Whether you can change the playback speed. (Read Only) only possible when the video has been prepared

canSetSkipOnDrop

Whether frame-skipping to maintain synchronization can be controlled. (Read Only) only possible when the video has been prepared.

Warning Although This functions, skipOnDrop has no functionality within AVPro

canSetTime

Whether you can change the current time using the time or frames property. (Read Only) Only Possible when the video has been prepared.

canSetTimeUpdateMode

Whether you can change the time source followed by the VideoPlayer. (Read Only)

Warning Although This functions, timeUpdateMode has no functionality within AVPro

canStep

Returns true if the VideoPlayer can step forward through the video content. (Read Only)

clip

The clip being played by the VideoPlayer_AVPro.

clockTime

The clock time that the VideoPlayer follows to schedule its samples. The clock time is expressed in seconds. (Read Only)

color

UnityEngine.Color property which is targeted when rendererMode is set to:

IMGUI, uGUI, RenderTexture

controlledAudioTrackCount

Number of audio tracks that this VideoPlayer will take control of.

Warning AVPro currently only supports 1 active audio track

externalReferenceTime

Reference time of the external clock the VideoPlayer uses to correct its drift.

AVPro - this returns GetCurrentTime() which is not the same functionality as VideoPlayer

frame

Returns the current video time in frames

frameCount

Number of frames in the current video content. (Read Only)

frameRate

he frame rate of the clip or URL in frames/second. (Read Only)

fullScreen

used to toggle fullscreen when rendererMode is set to: IMGUI

height

The height of the images in the VideoClip, or URL, in pixels. (Read Only)

isLooping

Determines whether the VideoPlayer_AVPro restarts from the beginning when it reaches the end of the clip.

isPaused

Whether playback is paused. (Read Only)

isPlaying

Whether content is being played. (Read Only)

isPrepared

Whether the VideoPlayer has successfully prepared the content to be played. (Read Only)

length

The length of the VideoClip, or the URL, in seconds. (Read Only)

muted

used to toggle weather or not the audio is muted

pixelAspectRationDenominator

Denominator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)

Warning AVPro Does not currently support this

pixelAspectRationNumerator

Numerator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)

Warning AVPro Does not currently support this

playOnAwake

Whether the content will start playing back as soon as the component awakes.

playbackSpeed

Factor by which the basic playback rate will be multiplied.

renderMode

Where/how the video content will be drawn.

Recomended to convert to using DisplayType with rendererMode otherwise unexpected behaviour may occur

AVPro:

rendererMode

Where/how the video content will be drawn.

will create the desired components when renderer mode is changed

skipOnDrop

Whether the VideoPlayer is allowed to skip frames to catch up with current time.

Warning AVPro does not currently support this

source

The source that the VideoPlayer_AVPro uses for playback.

AVPro:

sourceAVPro

The source that the VideoPlayer_AVPro will use for playback

targetCamera

Camera component to draw to when VideoPlayer.renderMode is set to either VideoRenderMode.CameraFarPlane or VideoRenderMode.CameraNearPlane.

targetCamera3DLayout

Type of 3D content contained in the source video media.

Warning AVPro does not currently support this

targetCameraAlpha

overall alpha being applied to the color on the respective rendererMode component

targetMateralProperty

UnityEngine.Material texture property which is targeted when rendererMode is set to:

Mesh, Material

targetMaterial

UnityEngine.Material that is targeted when rendererMode is set to Material

targetMaterialRenderer

UnityEngine.Renderer which is targeted when rendererMode is set to Material

targetTexture

UnityEngine.RenderTexture to draw to when rendererMode is set to RenderTexture.

texture

Internal texture in which video content is placed. (Read Only)

time

The presentation time of the currently available frame in VideoPlayer.texture.

timeReference

The clock that the VideoPlayer observes to detect and correct drift.

Warning AVPro does not currently support this

timeUpdateMode

The clock source used by the VideoPlayer to derive its current time.

Warning AVPro does not currently support this

url

The file or HTTP URL that the VideoPlayer_AVPro reads content from.

AVPro - utilizes MediaPath to store

Will automatically set the path type of the sourceAVPro

uvRect

The UnityEngine.Rect to use to control texture scaling/offset when rendererMode is set to uGUI

volume

Used to change the volume of the audio

width

The width of the images in the VideoClip, or URL, in pixels. (Read Only)

Methods

Name Description
Awake()

this will ensure that the media player is properly initilized when turning on

ConvertToMediaPlayer()

This method will convert, VideoPlayer_AVPro to a MediaPlayer, this is alot simpler than converting from VideoPlayer to VideoPlayer_AVPro, as all the data matches so can just set it all

CreateAudioComponents()

Creates a AudioOutput compoenent that will be used to play audio when selecting the Unity option from Windows.AudioOutput

CreateRendererComponents()

Creates the components for the differernt rendering modes, this method also handles the destruction of the previous rendering mode components.

DestroyAudioOutputBehaviour()

Destroys the AudioOutput compoenent attached to this object

This componenet is used to take the audio from the video codec and play it through a unity AudioSource compoenent

DestroyRendererBehaviours()

Destroys the rendering mode compoennts attatched to the current object, can handle more than 1 type but not multiple of the same type

EnableAudioTrack(ushort, bool)

VideoRecord:

  • Enable/disable audio track decoding. Only effective when the VideoPlayer_AVPro is not currently playing AVPro:
  • Changes current active audio track. Only effective when not currently playing.
  • Will Mute the track if enabled is set to false
EventCallbacks(MediaPlayer, EventType, ErrorCode)

Used to simulate and invoke the UnityEngine.Video.VideoPlayer events

GetAudioChannelCount(ushort)

The number of audio channels in the specified audio track.

GetAudioLanguageCode(ushort)

Returns the language code, if any, for the specified track.

GetAudioSampleRate(ushort)

VideoPlayer:

  • Returns the audio track sampling rate in Hertz. AVPro:
  • Returns the unity AudioSettings global sampleRate
GetDirectAudioMute(ushort)

VideoRecord:

  • Gets the direct-output audio mute status for the specified track. AVPro:
  • retruns the global mute state, as currently, tracks have no recognition of volume and muted, these are handled globally.
GetDirectAudioVolume(ushort)

AVPro:

  • retruns the global volume, as currently, tracks have no recognition of volume and muted, these are handled globally.
GetTargetSource(ushort)
IsAudioTrackEnabled(ushort)

Wherther the current track is the active audio track

OnDisable()
OnEnable()
OutputModeSet()

Used to check if any of the output modes have been set

Pause()

Pauses Playback

Play()

Plays the media, ensuring the appropriate display components are enabled based on the current renderer mode.

Prepare()

Initialises the Media Player, to start being able to play Will Create the base media player and initialize it

SetDirectAudioMute(ushort, bool)
  • Sets the global direct-output audio mute status
SetDirectAudioVolume(ushort, float)
  • Set the global direct-output volume
SetOutputModeContextual()

This will set the output mode based on the context.

  • Material - Object containing a UnityEngine.Renderer component with material attached
  • UGUI - Object containing both a UnityEngine.CanvasRenderer and UnityEngine.RectTransform
  • IMGUI - Default Option
SetTargetAudioSource(ushort, AudioSource)

Sets the AudioSource that will receive audio samples for the specified track if using AudioSource

Start()

this will handle setting up the rendering component, based on the object that it is placed on (if it was not generated by a conversion (i which case it will use the same output mode as the one used on the orignal video player))

StepForward()

Advances the current time by one frame immediately

Stop()

Stops playback and set current playback time to 0

VideoPlayerTo_AVPro_MenuItem(MenuCommand)

Converts the attached VideoPlayer componenet on an object to a VideoPlayer_AVPro, through the context menu of the script

Events

Name Description
clockResyncOccurred
errorReceived
frameDropped
frameReady
loopPointReached
prepareCompleted
seekCompleted
started