I'm trying to make a media player application with DirectX.AudioVideoPlayback, but when I try to run it, the project builds successfully and the application runs, but the Form doesn't show. The application just hangs on Application.Run(). However, when I comment out all of the DirectX code, the application runs like it is supposed to.
Here is my code:
Video v_Video = null;
void MainFormLoad(object sender, EventArgs e)
{
v_Video.Size = VideoViewer.Size; //VideoViewer is a PictureBox
v_Video.Owner = VideoViewer;
}
void PlayButtonClick(object sender, EventArgs e)
{
v_Video = new Video(File.ReadAllText("VideoLocation.txt") + "\\Video.wmv");
v_Video.Play();
PauseButton.BringToFront();
}
I have used this DLL before. When I attempt to open a media file, Visual Studio throws this exception:
DLL 'C:\\Windows\\assembly\\GAC\\Microsoft.DirectX\\1.0.2902.0__31bf3856ad364e35\\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
I suggest you using another library. Take a look here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.