Пример #1
0
 private void 播放到达结尾触发事件(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     if (播放状态)
     {
         刷新播放("直播源推流停止或卡顿,正在尝试重连");
     }
 }
Пример #2
0
 private void 播放到达结尾触发事件(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)// AxAPlayer3Lib._IPlayerEvents_OnStateChangedEvent e)
 {
     if (播放状态)
     {
         刷新播放("直播源推流停止或卡顿,正在尝试重连(或延长设置里“默认缓冲时长”的时间)", false);
     }
 }
Пример #3
0
        private void 播放到达结尾触发事件(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)// AxAPlayer3Lib._IPlayerEvents_OnStateChangedEvent e)
        {
            //if (e.nOldState==6)
            if (播放状态)
            {
                //if(!string.IsNullOrEmpty(DD.DownIofo.重连文件路径))
                //{
                //    try
                //    {
                //        new Task(() =>
                //        {
                //            this.VlcControl.SourceProvider.MediaPlayer.Stop();//这里要开线程处理,不然会阻塞播放
                //            this.VlcControl.SourceProvider.MediaPlayer.Play(new Uri(DD.DownIofo.重连文件路径));
                //            DD.DownIofo.重连文件路径 = null;
                //        }).Start();

                //    }
                //    catch (Exception)
                //    {

                //        return;
                //    }


                //}
                //else
                {
                    刷新播放("直播源推流停止或卡顿,正在尝试重连(或延长设置里“默认缓冲时长”的时间)");
                }
            }
        }
Пример #4
0
 private void Control_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     Task.Factory.StartNew(delegate {
         Stop();
         NotifyPropertyChanged("Src");
     });
 }
Пример #5
0
 private void VlcControl1_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     videoCutterTimeline1.InvokeIfRequired(() =>
     {
         videoCutterTimeline1.Position = (int)(1.0f * vlcControl1.VlcMediaPlayer.Length);
     });
     EnableButtons();
 }
Пример #6
0
 private void vlcPlayer_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     //this.onVideoEnd?.Invoke(this, e);
     // this.Close();
     //this.Invoke(new MethodInvoker(delegate { this.Close(); }));
     try
     {
         if (this.InvokeRequired)
         {
             this.Invoke(new Action(this.Close));
             return;
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #7
0
        private void MediaPlayer_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
        {
            //if (e.Exception != null)
            //{
            //    Log4NetHelper.InfoFormat("播放异常停止. cause by:{0}", e.Exception.ToString());
            //}

            Stop();
            //CloseFile();

            if (OnPlayFinished != null)
            {
                OnPlayFinished.Invoke();
            }
            else
            {
                Log4NetHelper.Info("no play finished handler...");
            }
        }
Пример #8
0
        /// <summary>
        /// When the video finishes playing, revert the play button to it's original state, and repeat the video if the user has set it to repeat.
        /// </summary>
        /// <param name="sender">Automatically generated by Visual Studio.</param>
        /// <param name="e">Automatically generated by Visual Studio.</param>
        private void vlcControl_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
        {
            //Recording reached the end, either repeat recording, play user recording, play recording for next word, or stop.
            SetProgress(100);

            // The only way to loop playback is to have a delegate call play asynchronously.

            //Infinite loop.
            if (RepeatTimes == 11)
            {
                //Checks if it needs to play the user recording or the database recording.
                if (playRecording && !recordingProgressBarLabel.Text.Equals(noFileText))
                {
                    // Plays user recording.
                    asyncPlay(audioFilePath);
                }
                else
                {
                    //Plays database recording.
                    asyncPlay();
                }
            }
            // n repeats.
            else if (repeatsRemaining > 0)
            {
                //Checks if it needs to play the user recording or the database recording.
                if (playRecording && !recordingProgressBarLabel.Text.Equals(noFileText))
                {
                    playRecording = false;
                    asyncPlay(audioFilePath); // Plays the file at the specific
                }
                else
                {
                    Console.WriteLine(repeatsRemaining);
                    if (!(repeatsRemaining == 0))
                    {
                        Console.Write("DataBase -> ");

                        repeatsRemaining--;
                        playRecording = true;
                        asyncPlay();
                    }
                }
            }
            else if ((repeatsRemaining == 0) && ((!recordingProgressBarLabel.Text.Equals(noFileText)) && playRecording))
            {
                playRecording = false;
                asyncPlay(audioFilePath);
            }
            else
            {
                repeatsRemaining = RepeatTimes;
                // Autoplay functionality
                if (playNextCheckBox.Checked)
                {
                    try
                    {
                        if (currentRecordingIndex < wordsList.Count - 1)
                        {
                            currentRecordingIndex++;
                            // Run this command on the GUI thread
                            Invoke((MethodInvoker) delegate {
                                WordComboBox.SelectedIndex++;
                            });
                        }
                        else    // Move back to beginning if the user reaches the end of the list.
                        {
                            currentRecordingIndex = 0;
                            Invoke((MethodInvoker) delegate {
                                WordComboBox.SelectedIndex = 0;
                            });
                        }
                        playAudio();
                    }
                    catch (IndexOutOfRangeException exp)
                    {
                        // This can be reached in some cases where the Invoke takes too long.
                        WordComboBox.SelectedIndex = currentRecordingIndex;
                    }
                }
                else
                {
                    playButton.ImageIndex = 1;
                }
            }
        }
Пример #9
0
 private void MediaPlayer_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     doform(() => toolStripStatusLabel1.Text = "已停止");
     doform(() => toolStripStatusLabel2.Text = "");
 }
Пример #10
0
 void vlcControl1_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     Invoke(myDelegate);
     //this.Visible=false;
 }
