Play Media Files

Problem

You want to play movie video (for example, MPEG files) or MP3 audio files.

Solution

Add the ActiveX MCI control for multimedia, and connect it to a PictureBox control if you need to display video.

Discussion

The .NET Framework does not include any classes for playing multimedia such as sounds, videos, or MIDI files. recipe Play a WAV File described how you can use the Win32 API to play WAV files. Even more functionality is available if you use the MCI ActiveX control. However, the MCI ActiveX control is not included with .NET—it’s installed with earlier versions of Visual Studio, such as Visual Basic 6. Although you can redistribute the MCI ActiveX control with applications that use it, you’ll need to have a product such as ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook 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.