Skip to content

API > VideoPlayer


VideoPlayer⚓︎

VideoPlayer inherits from Behaviour

Plays video content onto a target.

Members⚓︎

Properties⚓︎

Name Description
VideoPlayer.aspectRatioProperty Defines how the video content will be stretched to fill the target area.
VideoPlayer.audioOutputModeProperty Destination for the audio embedded in the video.
VideoPlayer.audioTrackCountProperty Number of audio tracks found in the data source currently configured. (Read Only)
VideoPlayer.canSetDirectAudioVolumePropertyReadonly Property Whether direct-output volume controls are supported for the current platform and video format. (Read Only)
VideoPlayer.canSetPlaybackSpeedPropertyReadonly Property Whether the playback speed can be changed. (Read Only)
VideoPlayer.canSetSkipOnDropPropertyReadonly Property Whether frame-skipping to maintain synchronization can be controlled. (Read Only)
VideoPlayer.canSetTimePropertyReadonly Property Whether current time can be changed using the time or timeFrames property. (Read Only)
VideoPlayer.canSetTimeSourcePropertyReadonly Property Whether the time source followed by the VideoPlayer can be changed. (Read Only)
VideoPlayer.canStepPropertyReadonly Property Returns true if the VideoPlayer can step forward through the video content. (Read Only)
VideoPlayer.clipProperty The clip being played by the VideoPlayer.
VideoPlayer.clockResyncOccurredPropertyReadonly Property Invoked when the VideoPlayer clock is synced back to its VideoTimeReference.
VideoPlayer.clockTimeProperty The clock time that the VideoPlayer follows to schedule its samples. The clock time is expressed in seconds. (Read Only)
VideoPlayer.controlledAudioTrackCountProperty Number of audio tracks that this VideoPlayer will take control of.
VideoPlayer.errorReceivedPropertyReadonly Property Errors such as HTTP connection problems are reported through this callback.
VideoPlayer.externalReferenceTimeProperty Reference time of the external clock the VideoPlayer uses to correct its drift.
VideoPlayer.frameCountProperty Number of frames in the current video content. (Read Only)
VideoPlayer.frameRateProperty The frame rate of the clip or URL in frames/second. (Read Only)
VideoPlayer.frameReadyPropertyReadonly Property Invoked when a new frame is ready.
VideoPlayer.heightProperty The height of the images in the VideoClip, or URL, in pixels. (Read Only)
VideoPlayer.isLoopingPropertyReadonly Property Determines whether the VideoPlayer restarts from the beginning when it reaches the end of the clip.
VideoPlayer.isPausedPropertyReadonly Property Whether playback is paused. (Read Only)
VideoPlayer.isPlayingPropertyReadonly Property Whether content is being played. (Read Only)
VideoPlayer.isPreparedPropertyReadonly Property Whether the VideoPlayer has successfully prepared the content to be played. (Read Only)
VideoPlayer.lengthPropertyReadonly Property The length of the VideoClip, or the URL, in seconds. (Read Only)
VideoPlayer.loopPointReachedPropertyReadonly Property Invoked when the VideoPlayer reaches the end of the content to play.
VideoPlayer.pixelAspectRatioDenominatorPropertyReadonly Property Denominator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
VideoPlayer.pixelAspectRatioNumeratorPropertyReadonly Property Numerator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
VideoPlayer.playbackSpeedProperty Factor by which the basic playback rate will be multiplied.
VideoPlayer.playOnAwakeProperty Whether the content will start playing back as soon as the component awakes.
VideoPlayer.prepareCompletedPropertyReadonly Property Invoked when the VideoPlayer preparation is complete.
VideoPlayer.renderModeProperty Where the video content will be drawn.
VideoPlayer.seekCompletedPropertyReadonly Property Invoke after a seek operation completes.
VideoPlayer.sendFrameReadyEventsProperty Enables the frameReady events.
VideoPlayer.skipOnDropProperty Whether the VideoPlayer is allowed to skip frames to catch up with current time.
VideoPlayer.sourceProperty The source that the VideoPlayer uses for playback.
VideoPlayer.startedPropertyReadonly Property Invoked immediately after Play is called.
VideoPlayer.targetMaterialPropertyProperty Material texture property which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride.
VideoPlayer.targetMaterialRendererProperty Renderer which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride
VideoPlayer.textureProperty Internal texture in which video content is placed. (Read Only)
VideoPlayer.timeProperty The presentation time of the currently available frame in VideoPlayer.texture.
VideoPlayer.timeReferenceProperty The clock that the VideoPlayer observes to detect and correct drift.
VideoPlayer.timeSourceProperty The source used used by the VideoPlayer to derive its current time.
VideoPlayer.urlProperty The file or HTTP URL that the VideoPlayer reads content from.
VideoPlayer.waitForFirstFrameProperty Determines whether the VideoPlayer will wait for the first frame to be loaded into the texture before starting playback when VideoPlayer.playOnAwake is on.
VideoPlayer.widthProperty The width of the images in the VideoClip, or URL, in pixels. (Read Only)