Пример #11
0
 private void EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     _vlcControl.Play(new FileInfo(_currentImageLocation));
 }
Пример #12
0
 private static void VlcMediaPlayer_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     Debug.WriteLine("End Reached");
 }
Пример #13
0
 private void vlcControl1_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     MessageBox.Show("Test");
 }
Пример #14
0
 /// <summary>
 /// When the video finishes playing, revert the play button to it's original state, and repeat the video if the user has set it to repeat.
 /// </summary>
 /// <param name="sender">Automatically generated by Visual Studio.</param>
 /// <param name="e">Automatically generated by Visual Studio.</param>
 private void vlcControl_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
 {
     // The only way to loop playback is to have a delegate call play asynchronously.
     if (RepeatTimes == 11)
     {
         if ((!recordingProgressBarLabel.Text.Equals(noFileText)) && (playRecording))
         {
             asyncPlay(audioFilePath);
         }
         else
         {
             asyncPlay();
         }
     }
     else if (repeatsRemaining > 0)
     {
         if ((!recordingProgressBarLabel.Text.Equals(noFileText)) && (playRecording))
         {
             asyncPlay(audioFilePath);
         }
         else
         {
             asyncPlay();
             repeatsRemaining--;
         }
     }
     else if ((repeatsRemaining == 0) && ((!recordingProgressBarLabel.Text.Equals(noFileText)) && (playRecording)))
     {
         playRecording = false;
         asyncPlay(audioFilePath);
     }
     else
     {
         repeatsRemaining = RepeatTimes;
         // Autoplay functionality
         if (playNextCheckBox.Checked)
         {
             try {
                 if (currentRecordingIndex < wordsList.Count - 1)
                 {
                     currentRecordingIndex++;
                     // Run this command on the GUI thread
                     Invoke((MethodInvoker) delegate {
                         VowelComboBox.SelectedIndex++;
                     });
                 }
                 else    // Move back to beginning if the user reaches the end of the list.
                 {
                     currentRecordingIndex = 0;
                     Invoke((MethodInvoker) delegate {
                         VowelComboBox.SelectedIndex = 0;
                     });
                 }
                 playVideo();
             }
             catch (IndexOutOfRangeException exp)
             {
                 // This can be reached in some cases where the Invoke takes too long.
                 VowelComboBox.SelectedIndex = currentRecordingIndex;
             }
         }
         else
         {
             playButton.ImageIndex = 1;
         }
     }
 }
        private void MediaPlayer_EndReached(object sender, Vlc.DotNet.Core.VlcMediaPlayerEndReachedEventArgs e)
        {
            CurrentPlayingFileIndex++;

            if (PlayerPlaybackScale == Helper.PlaybackScaleEnum.DCR && CurrentPlayingFileIndex % 2 == 0)
            {
                Dispatcher.Invoke(() =>
                {
                    DCR_Dialog dialog = new DCR_Dialog();
                    dialog.ShowDialog();
                    MediaFile tempFile = ListOfMediaFiles[CurrentPlayingFileIndex - 1] as MediaFile;
                    tempFile.UserGrade = dialog.Result;
                    ListOfMediaFilesWithGrades.Add(tempFile);
                });
            }
            else if (PlayerPlaybackScale == Helper.PlaybackScaleEnum.ACR)
            {
                Dispatcher.Invoke(() =>
                {
                    ACR_Dialog dialog = new ACR_Dialog();
                    dialog.ShowDialog();
                    MediaFile tempFile = ListOfMediaFiles[CurrentPlayingFileIndex - 1] as MediaFile;
                    tempFile.UserGrade = dialog.Result;
                    ListOfMediaFilesWithGrades.Add(tempFile);
                });
            }

            if (CurrentPlayingFileIndex >= ListOfMediaFiles.Count)
            {
                ThreadPool.QueueUserWorkItem(x =>
                {
                    VLC_Control.SourceProvider.MediaPlayer.Stop();
                });

                Dispatcher.Invoke(() =>
                {
                    Rating tmpRating = new Rating
                    {
                        DurationSeconds     = (int)TimeLeft.Elapsed.TotalSeconds,
                        RatingSeconds       = Helper.RatingDelay,
                        ReferenceVideoPath  = FilesControlObject.TextBox_RefPath.Text,
                        PlaybackMode        = Helper.CurrentPlaybackMode,
                        PlaybackScale       = Helper.CurrentPlaybackScale,
                        FilesListWithGrades = new List <MediaFile>(ListOfMediaFilesWithGrades),
                        DateTimeRating      = DateTime.Now,
                    };

                    Helper.AddUserRatingToGrid(tmpRating);
                    ListOfMediaFilesWithGrades.Clear();
                    Helper.EnableNavigationButtons();
                    Helper.ResetStatusControl();
                });

                CurrentPlayingFileIndex = 0;
                return;
            }
            else if (CurrentPlayingFileIndex < ListOfMediaFiles.Count)
            {
                Dispatcher.Invoke(() =>
                {
                    Helper.ChangeStatusControl($"Metoda MOS: {PlayerPlaybackScale.ToString()} | Kolejność: {Helper.PlaybackModeToString(PlayerPlaybackMode)} | Plik: {ListOfMediaFiles[CurrentPlayingFileIndex].Path}", false);
                });

                ThreadPool.QueueUserWorkItem(x =>
                {
                    VLC_Control.SourceProvider.MediaPlayer.Play(new Uri(ListOfMediaFiles[CurrentPlayingFileIndex].Path));
                });
            }
        }