Ejemplo n.º 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;

            LibMPlayerCommon.BackendPrograms b = new LibMPlayerCommon.BackendPrograms();
            if (System.IO.File.Exists(MediaPlayer.Properties.Settings.Default.MPlayerPath) == false &&
                System.IO.File.Exists(b.MPlayer) == false)
            {
                MessageBox.Show("Cannot find mplayer.  Loading properties form to select.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnPlayerProperties_Click(sender, e);
            }

            this._play = LibMPlayerCommon.PlayerFactory.Get(panelVideo.Handle.ToInt64(), MediaPlayer.Properties.Settings.Default.MPlayerPath);
            //this._play = new MPlayer(panelVideo.Handle.ToInt64(), backend, MediaPlayer.Properties.Settings.Default.MPlayerPath);
            this._play.VideoExited     += new MplayerEventHandler(play_VideoExited);
            this._play.CurrentPosition += new MplayerEventHandler(_play_CurrentPosition);


            // Set fullscreen
            if (_fullscreen == true && (this.WindowState != FormWindowState.Maximized))
            {
                this.ToggleFormFullScreen();
            }

            // start playing mmediately
            if (_playNow == true && this._filePath != "")
            {
                btnPlay_Click(new object(), new EventArgs());
            }
        }
Ejemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            LibMPlayerCommon.BackendPrograms b = new LibMPlayerCommon.BackendPrograms();
            if (System.IO.File.Exists(MediaPlayer.Properties.Settings.Default.MPlayerPath) == false &&
                System.IO.File.Exists(b.MPlayer) == false && BackendPrograms.OSPlatform() == "windows")
            {
                MessageBox.Show("Cannot find mplayer.  Loading properties form to select.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnPlayerProperties_Click(sender, e);
            }


            MplayerBackends backend;

            System.PlatformID runningPlatform = System.Environment.OSVersion.Platform;
            if (runningPlatform == System.PlatformID.Unix)
            {
                backend = MplayerBackends.GL2;
            }
            else if (runningPlatform == PlatformID.MacOSX)
            {
                backend = MplayerBackends.OpenGL;
            }
            else
            {
                backend = MplayerBackends.Direct3D;
            }


            this._play                  = new MPlayer(panelVideo.Handle.ToInt32(), backend, MediaPlayer.Properties.Settings.Default.MPlayerPath);
            this._play.VideoExited     += new MplayerEventHandler(play_VideoExited);
            this._play.CurrentPosition += new MplayerEventHandler(_play_CurrentPosition);


            // Set fullscreen
            if (_fullscreen == true && (this.WindowState != FormWindowState.Maximized))
            {
                this.ToggleFormFullScreen();
            }

            // start playing mmediately
            if (_playNow == true && this._filePath != "")
            {
                btnPlay_Click(new object(), new EventArgs());
            }
        }