-->

Looking for a component (.NET or COM/ActiveX) that

2020-03-06 02:47发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 5 years ago.

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.