/// <summary> /// Pauses the video /// </summary> public void Pause() { // End threads StoppingEvent.Set(); // Stop the FilterGraph (but remembers the current position) DsError.ThrowExceptionForHR(FG_MediaControl.Stop()); // Update VideoState currentState = VideoState.Paused; }
/// <summary> /// Stops playing the video /// </summary> public void Stop() { StoppingEvent.Set(); // Stop the FilterGraph DsError.ThrowExceptionForHR(FG_MediaControl.Stop()); // Reset the current position DsError.ThrowExceptionForHR(FG_MediaSeeking.SetPositions(0, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning)); // Update VideoState currentState = VideoState.Stopped; }
private void ReleaseInterface() { if (FG_MediaEventEx != null) { DsError.ThrowExceptionForHR(FG_MediaControl.Stop()); //0x00008001 = WM_GRAPHNOTIFY DsError.ThrowExceptionForHR(FG_MediaEventEx.SetNotifyWindow(IntPtr.Zero, 0x00008001, IntPtr.Zero)); } FG_MediaControl = null; FG_MediaEventEx = null; FG_GraphBuilder = null; FG_MediaSeeking = null; FG_MediaPosition = null; if (FG != null) { Marshal.ReleaseComObject(FG); } FG = null; }