Playing Media

Windows Presentation Foundation enables you to easily reproduce media files, such as audio and videos, through the System.Windows.Controls.MediaElement control. This enables reproducing, among others, all media contents supported by the Windows Media Player application, such as .wmv, .wma, .avi, and .mp3 files. This section shows you how to build a simple media player using MediaElement and Visual Basic 2015. 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 31.1 declares the user interface (UI).

LISTING 31.1 Defining the User Interface for a Simple Media Player

Get Visual Basic 2015 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.