Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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#[^]

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();
Posted
Comments
Yuri Vital 2-Jul-11 4:43am    
And what is your problem ?
Elaborate !

1 solution

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.
 
Share this answer
 
Comments
vishnulalr 2-Jul-11 11:55am    
please help me. how should i do

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900