Table of Contents

Class VideoInstance

Namespace
Stride.Video
Assembly
Stride.Video.dll
public sealed class VideoInstance : GraphicsResourceBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
object
VideoInstance
Implements
Inherited Members
Extension Methods

Constructors

VideoInstance(IServiceRegistry, VideoComponent)

Initializes a new instance of the VideoInstance class.

public VideoInstance(IServiceRegistry services, VideoComponent videoComponent)

Parameters

services IServiceRegistry
videoComponent VideoComponent

Fields

Logger

public static Logger Logger

Field Value

Logger

Properties

CurrentTime

public TimeSpan CurrentTime { get; }

Property Value

TimeSpan

Duration

The duration of the video.

public TimeSpan Duration { get; }

Property Value

TimeSpan

FramesPresented

Count of frames written to the component's Target texture, incremented once per presented frame across all backends. Lets callers detect when a new frame has landed (e.g. after a Seek(TimeSpan)). Updated on the game thread.

public long FramesPresented { get; }

Property Value

long

IsLooping

Define if the video loops after reaching the end of the range.

public bool IsLooping { get; set; }

Property Value

bool

LoopRange

If IsLooping is set, the time at which we restart the video when we reach LoopRangeEnd.

public PlayRange LoopRange { get; set; }

Property Value

PlayRange

MaxMipMapCount

public uint MaxMipMapCount { get; }

Property Value

uint

PlayRange

public PlayRange PlayRange { get; set; }

Property Value

PlayRange

PlayState

The current state of the video.

public PlayState PlayState { get; }

Property Value

PlayState

SpeedFactor

Applies a speed factor to the video playback. The default value is 1.0f.

public float SpeedFactor { get; set; }

Property Value

float

UsesHardwareDecode

True when the active backend currently decodes via hardware acceleration (e.g. D3D11VA). Only meaningful after the codec has been initialized; will read false before Play() has produced the first frame.

public bool UsesHardwareDecode { get; }

Property Value

bool

Volume

The global volume at which the sound is played. Range [0, 1].

public float Volume { get; set; }

Property Value

float

Methods

InitializeFromDataSource()

public void InitializeFromDataSource()

OnPause()

Called when the GraphicsDevice is inactive (put in the background and rendering is paused). By default, it does nothing.

protected override bool OnPause()

Returns

bool

true if the Graphics Resource has transitioned to the Paused state.

Remarks

This method may be overriden in derived classes to voluntarily release objects that can be easily recreated, such as Dynamic Buffers and Frame Buffers / Render Targets.

OnResume()

Called when the GraphicsDevice has resumed from either a paused or destroyed state. By default, it does nothing.

protected override void OnResume()

Remarks

This method may be overriden in derived classes to recreate the Graphics Resource if possible.

Pause()

Pauses the video.

public void Pause()

Play()

Plays or resumes the video.

public void Play()

Release()

Release the VideoInstance.

public void Release()

RestartVideo()

Restarts the video from the beginning.

public void RestartVideo()

Seek(TimeSpan)

Seeks the video to the provided time.

public void Seek(TimeSpan time)

Parameters

time TimeSpan

Stop()

Stops the video.

public void Stop()