private void OnPlaybackPlay() { // Send sound effects SoundFxRequest soundFxRequest = new SoundFxRequest(); soundFxRequest.Effects = _effectsForm.GetEnabledEffects(); _playerCommunicatorControl.SendRequest(soundFxRequest); // Send play request PlayRequest request = (PlayRequest)RequestFactory.CreateRequest(MessageType.Play); if (_playlistForm.GetCurrent().Count.Equals(0)) { MessageBox.Show("Playlist is empty. Nothing to play", "Information"); return; } request.Tracks = _playlistForm.GetCurrent(); _playerCommunicatorControl.SendRequest(request); // TODO set state based on response // set controls state _mediaInfo.Open(_playlistForm.GetCurrent()[0]); _playbackControl.PlaybackStarted(_mediaInfo.GetDuration()); _mediaInfo.Close(); }
private void OnPlaybackPlay() { PlayRequest request = (PlayRequest)RequestFactory.CreateRequest(MessageType.Play); if (_playlistForm.GetCurrent().Count.Equals(0)) { MessageBox.Show("Playlist is empty. Nothing to play", "Information"); return; } request.Tracks = _playlistForm.GetCurrent(); AResponse response = _playerCommunicatorControl.SendRequest(request); try { // if success if (response.ResponseType == ServerResponseType.Success) { // set controls state _mediaInfo.Open(_playlistForm.GetCurrent()[0]); _playbackControl.PlaybackStarted(_mediaInfo.GetDuration()); _mediaInfo.Close(); _addonsForm.PlaybackStarted(); // Set volume OnPlaybackVolume(_playbackControl.Volume); } } catch (System.Exception) { } }
private void OnPlaybackPlay() { // Send play request PlayRequest request = (PlayRequest)RequestFactory.CreateRequest(MessageType.Play); if (_playlistForm.GetCurrent().Count.Equals(0)) { MessageBox.Show("Playlist is empty. Nothing to play", "Information"); return; } request.Tracks = _playlistForm.GetCurrent(); _playerCommunicatorControl.SendRequest(request); // TODO set state based on response // set controls state _playbackControl.DisableSeeking(); _playbackControl.PlaybackStarted(0); }
private void OnPlaybackPlay() { // Check if valid selection on playlist if (_playlistControl.GetCurrent().Count.Equals(0)) { MessageBox.Show("Playlist is empty. Nothing to play", "Information"); return; } // Crop selected on playlist _playlistControl.CropSelected(); // Lock playlist _playlistControl.LockListItems(); // create the files list _files.Clear(); int index = 0; foreach (string filename in _playlistControl.GetAll()) { VideoFile newEntry = new VideoFile(); newEntry.Filename = filename; newEntry.Layout.ZOrder = index++; _files.Add(newEntry); } // Create and send Play playRequest PlayRequest playRequest = (PlayRequest)RequestFactory.CreateRequest(MessageType.Play); playRequest.Tracks = _playlistControl.GetAll(); _playerCommunicatorControl.SendRequest(playRequest); // TODO set state based on response // set play state and compute maximum duration int maxDuration = 0; foreach (string track in _playlistControl.GetAll()) { _mediaInfo.Open(track); int tmpDuration = _mediaInfo.GetDuration(); _mediaInfo.Close(); if (maxDuration < tmpDuration) { maxDuration = tmpDuration; } } _playbackControl.PlaybackStarted(maxDuration); // Send Pause request _playerCommunicatorControl.SendRequest(RequestFactory.CreateRequest(MessageType.Pause)); _playbackControl.PlaybackPaused(); // Send layout request VideoLayoutRequest layoutRequest = new VideoLayoutRequest(); foreach (VideoFile file in _files) { layoutRequest.TracksLayout.Add(file.Layout); } _playerCommunicatorControl.SendRequest(layoutRequest); // Send resume request _playerCommunicatorControl.SendRequest(RequestFactory.CreateRequest(MessageType.Resume)); _playbackControl.PlaybackResumed(); // Set volume OnPlaybackVolume(_playbackControl.Volume); }