Example #1
40
 public MP3Player(string url , AxWMPLib.AxWindowsMediaPlayer p)
 {
     _player = p;
     _fileUrl = url;
     ThreadStart ts = new ThreadStart(GetMp3File);
     _httpThread = new Thread(ts);
     _httpThread.Start();
     _checkTimer = new DispatcherTimer();
     _checkTimer.Interval = new TimeSpan(0,0,0,0,20);
     _checkTimer.Tick += _checkTimer_Tick;
     _checkTimer.Start();
 }
Example #2
0
 /// <summary>
 /// MouseUp
 /// </summary>
 void wmp_MouseUpEvent(object sender, AxWMPLib._WMPOCXEvents_MouseUpEvent e)
 {
     if ((IsOpenContextMenu) && (e.nButton == 2) && (wmp.MouseGesture == ""))
     {
         contextMenuStripWMP.Show(MousePosition);
     }
 }
Example #3
0
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            //QUANDO VIDEO FOR PARADO
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying )
            {
                //PARA O AUDIO DE FUNDO
                Player.controls.stop();
                axWindowsMediaPlayer1.fullScreen = true;
            }

            //QUANDO VIDEO FOR PARADO
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPaused)
            {
                //O VIDEO FOI PARADO, PARA CONTINUAR PRECISA CLICAR EM OK
                if (MessageBox.Show("Video Parado. Clique aqui para continuar!", "",
                    MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    axWindowsMediaPlayer1.Ctlcontrols.play();
                }
            }

            //VOLTA O AUDIO DE FUNDO
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded )
            {
                //Player.controls.play();
                PlayFile();
            }
        }
Example #4
0
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            switch (e.newState)
            {
                case 1:
                    textBox1.Text = "Stopped";
                    break;
                case 2:
                    textBox1.Text = "Pause";
                    break;
                case 3:
                    for (int i = 0; i < axWindowsMediaPlayer1.currentPlaylist.count; i++)
                    {
                        if (axWindowsMediaPlayer1.currentMedia.isIdentical[axWindowsMediaPlayer1.currentPlaylist.Item[i]])
                        {
                            textBox1.Text = audioList[i].artist + " - " + audioList[i].title;
                            listBox1.SelectedIndex = i;
                            break;
                        }
                    }

                    break;
                case 6:
                    textBox1.Text = "Buffering... so slow internet........";
                    break;
            default:
                   // textBox1.Text = "";
                    break;
            }
        }
Example #5
0
        /// <summary>
        /// WMP:MouseMove
        /// </summary>
        void wmp_MouseMoveEvent(object sender, AxWMPLib._WMPOCXEvents_MouseMoveEvent e)
        {
            // 右クリックしている時
            if (e.nButton == 2)
            {
                // マウスジェスチャ
                string gesture = wmp.MouseGesture;

                if (gesture != "")
                {
                    for (int i = 0; i < settings.ShortcutList.Count; i++)
                    {
                        if (gesture == settings.ShortcutList[i][0])
                        {
                            gesture += " (" + CommandToString(settings.ShortcutList[i][1]) + ")";
                            break;
                        }
                    }

                    labelDetail.Text = "ジェスチャ:" + gesture;
                }
            }

            // ToolStripの表示
            if (e.fX > toolStrip.Left - 15 && e.fY < toolStrip.Height + 15)
            {
                toolStrip.Visible = true;
            }
            else
            {
                toolStrip.Visible = false;
            }
        }
        private void axWindowsMediaPlayer1_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e)
        {
            if (listBox1.SelectedIndex > -1)
            {

                if (listBox1.SelectedIndex != audioList.Count - 1)
                {
                    if (axWindowsMediaPlayer1.Ctlcontrols.currentItem.name == axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex + 1).name)
                    {
                        listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
                    }
                }

                if (listBox1.SelectedIndex != 0)
                {
                    if (axWindowsMediaPlayer1.Ctlcontrols.currentItem.name == axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex - 1).name)
                    {
                        listBox1.SelectedIndex = listBox1.SelectedIndex - 1;
                    }
                }

                if (axWindowsMediaPlayer1.Ctlcontrols.currentItem.name != axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex).name)
                {
                    axWindowsMediaPlayer1.Ctlcontrols.currentItem = axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex);
                }
            }
        }
Example #7
0
 void AxWmpPlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
 {
     if (e.newState == 8)
     {
         // indicate we are stopped
         _finished = true;
     }
 }
Example #8
0
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (mediaplayer.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
            {
                SongEnded = true;
                CheckSong.Start();

            }
        }
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                Form1 N = new Form1(this);
                this.Visible = false;
                N.Show();

            }
        }
