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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.