private void Play() { QuartzTypeLib.FilgraphManager mc = new QuartzTypeLib.FilgraphManager(); try { mc.RenderFile("pow.wav"); mc.Run(); } catch { } }
public override void Initialize(Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded) { const int wsChild = 0x40000000; string ext = System.IO.Path.GetExtension(videoFileName).ToLower(); bool isAudio = ext == ".mp3" || ext == ".wav" || ext == ".wma" || ext == ".m4a"; OnVideoLoaded = onVideoLoaded; OnVideoEnded = onVideoEnded; VideoFileName = videoFileName; _owner = ownerControl; _quartzFilgraphManager = new FilgraphManager(); _quartzFilgraphManager.RenderFile(VideoFileName); if (!isAudio) { _quartzVideo = _quartzFilgraphManager as IVideoWindow; _quartzVideo.Owner = (int)ownerControl.Handle; _quartzVideo.SetWindowPosition(0, 0, ownerControl.Width, ownerControl.Height); _quartzVideo.WindowStyle = wsChild; } _quartzFilgraphManager.Run(); if (!isAudio) { (_quartzFilgraphManager as IBasicVideo).GetVideoSize(out _sourceWidth, out _sourceHeight); } _owner.Resize += OwnerControlResize; _mediaPosition = (IMediaPosition)_quartzFilgraphManager; if (OnVideoLoaded != null) { _videoLoader = new BackgroundWorker(); _videoLoader.RunWorkerCompleted += VideoLoaderRunWorkerCompleted; _videoLoader.DoWork += VideoLoaderDoWork; _videoLoader.RunWorkerAsync(); } OwnerControlResize(this, null); _videoEndTimer = new System.Windows.Forms.Timer { Interval = 500 }; _videoEndTimer.Tick += VideoEndTimerTick; _videoEndTimer.Start(); if (!isAudio) { _quartzVideo.MessageDrain = (int)ownerControl.Handle; } }
private void tsmiabout_Click(object sender, EventArgs e2) { rover.Play("Writing"); QuartzTypeLib.FilgraphManager mc = new QuartzTypeLib.FilgraphManager(); try { mc.RenderFile("about.mp3"); mc.Run(); about.ShowDialog(); mc.Stop(); } catch { about.ShowDialog(); // MessageBox.Show( e.Message + " " + e.Source + " " + e.StackTrace ); } }
public override void Play() { _quartzFilgraphManager.Run(); _isPaused = false; }
public override void Initialize(Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded) { const int wsChild = 0x40000000; string ext = System.IO.Path.GetExtension(videoFileName).ToLower(); bool isAudio = ext == ".mp3" || ext == ".wav" || ext == ".wma" || ext == ".m4a"; OnVideoLoaded = onVideoLoaded; OnVideoEnded = onVideoEnded; VideoFileName = videoFileName; _owner = ownerControl; _quartzFilgraphManager = new FilgraphManager(); _quartzFilgraphManager.RenderFile(VideoFileName); if (!isAudio) { _quartzVideo = _quartzFilgraphManager as IVideoWindow; _quartzVideo.Owner = (int)ownerControl.Handle; _quartzVideo.SetWindowPosition(0, 0, ownerControl.Width, ownerControl.Height); _quartzVideo.WindowStyle = wsChild; } _quartzFilgraphManager.Run(); if (!isAudio) (_quartzFilgraphManager as IBasicVideo).GetVideoSize(out _sourceWidth, out _sourceHeight); _owner.Resize += OwnerControlResize; _mediaPosition = (IMediaPosition)_quartzFilgraphManager; if (OnVideoLoaded != null) { _videoLoader = new BackgroundWorker(); _videoLoader.RunWorkerCompleted += VideoLoaderRunWorkerCompleted; _videoLoader.DoWork += VideoLoaderDoWork; _videoLoader.RunWorkerAsync(); } OwnerControlResize(this, null); _videoEndTimer = new Timer { Interval = 500 }; _videoEndTimer.Tick += VideoEndTimerTick; _videoEndTimer.Start(); if (!isAudio) _quartzVideo.MessageDrain = (int)ownerControl.Handle; }