Example #10
0
 private void wmpDuck_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
 {
     //Util.MensajeInformacion("wmpDuck_PlayStateChange " + e.newState, "");
     switch (e.newState)
     {
         case 8:    // MediaEnded
             this.Close();
             break;
     }
 }
 private void MediaControl_PositionChange(object sender, AxWMPLib._WMPOCXEvents_PositionChangeEvent e)
 {
     if (_config == null)
         return;
     if (ExpectingPositionChange)
     {
         return;
     }
     _config.SyncState();
 }
 private void axWindowsMediaPlayer1_MouseMoveEvent(object sender, AxWMPLib._WMPOCXEvents_MouseMoveEvent e)
 {
     if (!mouseLocation.IsEmpty)
     {
         if (Math.Abs(mouseLocation.X - e.fX) > 5 || Math.Abs(mouseLocation.Y - e.fY) > 5)
         {
             if (!previewMode) Application.Exit();
         }
     }
     mouseLocation = new Point(e.fX, e.fY);
 }
Example #13
0
 private void axWindowsMediaPlayer1_ClickEvent(object sender, AxWMPLib._WMPOCXEvents_ClickEvent e)
 {
     if (this.FormBorderStyle == FormBorderStyle.None)
     {
         this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
     }
     else
     {
         this.FormBorderStyle = FormBorderStyle.None;
     }
 }
Example #14
0
 private void wmp_ClickEvent(object sender, AxWMPLib._WMPOCXEvents_ClickEvent e)
 {
     if (wmp.Ctlcontrols.currentPosition > wmp.currentMedia.duration - 3)
     {
         wmp.Ctlcontrols.stop();
         wmp.Ctlcontrols.play();
         tmr.Interval = (int)((wmp.currentMedia.duration - 4) * 1000);
         tmr.Enabled = true;
         tmr.Start();
     }
 }
Example #15
0
        private void axInstruction_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            //wait two seconds when video stops, then close
            //MessageBox.Show(axInstruction.playState.ToString());
            if ((WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsMediaEnded | (WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsStopped)
            {
                System.Threading.Thread.Sleep(0);
                this.Close();

            }
        }
Example #16
0
 void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
 {
     if (e.newState == (int)WMPLib.WMPPlayState.wmppsMediaEnded)
     {
         SwitchToNormalScreen();
     }
     else if (e.newState == (int)WMPLib.WMPPlayState.wmppsPlaying)
     {
         SwitchToNormalScreen();
     }
 }
Example #17
0
 void axWindowsMediaPlayer1_MouseMoveEvent(object sender, AxWMPLib._WMPOCXEvents_MouseMoveEvent e)
 {
     if (_initialized)
     {
         if (Math.Abs(e.fX - _lastPoint.fX) > 5 ||
             Math.Abs(e.fY - _lastPoint.fY) > 5)
         {
             this.Close();
         }
     }
     _lastPoint = e;
     _initialized = true;
 }
Example #18
0
 private void axWindowsMediaPlayer1_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
 {
     try
     // If the Player encounters a corrupt or missing file,
     // show the hexadecimal error code and URL.
     {
     }
     catch (InvalidCastException)
     // In case pMediaObject is not an IWMPMedia item.
     {
         MessageBox.Show("Error in file.");
     }
 }
Example #19
0
 void axWindowsMediaPlayer1_OpenStateChange(object sender, AxWMPLib._WMPOCXEvents_OpenStateChangeEvent e)
 {
     if (e.newState==13)
     {               
         var rate = (int)_rate;
         var startPos = axWindowsMediaPlayer1.currentMedia.duration * _initialPosition;
         axWindowsMediaPlayer1.Ctlcontrols.currentPosition = startPos;
         if(rate>=1)
             axWindowsMediaPlayer1.Ctlcontrols.play();
         else
             axWindowsMediaPlayer1.Ctlcontrols.pause();
         _isOpened = true;
     }
 }
Example #20
0
        public Playlist(string[] Songs, AxWMPLib.AxWindowsMediaPlayer Player)
        {
            AddSongs(Songs);

            MediaPlayer = Player;

            this.play_components = new System.ComponentModel.Container();
            this.CheckSong = new System.Windows.Forms.Timer(this.play_components);
            this.CheckSong.Tick += new System.EventHandler(this.CheckSong_Tick);

            MediaPlayer.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(MediaPlayer_PlayStateChange);

            Play();
        }
Example #21
0
 public void removeMusic(AxWMPLib.AxWindowsMediaPlayer ax, string stage, Button btn)
 {
     switch (stage)
     {
         case "a":
             File.Delete(stagemusica);
             ax.URL = "";
             break;
         case "b":
             File.Delete(stagemusicb);
             ax.URL = "";
             break;
     }
     btn.Enabled = false;
 }
Example #22
0
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            /**** Don't add this if you want to play it on multiple screens***** /
             *
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
            {
                axWindowsMediaPlayer1.fullScreen = true;
            }
            /********************************************************************/

            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped)
            {
                Application.Exit();
            }
        }
