Sign in to follow this  

[.net] Video playback trouble

This topic is 3845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello... I have some video troubles in a C# form. I am trying to play an .AVI file in a panel. Mysteriously, it used to work fine, but I decided to re-write some of the code. Now, the video playback no longer works, but I can still hear the audio. I am certain I did not change any code that would affect the video playback. What is going wrong? Here's the code: using Microsoft.DirectX.AudioVideoPlayback; try { int height = videoPanel.Height; int width = videoPanel.Width; video = new Video(Application.StartupPath + "\\test.avi"); video.Owner = videoPanel; videoPanel.Width = width; videoPanel.Height = height; video.Play(); } catch (Exception exc) { // } This is called on form load. I tried calling it from clicking on buttons and such, but I still received the same undesired effect (audio but no video).

Share this post


Link to post
Share on other sites
I would recommend to stay well clear of Microsoft.DirectX.AudioVideoPlayback. I used it with a DirectX application a couple years ago (and it hasn't changed since then) - and found it to be ridden with nasty bugs that you can't even hack your way around. I would recommend trying DirectShow.NET (http://sourceforge.net/project/showfiles.php?group_id=136334), which is essentially a rewrite of DirectX.AudioVideoPlayback plus *a lot* more (well they're both managed wrappers for DirectShow). You can download the samples package where you'll find an example of just what you need. Hope that helps...

Share this post


Link to post
Share on other sites
Hi, and thank you for both of your replies.
I would like to keep this as simple as possible without downloading any external packages, and yes the form has loaded since I mentioned I tried loading the video from a button command. Is there any way I can work around downloading a different package?

Share this post


Link to post
Share on other sites
I understand your point... actually you just only need to reference *one* DLL file for this DirectShow.NET library, and then copy over the sample code and configure it, but if you want to go even simpler perhaps MCI is a good bet.
This is a good short intro: http://dotnet.org.za/deon/articles/3057.aspx
For more detail on the commands, try here: http://www.geocities.com/smigman.geo/mci/avi.html
It's in VB but it's pretty straight-forward so I hope you'll be able to interpret it. If not, let me know and maybe I can give you some examples.
MCI really is a pretty efficient and simple method for playing video/music so long as the video is not mixed in with a DirectX application or anything. Well I hope that helps anyway...

Share this post


Link to post
Share on other sites

This topic is 3845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this