Table of Contents

Class VideoPlayer

Namespace
Microsoft.Xna.Framework.Media
Assembly
MonoGame.Framework.dll

Provides methods and properties to play back, pause, resume, and stop Video. VideoPlayer also exposes repeat, volume, and play position information.

public sealed class VideoPlayer : IDisposable
Inheritance
VideoPlayer
Implements
Inherited Members

Constructors

VideoPlayer()

Creates a new instance of VideoPlayer class.

public VideoPlayer()

Properties

IsDisposed

Gets a value that indicates whether the object is disposed.

public bool IsDisposed { get; }

Property Value

bool

IsLooped

Gets a value that indicates whether the player is playing video in a loop.

public bool IsLooped { get; set; }

Property Value

bool

IsMuted

Gets or sets the muted setting for the video player.

public bool IsMuted { get; set; }

Property Value

bool

PlayPosition

Gets the play position within the currently playing video.

public TimeSpan PlayPosition { get; }

Property Value

TimeSpan

State

Gets the media playback state, MediaState.

public MediaState State { get; }

Property Value

MediaState

Video

Gets the Video that is currently playing.

public Video Video { get; }

Property Value

Video

Volume

Video player volume, from 0.0f (silence) to 1.0f (full volume relative to the current device volume).

public float Volume { get; set; }

Property Value

float

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetTexture()

Retrieves a Texture2D containing the current frame of video being played.

public Texture2D GetTexture()

Returns

Texture2D

The current frame of video.

Exceptions

InvalidOperationException

Thrown if no video is set on the player

InvalidOperationException

Thrown if the platform was unable to get a texture in a reasonable amount of time. Often the platform specific media code is running in a different thread or process. Note: This may be a change from XNA behaviour

Pause()

Pauses the currently playing video.

public void Pause()

Play(Video)

Plays a Video.

public void Play(Video video)

Parameters

video Video

Video to play.

Resume()

Resumes a paused video.

public void Resume()

Stop()

Stops playing a video.

public void Stop()