Playing Media

Windows Presentation Foundation enables easily reproducing media files, such as audio and videos, through the System.Windows.Controls.MediaElement control. This basically enables reproducing, among others, all media contents supported by the Windows Media Player application, thus .Wmv, .Wma, .Avi, and .Mp3 files. This section shows you how to build a simple media player using MediaElement and Visual Basic 2010. Now add a new Window to an existing project setting this as the main window. The goal of the next example is to implement a media player and buttons for controlling media reproduction. Code in Listing 34.1 declares the user interface.

Listing 34.1 Defining the User Interface for a Simple Media Player

The MediaElement ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.