Skip to main content

VideoPlayer

info

VideoPlayer inherits from Behaviour

Plays video content onto a target.

Members

Properties

NameDescription
VideoPlayer.aspectRatioDefines how the video content will be stretched to fill the target area.
VideoPlayer.audioOutputModeDestination for the audio embedded in the video.
VideoPlayer.audioTrackCountNumber of audio tracks found in the data source currently configured. (Read Only)
VideoPlayer.canSetDirectAudioVolumeWhether direct-output volume controls are supported for the current platform and video format. (Read Only)
VideoPlayer.canSetPlaybackSpeedWhether the playback speed can be changed. (Read Only)
VideoPlayer.canSetSkipOnDropWhether frame-skipping to maintain synchronization can be controlled. (Read Only)
VideoPlayer.canSetTimeWhether current time can be changed using the time or timeFrames property. (Read Only)
VideoPlayer.canSetTimeSourceWhether the time source followed by the VideoPlayer can be changed. (Read Only)
VideoPlayer.canStepReturns true if the VideoPlayer can step forward through the video content. (Read Only)
VideoPlayer.clipThe clip being played by the VideoPlayer.
VideoPlayer.clockResyncOccurredInvoked when the VideoPlayer clock is synced back to its VideoTimeReference.
VideoPlayer.clockTimeThe clock time that the VideoPlayer follows to schedule its samples. The clock time is expressed in seconds. (Read Only)
VideoPlayer.controlledAudioTrackCountNumber of audio tracks that this VideoPlayer will take control of.
VideoPlayer.errorReceivedErrors such as HTTP connection problems are reported through this callback.
VideoPlayer.externalReferenceTimeReference time of the external clock the VideoPlayer uses to correct its drift.
VideoPlayer.frameCountNumber of frames in the current video content. (Read Only)
VideoPlayer.frameRateThe frame rate of the clip or URL in frames/second. (Read Only)
VideoPlayer.frameReadyInvoked when a new frame is ready.
VideoPlayer.heightThe height of the images in the VideoClip, or URL, in pixels. (Read Only)
VideoPlayer.isLoopingDetermines whether the VideoPlayer restarts from the beginning when it reaches the end of the clip.
VideoPlayer.isPausedWhether playback is paused. (Read Only)
VideoPlayer.isPlayingWhether content is being played. (Read Only)
VideoPlayer.isPreparedWhether the VideoPlayer has successfully prepared the content to be played. (Read Only)
VideoPlayer.lengthThe length of the VideoClip, or the URL, in seconds. (Read Only)
VideoPlayer.loopPointReachedInvoked when the VideoPlayer reaches the end of the content to play.
VideoPlayer.pixelAspectRatioDenominatorDenominator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
VideoPlayer.pixelAspectRatioNumeratorNumerator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
VideoPlayer.playbackSpeedFactor by which the basic playback rate will be multiplied.
VideoPlayer.playOnAwakeWhether the content will start playing back as soon as the component awakes.
VideoPlayer.prepareCompletedInvoked when the VideoPlayer preparation is complete.
VideoPlayer.renderModeWhere the video content will be drawn.
VideoPlayer.seekCompletedInvoke after a seek operation completes.
VideoPlayer.sendFrameReadyEventsEnables the frameReady events.
VideoPlayer.skipOnDropWhether the VideoPlayer is allowed to skip frames to catch up with current time.
VideoPlayer.sourceThe source that the VideoPlayer uses for playback.
VideoPlayer.startedInvoked immediately after Play is called.
VideoPlayer.targetMaterialPropertyMaterial texture property which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride.
VideoPlayer.targetMaterialRendererRenderer which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride
VideoPlayer.textureInternal texture in which video content is placed. (Read Only)
VideoPlayer.timeThe presentation time of the currently available frame in VideoPlayer.texture.
VideoPlayer.timeReferenceThe clock that the VideoPlayer observes to detect and correct drift.
VideoPlayer.timeSourceThe source used used by the VideoPlayer to derive its current time.
VideoPlayer.urlThe file or HTTP URL that the VideoPlayer reads content from.
VideoPlayer.waitForFirstFrameDetermines whether the VideoPlayer will wait for the first frame to be loaded into the texture before starting playback when VideoPlayer.playOnAwake is on.
VideoPlayer.widthThe width of the images in the VideoClip, or URL, in pixels. (Read Only)

Static Properties

NameDescription
VideoPlayer.controlledAudioTrackMaxCountMaximum number of audio tracks that can be controlled. (Read Only)

Methods

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

Inherited Members

Inherited Properties

NameDescription
VideoPlayer.enabledEnabled Behaviours are Updated, disabled Behaviours are not.
VideoPlayer.isActiveAndEnabledHas the Behaviour had active and enabled called?
VideoPlayer.gameObjectThe game object this component is attached to. A component is always attached to a game object.
VideoPlayer.tagThe tag of this game object.
VideoPlayer.transformThe Transform attached to this GameObject.
VideoPlayer.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
VideoPlayer.nameThe name of the object.

Inherited Methods

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