The second topic is my player, which can play audio and video. In fact, a little knowledge of computer multimedia technology, people are aware that audio and video differences are embodied in the file format. Different audio mp3,midi,wav are actually different encoding or format, the same as different video avi,rm (RMVB), MOV, etc. is actually a different encoding format, these formats, most of them are unfair open source code, but the public standard or API interface. But programming calls are still cumbersome, and we don't have the energy and the ability to study them.
. NET itself does not have a multimedia library, but it has the power to interact with COM. Exactly, Microsoft DirectShow technology can meet the above requirements, and can follow. NET achieves the perfect union.
DirectShow Interactive Assembly is integrated in DirectX, most computers will have DirectX, Microsoft also provides downloads. Cut the crap and start doing it.
First, refer to Interop.QuartzTypeLib.dll in the project. This is the COM interactive assembly for DirectX, which is actually a managed call. The class library and method introductions are best seen in DirectX SDK. There's no fish to swim here.
Second, play the open file
public void Rendermedia (string mediafilename)
{
Clearup ();
Try
{
Objmedia = new Filgraphmanager ();
Objmedia.renderfile (mediafilename);
Volmedia = Objmedia as Ibasicaudio;
Posmedia = Objmedia as imediaposition;
Ctlmedia = Objmedia as IMediaControl;
Eexmedia = Objmedia as Imediaeventex;
Eexmedia.setnotifywindow (int) this. Handle, wm_graphnotify, 0);
Mediastatus = 1;
Mediaduration = posmedia.duration;
Volmedia.volume = Mediavolum;
Play ();
catch
{
MessageBox.Show ("Failed to load file!");
Clearup ();
}
}