请帮助我从资源文件夹中以c#格式播放视频 [英] Please help me to play a video in c# from resource folder
本文介绍了请帮助我从资源文件夹中以c#格式播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的视频文件是DSCF4919.avi,它存储在应用程序本身的资源文件夹中,我想使用
播放它
正在关注
C#中的DirectShow MediaPlayer [
My video file is DSCF4919.avi its stored in the resource folder of the application itself i want to play it using the
following
DirectShow MediaPlayer in C#[^]
m_objFilterGraph = new FilgraphManager();
// openFileDialog.FileName = "res:\\Cassford.Properties.Resources.DSCF4750l";
// m_objFilterGraph.RenderFile(openFileDialog.FileName);
// m_objFilterGraph.RenderFile("Cassford.Properties.Resources.DSCF4919");
m_objFilterGraph.RenderFile("Cassford.Properties.Resources.DSCF4750");
m_objBasicAudio = m_objFilterGraph as IBasicAudio;
try
{
m_objVideoWindow = m_objFilterGraph as IVideoWindow;
m_objVideoWindow.Owner = (int)panel1.Handle;
m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
panel1.ClientRectangle.Top,
panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height);
}
catch (Exception)
{
m_objVideoWindow = null;
}
m_objMediaEvent = m_objFilterGraph as IMediaEvent;
m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
m_objMediaControl = m_objFilterGraph as IMediaControl;
// this.Text = "Cassford - [" + openFileDialog.FileName + "]";
m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
UpdateStatusBar();
UpdateToolBar();
推荐答案
您不能.视频需要指向文件系统中的文件,因此您需要将文件复制到temp目录或至少在某个位置,然后从那里播放.
You can''t. A video needs to point to a file in the file system, so you need to copy the file to the temp directory, or somewhere at least, and play it from there.
这篇关于请帮助我从资源文件夹中以c#格式播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文