Static Properties⚓︎

Name Description
VideoPlayer.controlledAudioTrackMaxCount Static fieldProperty Maximum number of audio tracks that can be controlled. (Read Only)

Methods⚓︎

Name Description
VideoPlayer.EnableAudioTrack(trackIndex, enabled) Method Enable/disable audio track decoding. Only effective when the VideoPlayer is not currently playing.
VideoPlayer.GetAudioChannelCount(trackIndex) Method The number of audio channels in the specified audio track.
VideoPlayer.GetAudioLanguageCode(trackIndex) Method Returns the language code, if any, for the specified track.
VideoPlayer.GetAudioSampleRate(trackIndex) Method Gets the audio track sampling rate in Hertz.
VideoPlayer.GetDirectAudioMute(trackIndex) Method Gets the direct-output audio mute status for the specified track.
VideoPlayer.GetDirectAudioVolume(trackIndex) Method Return the direct-output volume for specified track.
VideoPlayer.GetTargetAudioSource(trackIndex) Method Gets the AudioSource that will receive audio samples for the specified track if VideoPlayer.audioOutputMode is set to VideoAudioOutputMode.AudioSource.
VideoPlayer.IsAudioTrackEnabled(trackIndex) Method Whether decoding for the specified audio track is enabled. See VideoPlayer.EnableAudioTrack for distinction with mute.
VideoPlayer.Pause() Method Pauses the playback and leaves the current time intact.
VideoPlayer.Play() Method Starts playback.
VideoPlayer.Prepare() Method Initiates playback engine preparation.
VideoPlayer.SetDirectAudioMute(trackIndex, mute) Method Set the direct-output audio mute status for the specified track.
VideoPlayer.SetDirectAudioVolume(trackIndex, volume) Method Set the direct-output audio volume for the specified track.
VideoPlayer.SetTargetAudioSource(trackIndex, source) Method Sets the AudioSource that will receive audio samples for the specified track if this audio target is selected with VideoPlayer.audioOutputMode.
VideoPlayer.StepForward() Method Advances the current time by one frame immediately.
VideoPlayer.Stop() Method Stops the playback and sets the current time to 0.

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
VideoPlayer.enabledProperty Enabled Behaviours are Updated, disabled Behaviours are not.
VideoPlayer.isActiveAndEnabledProperty Has the Behaviour had active and enabled called?
VideoPlayer.gameObjectPropertyReadonly Property The game object this component is attached to. A component is always attached to a game object.
VideoPlayer.tagPropertyReadonly Property The tag of this game object.
VideoPlayer.transformPropertyReadonly Property The Transform attached to this GameObject.
VideoPlayer.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
VideoPlayer.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
VideoPlayer.BroadcastMessage(methodName, parameter=nil)Method Calls the method named methodName on every Lua Script in this game object or any of its children.
VideoPlayer.CompareTag(tag)Method Is this game object tagged with tag ?
VideoPlayer.GetAllLuaScripts()Method Returns an array of all Lua scripts that attached to the game object.
VideoPlayer.GetComponent(type)Method Returns the component of Type type if the game object has one attached, nil if it doesn't.
VideoPlayer.GetComponentInChildren(t)Method Returns the component of Type type in the GameObject or any of its children using depth first search.
VideoPlayer.GetComponentInParent(t)Method Returns the component of Type type in the GameObject or any of its parents.
VideoPlayer.GetComponents(type)Method Returns all components of Type type in the GameObject.
VideoPlayer.GetComponentsInChildren(t)Method Returns all components of Type type in the GameObject or any of its children.
VideoPlayer.GetComponentsInParent(t)Method Returns all components of Type type in the GameObject or any of its parents.
VideoPlayer.SendMessage(methodName, value=nil)Method Calls the method named methodName on every Lua Script in this game object.
VideoPlayer.SendMessageUpwards(methodName, value=nil)Method Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
VideoPlayer.TryGetComponent(type)Method Gets the component of the specified type, if it exists.
VideoPlayer.GetInstanceID()Method Returns the instance id of the object.

Extra Detail⚓︎

Content can be either a VideoClip imported asset or a URL such as file:// or http://. Video content will be projected onto one of the supported targets, such as camera background or RenderTexture. If the video content includes transparency, this transparency will be present in the target, allowing objects behind the video target to be visible. When the data VideoPlayer.source is set to URL, the audio and video description of what is being played will only be initialized once the VideoPlayer preparation is completed. You can test this with VideoPlayer.isPrepared.