问题
I'm looking for something like the Windows Media Player control that can be hosted on a form.
The WMP doesn't work for me because I need a control that can play a continuously-appended playlist of AVI files in sequence, so that the transition from one file to the next happens seamlessly (i.e. without any glitches or pauses in the video and audio). With WMP, there's always a delay between files of half a second or so.
Does anyone know of a control (it can be either commercial or open-source) that can do this? I assume anything like this wraps DirectX, and that's OK too.
回答1:
You might try the DirectX SDK from Microsoft for .Net: download
It contains a AudioVideoPlayback namepsace with the Video class that is easy to use in any .Net project. You bind the Video class to a Panel control like this:
Video video;
public Form1(string[] args) {
InitializeComponent();
video = new Video(dialog.FileName);
video.Owner = panel1;
}
The video class contains several methods for playback like Play, Pause, Stop and of course FromFile.
Documentation and examples of using the AudioVideoPlayback namespace in C#:
- AudioVideoPlayback API
- Video Class (Microsoft.DirectX.AudioVideoPlayback)
With these MSDN articles and my sample code above you should be able to display a video and extend your class to play multiple videos in a playlist.
来源:https://stackoverflow.com/questions/2464613/looking-for-a-component-net-or-com-activex-that-can-play-avi-files-in-a-winfo