Looking for a component (.NET or COM/ActiveX) that can play AVI files in a WinForms app [closed]

二次信任 提交于 2019-12-03 22:12:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!