Пример #1
0
        /// <summary>
        /// called when removeable media is inserted
        /// </summary>
        /// <param name="aMask"></param>
        //void deviceMonitor_OnVolumeInserted(int aMask)
        //{
        //    switch (MessageBox.Show("Do you want to play DVD?", "Play DVD?", MessageBoxButtons.YesNo))
        //    {
        //        case DialogResult.Yes:
        //            PlayRemoveableMedia(Form1.deviceMonitor.MaskToLogicalPaths(aMask));
        //            break;
        //        case DialogResult.No:
        //            break;
        //    }
        //}

        /// <summary>
        /// Record given media
        /// </summary>
        /// <param name="driveLetter"></param>
        /// <param name="fileToRecordTo"></param>
        public void RecordMedia(string driveLetter, string fileToRecordTo)
        {
            try
            {
                int       vHandle = 0;
                ArrayList mediaToPlay;

                vHandle = this.pnlVideo.Handle.ToInt32();

                if (vHandle > 0 && fileToRecordTo.Length > 0)
                {
                    mediaToPlay = new ArrayList();
                    mediaToPlay.Add(driveLetter);

                    vlc = new VLC();

                    vlc.SetOutputWindow(vHandle);
                    string[] options;

                    options = ToScreen(fileToRecordTo, false);

                    _playerTask = new PlayerTask(10, 0, vlc, options, mediaToPlay);
                    // _playerTask.Completed += new AsynTaskCompletedEventHandler(playerTask_Completed);
                    _playerTask.Start();

                    progressTimer.Start();
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("sctv PlayMedia", "PlayMedia error: " + ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// Play given media
        /// </summary>
        /// <param name="mediaToPlay">arrayList of media to play</param>
        /// <param name="fileToRecordTo">if blank nothing will record</param>
        public void PlayMedia(ArrayList mediaToPlay, string fileToRecordTo)
        {
            try
            {
                int vHandle = 0;

                vHandle = this.pnlVideo.Handle.ToInt32();

                if (vHandle > 0)
                {
                    vlc = new VLC();

                    vlc.SetOutputWindow(vHandle);
                    string[] options;
                    //string[] options = { "" };

                    if (fileToRecordTo.Length > 0)
                    {
                        options = ToScreen(fileToRecordTo);
                    }
                    else
                    {
                        options = ToScreen();
                    }

                    _playerTask = new PlayerTask(10, 0, vlc, options, mediaToPlay);
                    // _playerTask.Completed += new AsynTaskCompletedEventHandler(playerTask_Completed);
                    _playerTask.Start();

                    progressTimer.Start();
                    inactivityTimer.Start();

                    //ushort skey = 0x53; //S key
                    //vlc.setVariable("key-play-pause", (int)skey);
                    //vlc.setVariable("key-pressed", (int)skey);
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("sctv PlayMedia", "PlayMedia error: " + ex.Message);
            }
        }