public Session StartPlayback(string source, string sessionName, uint start, int end)
        {
            Session session;

            switch (_currentMode)
            {
            case ApplicationMode.Live:
                StopRecord();
                session = _playbackService.Play(source, sessionName, start, end);
                break;

            case ApplicationMode.Play:
            case ApplicationMode.Waiting:
                session = _playbackService.Play(source, sessionName, start, end);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _currentMode = _playbackService.IsPlaying()
                ? ApplicationMode.Play
                : ApplicationMode.Waiting;
            return(session);
        }
Beispiel #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (SettingsService.Current.IsStreamingEnabled)
            {
            }
            else
            {
                Download_Click(null, null);
                return;
            }

            var audio = GetContent(_message?.Content);

            if (audio == null)
            {
                return;
            }

            if (_message.IsEqualTo(_playbackService.CurrentItem))
            {
                if (_playbackService.PlaybackState == MediaPlaybackState.Paused)
                {
                    _playbackService.Play();
                }
                else
                {
                    _playbackService.Pause();
                }
            }
            else
            {
                _playbackService.Play(_message);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var voiceNote = GetContent(_message?.Content);

            if (voiceNote == null)
            {
                return;
            }

            var file = voiceNote.Voice;

            if (file.Local.IsDownloadingActive)
            {
                _protoService.Send(new CancelDownloadFile(file.Id, false));
            }
            else if (file.Remote.IsUploadingActive || _message.SendingState is MessageSendingStateFailed)
            {
                _protoService.Send(new DeleteMessages(_message.ChatId, new[] { _message.Id }, true));
            }
            else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive && !file.Local.IsDownloadingCompleted)
            {
                //_protoService.DownloadFile(file.Id, 32);
                _playbackService.Play(_message);
            }
            else
            {
                if (_message.IsEqualTo(_playbackService.CurrentItem))
                {
                    if (_playbackService.PlaybackState == MediaPlaybackState.Paused)
                    {
                        _playbackService.Play();
                    }
                    else
                    {
                        _playbackService.Pause();
                    }
                }
                else
                {
                    _playbackService.Play(_message);
                }
            }
        }
        private void TogglePlayPause()
        {
            switch (_playbackService.PlaybackState)
            {
            case MediaPlaybackState.Playing:
            {
                _playbackService.Pause();
                PlayPauseIcon = Icon.GetIcon("PlayIcon");
            }
            break;

            case MediaPlaybackState.Paused:
            {
                _playbackService.Play();
                PlayPauseIcon = Icon.GetIcon("PauseIcon");
            }
            break;
            }
        }
Beispiel #5
0
 private void Toggle_Click(object sender, RoutedEventArgs e)
 {
     if (_playbackService.PlaybackState == MediaPlaybackState.Playing)
     {
         _playbackService.Pause();
     }
     else
     {
         _playbackService.Play();
     }
 }
Beispiel #6
0
 private void Button_Clicked(object sender, EventArgs e)
 {
     if (isPlaying)
     {
         playbackService.Pause();
     }
     else
     {
         playbackService.Play();
     }
     isPlaying = !isPlaying;
 }
Beispiel #7
0
        public async Task <IActionResult> Play()
        {
            var statuscode = await _playbackService.Play();

            return(View("Index"));
        }
 /// <summary>
 /// The ContinueCommand Method.
 /// </summary>
 private void Continue()
 {
     _playbackService.Play();
     _modalService.CloseModal();
 }