Exemple #1
0
        //***********************************************************************************************************************************************************************************************************

        private void PlayerApp_OnPlayStateChange(object sender, PlayerPlayStateEventArgs e)
        {
            _logHandle.Report(new LogEventInfo(PlayerApp.PlayerName + " playback " + (e.Playing ? "started" : "paused")));

            PlayerPlaybackStatus status = PlayerApp.CurrentPlaybackStatus;

            if (e.Playing && status.Progress.TotalSeconds <= 2 && PlayerApp.CurrentTrack != null && !status.IsAd)
            {
                StartRecord();
            }
            else if (e.Playing && status.Progress.TotalSeconds > 2 && PlayerApp.CurrentTrack != null && !status.IsAd)
            {
                CurrentRecorder?.ResumeRecord();
            }
            else if (!e.Playing && PlayerApp.CurrentTrack != null && !status.IsAd)
            {
                CurrentRecorder?.PauseRecord();
            }
        }
Exemple #2
0
 private void PlayerApp_OnTrackTimeChange(object sender, PlayerTrackTimeChangeEventArgs e)
 {
     try
     {
         PlayerPlaybackStatus status = PlayerApp?.CurrentPlaybackStatus;
         if (status == null)
         {
             return;
         }
         if (status.IsPlaying && status.Progress != null && status.Progress.TotalSeconds < 2 && status.Track != null && !status.IsAd && _lastTrack != null && _lastTrack.TrackID == status.Track.TrackID && _lastProgress.TotalSeconds > 3)
         {
             StartRecord();
         }
         _lastTrack    = status?.Track;
         _lastProgress = ((status == null || status.Progress == null) ? TimeSpan.Zero : status.Progress);
     }
     catch (ObjectDisposedException)
     { }
     catch (Exception ex)
     {
         _logHandle.Report(new LogEventError("OnTrackTimeChange event: " + ex.Message));
     }
 }