title: how to play a video on C#
body: <p>I have two computers.<br>
  When i run my code in first one everything is fine, video was playing.<br>
  When i run my code at the second computer, it throws me DirectXException was unhalndled.</p>
  
  <p>My part of code for play a video is:</p>
  
  <pre><code>string path= Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Photos\test.mp4");
  
  var ofd = path;
  label3.Text = ofd;
  video.Owner = panel2;
  panel2.Size = new System.Drawing.Size(634, 507);
  video.Ending += new EventHandler(videocountdown_Ending);
  video.Size = new System.Drawing.Size(634, 507);
  </code></pre>
  
  <p>And the details of the Exception is:</p>
  
  <pre><code>Error Code : -2147220891
  Error String : VFW_E_UNSUPPORTED_STREAM
  StackTrace :    in Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
     in Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName, Boolean autoRun)
     in WinFormCharpWebCam.mainWinForm.pictureBox1_Click(Object sender, EventArgs e) στο c:\ArtWedding\Form1.cs:γραμμή 133
     in System.Windows.Forms.Control.OnClick(EventArgs e)
     in System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)
     in System.Windows.Forms.Control.WndProc(Message&amp; m)
     in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
     in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
     in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
     in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
     in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
     in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
     in System.Windows.Forms.Application.Run(Form mainForm)
     in WinFormCharpWebCam.Program.Main() στο c:\ArtWedding\Program.cs:γραμμή 18
     in System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
     in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
     in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
     in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     in System.Threading.ThreadHelper.ThreadStart()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/5gTUr.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/ChzIu.jpg" alt="enter image description here"></p>