private void InitVideo() { if (checkFileName()) { try { if (_video != null) { if (_cachedPath != _filePath) { _video.Dispose(); _video = new Video(_filePath); _cachedPath = _filePath; } } else { _video = new Video(_filePath); _cachedPath = _filePath; } _video.Owner = VideoPanel; isVideo = true; if (_audio != null) { _audio.Dispose(); _audio = null; } } catch { if (_audio != null) { if (_cachedPath != _filePath) { _audio.Dispose(); _video = new Video(_filePath); _cachedPath = _filePath; } } else { _audio = new Audio(_filePath); _cachedPath = _filePath; } isVideo = false; if (_video != null) { _video.Dispose(); _video = null; } } InitEvents(); } }
//Size VideoDefaultSize; public void init() { System.Drawing.Size Panel_Size; Panel_Size = video_panel.Size; OpenFileDialog of = new OpenFileDialog(); if (of.ShowDialog() == DialogResult.OK) { if (vid != null) { vid.Dispose(); } vid = new Microsoft.DirectX.AudioVideoPlayback.Video(of.FileName); vid.Owner = this.video_panel; video_panel.Size = Panel_Size; } }