Anoushka Seechurn
Anoushka Seechurn

Reputation: 2256

Windows Library to play a video file

this.Background = new System.Windows.Media.ImageBrush(new System.Windows.Media.Imaging.BitmapImage(new Uri(label)));

The above code used the Media library to display an image from the Uri fed.(label contains the URL).

What library should I use to play a video file in the same manner. (I need to play a video file instead of displaying and image)

Help ?

Upvotes: 0

Views: 583

Answers (1)

user1064248
user1064248

Reputation:

You can use the MediaElement for this.

It is located in System.Windows.Controls namespace and relies on the Windows Media Player. IF WMP is installed on your system MediaElement is an easy way to go.

The code to do this should look like this:

MediaElement me = new MediaElement();
// initialize and do other stuff to MediaElement
this.Background = new VisualBrush(me);

Upvotes: 1

Related Questions