public Form1(string mediafile) { InitializeComponent(); Form1.Instance = this; // set window location/sizing and force to top of z index this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; this.Focus(); this.TopMost = true; this.Refresh(); vlcLibrary = new VLCLibrary(); if (vlcLibrary.DetectVLC()) { try { vlcLibrary.SetupVLC(); } catch (Exception e) { } } // activate the remote control hooks remoteManager = new MCRemoteControlManager(); remoteManager.form = this; remoteManager.AssignHandle(this.Handle); IntPtr panelHandle = panel1.Handle; string[] args = new string[] { "-I", "dummy", "--ignore-config", @"--plugin-path=" + MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath }; if (!System.IO.Directory.Exists(MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath)) { DialogResult result = MessageBox.Show("Error: we do NOT have a valid location for the VLC plugins folder", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error); } // init VLC try { instance = new VlcInstance(args); } catch (VlcException e) { MessageBox.Show("Error creating VLC Instance:" + e.Message); Environment.Exit(0); } player = instance.CreatePlayer(mediafile); player.Drawable = panelHandle; // give the remote control lib access to the active panel so it gets keyboard/mouse/remote events remoteManager.playerHandle = player.Handle; IntPtr p_event_manager = vlcLibrary.media_player_event_manager(player.Handle); eventmanager = new VlcEventManager(instance, p_event_manager); eventmanager.InitalizeEvents(); }
public VlcMediaPlayer CreatePlayer(string mediaPath) { if (!System.IO.File.Exists(mediaPath)) return null; VlcMedia media; try { System.IO.FileAttributes attr = System.IO.File.GetAttributes(System.IO.Path.GetFullPath(mediaPath)); if ((attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory) { media = new VlcMedia(this, @"dvd://" + mediaPath); } else { media = new VlcMedia(this, mediaPath); } } catch (Exception e) { media = new VlcMedia(this, mediaPath); } VlcMediaPlayer player = new VlcMediaPlayer(this, media); if (player != null) { _player = player; } return player; }
public VlcMediaPlayer CreatePlayer(string mediaPath) { if (!System.IO.File.Exists(mediaPath)) { return(null); } VlcMedia media; try { System.IO.FileAttributes attr = System.IO.File.GetAttributes(System.IO.Path.GetFullPath(mediaPath)); if ((attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory) { media = new VlcMedia(this, @"dvd://" + mediaPath); } else { media = new VlcMedia(this, mediaPath); } } catch (Exception e) { media = new VlcMedia(this, mediaPath); } VlcMediaPlayer player = new VlcMediaPlayer(this, media); if (player != null) { _player = player; } return(player); }
public void VolumeTest() { player = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi"); player.Play(); int currentVolume = player.Volume; player.Volume = currentVolume + 10; Assert.IsTrue(currentVolume < player.Volume); }
public void IsStoppedTest() { player = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi"); player.Play(); player.Stop(); Assert.IsTrue(player.IsStopped); }