Class VideoPlayer
Video playback utility. Video content can be presented in UI (via VideoBrush), used in materials (via texture parameter bind) or used manually in shaders.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Video/VideoPlayer.h
Syntax
public class VideoPlayer : public Actor
Constructors
~VideoPlayer()
Declaration
public ~VideoPlayer()
Fields
PlayOnStart
Determines whether the video clip should autoplay on level start.
Declaration
public bool PlayOnStart = false
Field Value
bool
|
StartTime
Determines the time (in seconds) at which the video clip starts playing if Play On Start is enabled.
Declaration
public float StartTime = 0.0f
Field Value
float
|
Url
The video clip Url path used as a source of the media. Can be local file (absolute or relative path), or streamed resource ('http://').
Declaration
public String Url
Field Value
String
|
Methods
BeginPlay(SceneBeginData* data)
Called when adding object to the game.
Declaration
protected virtual void BeginPlay(SceneBeginData* data) override
Parameters
SceneBeginData
data
The initialization data (e.g. used to collect joints to link after begin). |
Overrides
GetAudioAttenuation()
Gets the attenuation that controls how quickly does audio volume drop off as the listener moves further from the video player. Used by spatial audio only.
Declaration
public float GetAudioAttenuation() const
Returns
float
|
GetAudioMinDistance()
Gets the minimum distance at which audio attenuation starts. When the listener is closer to the video player than this value, audio is heard at full volume. Once farther away the audio starts attenuating. Used by spatial audio only.
Declaration
public float GetAudioMinDistance() const
Returns
float
|
GetAudioPan()
Gets the stereo pan of the played audio (-1 is left speaker, 1 is right speaker, 0 is balanced). The default is 0. Used by non-spatial audio only.
Declaration
public float GetAudioPan() const
Returns
float
|
GetAudioVolume()
Gets the volume of the audio played from this video, in [0, 1] range.
Declaration
public float GetAudioVolume() const
Returns
float
|
GetDuration()
Gets the media duration of playback (in seconds). Valid only when media was loaded by the video backend.
Declaration
public float GetDuration() const
Returns
float
|
GetEditorBox()
Gets actor bounding box (single actor, no children included) for editor tools.
Declaration
public virtual BoundingBox GetEditorBox() const override
Returns
BoundingBox
|
Overrides
GetFrame()
Gets the video frame texture (GPU resource). Created on the playback start. Can be binded to materials and shaders to display the video image.
Declaration
public GPUTexture* GetFrame() const
Returns
GPUTexture
|
GetFrameRate()
Gets the media frame rate of playback (amount of frames to be played per second). Valid only when media was loaded by the video backend.
Declaration
public float GetFrameRate() const
Returns
float
|
GetFramesCount()
Gets the amount of video frames decoded and send to GPU during playback. Can be used to detect if video has started playback with any visible changes (for video frame texture contents). Valid only when media was loaded by the video backend.
Declaration
public int32 GetFramesCount() const
Returns
int32
|
GetIsAudioSpatial()
If checked, video player us using spatialization to play 3d audio, otherwise will always play as 2d sound.
Declaration
public bool GetIsAudioSpatial() const
Returns
bool
|
GetIsLooping()
Determines whether the video clip should loop when it finishes playing.
Declaration
public bool GetIsLooping() const
Returns
bool
|
GetSize()
Gets the video frame dimensions (in pixels). Valid only when media was loaded by the video backend.
Declaration
public Int2 GetSize() const
Returns
Int2
|
GetState()
Gets the current state of the video playback (playing/paused/stopped).
Declaration
public VideoPlayer::States GetState() const
Returns
VideoPlayer::States
|
GetTime()
Gets the current time of playback. The time is in seconds, in range [0, Duration].
Declaration
public float GetTime() const
Returns
float
|
IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between the current object and a ray.
Declaration
public virtual bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
Returns
bool
True whether the two objects intersected, otherwise false. |
Overrides
OnDebugDrawSelected()
Draws debug shapes for the selected actor and all child scripts.
Declaration
public virtual void OnDebugDrawSelected() override
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
protected virtual void OnDisable() override
Overrides
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
protected virtual void OnEnable() override
Overrides
OnTransformChanged()
Called when actor transform gets changed.
Declaration
protected virtual void OnTransformChanged() override
Overrides
Pause()
Pauses the video playback.
Declaration
public void Pause()
Play()
Starts playing the currently assigned video Url.
Declaration
public void Play()
SetAudioAttenuation(float value)
Sets the attenuation that controls how quickly does audio volume drop off as the listener moves further from the video player. At 0, no distance attenuation ever occurs. Used by spatial audio only.
Declaration
public void SetAudioAttenuation(float value)
Parameters
float
value
|
SetAudioMinDistance(float value)
Sets the minimum distance at which audio attenuation starts. When the listener is closer to the video player than this value, audio is heard at full volume. Once farther away the audio starts attenuating. Used by spatial audio only.
Declaration
public void SetAudioMinDistance(float value)
Parameters
float
value
|
SetAudioPan(float value)
Sets the stereo pan of the played audio (-1 is left speaker, 1 is right speaker, 0 is balanced). The default is 0. Used by non-spatial audio only.
Declaration
public void SetAudioPan(float value)
Parameters
float
value
|
SetAudioVolume(float value)
Sets the volume of the audio played from this video, in [0, 1] range.
Declaration
public void SetAudioVolume(float value)
Parameters
float
value
|
SetIsAudioSpatial(bool value)
If checked, source can play spatial 3d audio (when audio clip supports it), otherwise will always play as 2d sound. At 0, no distance attenuation ever occurs.
Declaration
public void SetIsAudioSpatial(bool value)
Parameters
bool
value
|
SetIsLooping(bool value)
Determines whether the video clip should loop when it finishes playing.
Declaration
public void SetIsLooping(bool value)
Parameters
bool
value
|
SetTime(float time)
Sets the current time of playback. The time is in seconds, in range [0, Duration].
Declaration
public void SetTime(float time)
Parameters
float
time
The time. |
Stop()
Stops video playback, rewinding it to the start.
Declaration
public void Stop()