Example #23
0
        private void axWindowsMediaPlayer1_OpenStateChange(object sender, AxWMPLib._WMPOCXEvents_OpenStateChangeEvent e)
        {
            this.listBox1.Items.Add(string.Format("state:{0}, msg:{1}", e.newState, this.axWindowsMediaPlayer1.status));

            if (e.newState == 13)
            {
                int count = this.axWindowsMediaPlayer1.currentMedia.markerCount;
                this.listBox1.Items.Add(string.Format("marker count : {0}", count));

                //1����J�E���g
                for (int i = 1; i <= count; i++)
                {
                    this.listBox1.Items.Add(string.Format("marker name:{0}, time:{1}", this.axWindowsMediaPlayer1.currentMedia.getMarkerName(i), this.axWindowsMediaPlayer1.currentMedia.getMarkerTime(i)));
                }
            }
        }
Example #24
0
        public void loadMusic(AxWMPLib.AxWindowsMediaPlayer ax, Button btnRemove, string stage)
        {
            string filename = "";
            switch (stage)
            {
                case "a":
                    filename = stagemusica;
                    break;
                case "b":
                    filename = stagemusicb;
                    break;
            }

            if (File.Exists(filename))
            {
                btnRemove.Enabled = true;
                ax.URL = filename;
            }
        }
Example #25
0
 public void changeMusic(AxWMPLib.AxWindowsMediaPlayer ax, string stage, Button btn)
 {
     OpenFileDialog musicBrowser = new OpenFileDialog();
     musicBrowser.Filter = "*Ogg Vorbis|*.ogg";
     if (musicBrowser.ShowDialog() == DialogResult.OK)
     {
         switch (stage)
         {
             case "a":
                 File.Copy(musicBrowser.FileName, stagemusica, true);
                 ax.URL = stagemusica;
                 break;
             case "b":
                 File.Copy(musicBrowser.FileName, stagemusicb, true);
                 ax.URL = stagemusicb;
                 break;
         }
     }
     btn.Enabled = true;
 }
Example #26
0
        void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 0 || e.newState == 1 || e.newState == 2 || e.newState == 8 || e.newState == 10)
                _rate = 0;
            else
                _rate = 1;


            if (e.newState == 3)
            {
                server.SendStatus("playing");
            }
            else if (e.newState == 2)
            {
                server.SendStatus("paused");
            }
            else if (e.newState == 8)
            {
                server.SendStatus("stopped");
            }
        }
Example #27
0
 void axWindowsMediaPlayer1_KeyDownEvent(object sender, AxWMPLib._WMPOCXEvents_KeyDownEvent e)
 {
     switch (e.nKeyCode)
     {
         case (short)Keys.N:
             axWindowsMediaPlayer1.Ctlcontrols.next();
             break;
         case (short)Keys.B:
             axWindowsMediaPlayer1.Ctlcontrols.previous();
             break;
         case (short)Keys.Oemcomma:
             axWindowsMediaPlayer1.Ctlcontrols.fastReverse();
             break;
         case (short)Keys.OemPeriod:
             axWindowsMediaPlayer1.Ctlcontrols.fastForward();
             break;
         case (short)Keys.S:
             axWindowsMediaPlayer1.settings.rate =
                 axWindowsMediaPlayer1.settings.rate == 0.5 ? axWindowsMediaPlayer1.settings.rate = 1 : axWindowsMediaPlayer1.settings.rate = 0.5;
             break;
         case (short)Keys.M:
             axWindowsMediaPlayer1.settings.volume =
                 axWindowsMediaPlayer1.settings.volume == 0 ? 100 : 0;
             break;
         case (short)Keys.Enter:
             if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
                 axWindowsMediaPlayer1.Ctlcontrols.pause();
             else
                 axWindowsMediaPlayer1.Ctlcontrols.play();
             break;
         case (short)Keys.OemQuestion:
             MessageBox.Show("B - Back\r\nN - Next\r\n, - Rewind\r\n. - Fast Forward\r\nS - Slow Motion\r\nM - Mute\\Unmute\r\nEnter - Play\\Pause\r\n? - Help");
             break;
         default:
             this.Close();
             break;
     }
 }
Example #28
0
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (button1WasClicked == false)
            {
                if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
                {
                    if (listBox1.SelectedIndex < files.Length - 1)
                    {
                        listBox1.SelectedIndex++;

                    }
                    else
                    {
                        listBox1.SelectedIndex = 0;

                    }
                }

                if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsReady)
                {
                    axWindowsMediaPlayer1.Ctlcontrols.play();
                }
            }
        }
Example #29
0
        void axWMP_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8 && !_looping)
            {
                // indicate we are stopped
                _finished = true;

                // Raise the event
                if (VideoEnd == null)
                {
                    Trace.WriteLine(new LogMessage("VideoPlayer - Playstate Complete", "Video end handler is null"), LogType.Audit.ToString());
                }
                else
                {
                    VideoEnd();
                }
            }
        }
Example #30
-38
        private const int WM_HOTKEY = 0x312; //窗口消息-热键

        #endregion Fields

        #region Constructors

        public LrcFrm(AxWMPLib.AxWindowsMediaPlayer axWmplayer,System.Windows.Forms.Timer timer)
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            LrcConnections.lrcfrm = this;
            LrcConnections.lrcPanel = this.lrcPanel1;
            this.axWmplayer = axWmplayer;
            this.timer = timer;
        }