private void PauseButton_Click(object sender, EventArgs e) { _playStatus = PlayStatus.Paused; UpdateUi(); VlcClient.TogglePause(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (_vlcManager.IsInitialized) { VlcClient.Stop(); } _vlcManager.Stop(); }
private void StopButton_Click(object sender, EventArgs e) { if (_playStatus == PlayStatus.Paused) { VlcClient.TogglePause(); } VlcClient.Stop(); _playStatus = PlayStatus.Stopped; UpdateUi(); }
private void VideoPosition_MouseUp(object sender, MouseEventArgs e) { if (!_blockVideoPositionValueChange) { return; } _blockVideoPositionValueChange = false; if (_playStatus == PlayStatus.Playing) { VlcClient.SeekTo(VideoPosition.Value); } }
private void SetupTimerSync() { var timer = new Timer(1000); timer.Elapsed += (sender, args) => { lock (_lockObject) { if (_playStatus == PlayStatus.Playing && _vlcManager.IsInitialized) { var timeStatus = VlcClient.SyncTime(IsFirstPlayerMain); UpdateVideoPosition(timeStatus.CurrentTime); _timeStatusTimeDifference = timeStatus.TimeDifference; } } }; timer.AutoReset = true; timer.Enabled = true; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Globals.CurrentComputerModel = new ComputerModel("192.168.1.100", "88134165"); // Set our view from the "main" layout resource SetContentView(Resource.Layout.main); Client = new VlcClient(Globals.CurrentComputerModel.Ip, 8080, Globals.CurrentComputerModel.Password); Client.ConnectionChanged += ClientOnConnectionChanged; Client.StatusUpdated += ClientOnStatusUpdated; DirectoryManager = new DirectoryManager(Client); TimeTextView = FindViewById <TextView>(Resource.Id.timeTextView); TimeTextView2 = FindViewById <TextView>(Resource.Id.timeTextView2); TimeShiftTextView = FindViewById <TextView>(Resource.Id.timeShiftText); TitleTextView = FindViewById <TextView>(Resource.Id.titleText); IpTextView = FindViewById <TextView>(Resource.Id.ipText); ProgressTextView = FindViewById <TextView>(Resource.Id.progressText); ConnectionTextView = FindViewById <TextView>(Resource.Id.connectionTextView); RootLayout = FindViewById <RelativeLayout>(Resource.Id.rootMainPageLayout); CardView = FindViewById <CardView>(Resource.Id.cardView); CardViewIcon = FindViewById <ImageView>(Resource.Id.cardViewIcon); SkipButton = FindViewById <FloatingActionButton>(Resource.Id.skipButton); FastForwardButton = FindViewById <FloatingActionButton>(Resource.Id.fastForwardButton); FullscreenButton = FindViewById <FloatingActionButton>(Resource.Id.fullscreenButton); PlayPauseButton = FindViewById <MorphButton>(Resource.Id.playPauseBtn); VolumeSeekbar = FindViewById <SeekBar>(Resource.Id.volumeSeekBar); VolumeSeekbar.StopTrackingTouch += VolumeSeekbar_StopTrackingTouch; VolumeSeekbar.StartTrackingTouch += VolumeSeekbarOnStartTrackingTouch; VolumeSeekbar.ProgressChanged += VolumeSeekbar_ProgressChanged; TimeShiftSeekbar = FindViewById <SeekBar>(Resource.Id.timeShiftBar); TimeShiftSeekbar.StopTrackingTouch += TimeShiftSeekbar_StopTrackingTouch; TimeShiftSeekbar.ProgressChanged += TimeShiftSeekbar_ProgressChanged; Cheeseknife.Bind(this); IsEnabled = false; }
public MainForm() { InitializeComponent(); SetupTimerSync(); InitDefaultValuesFromSettings(); Application.ApplicationExit += (_, __) => { if (_vlcManager.IsInitialized) { VlcClient.Stop(); } _vlcManager.Stop(); }; if (!string.IsNullOrWhiteSpace(VlcPathText.Text)) { TryInitVlcManager(); } }
private void PlayButton_Click(object sender, EventArgs e) { if (_playStatus == PlayStatus.Stopped) { VlcClient.AddFile(_filePath, IsFirstPlayerMain); VlcClient.SetAudioTracks(LeftAudioTrack.SelectedIndex + 1, RightAudioTrack.SelectedIndex + 1); var leftAudioDevice = _videoInfo.AudioDevices[LeftAudioDevice.SelectedItem.ToString()]; var rightAudioDevice = _videoInfo.AudioDevices[RightAudioDevice.SelectedItem.ToString()]; VlcClient.SetAudioDevices(leftAudioDevice, rightAudioDevice); VlcClient.SeekTo(VideoPosition.Value); } else if (_playStatus == PlayStatus.Paused) { VlcClient.SeekTo(VideoPosition.Value); VlcClient.TogglePause(); } _playStatus = PlayStatus.Playing; UpdateUi(); }
private void FileBrowseButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(VlcPathText.Text)) { return; } if (openFileDialog.ShowDialog() == DialogResult.OK) { if (_playStatus != PlayStatus.Stopped) { StopButton_Click(null, null); } SelectedFileLabel.Visible = true; _filePath = openFileDialog.FileName; SelectedFileLabel.Text = openFileDialog.FileName; _videoInfo = VlcClient.GetFileInfo(openFileDialog.FileName); Text = _videoInfo.Title; LeftAudioTrack.Items.Clear(); RightAudioTrack.Items.Clear(); LeftAudioDevice.Items.Clear(); RightAudioDevice.Items.Clear(); foreach (var audioTrack in _videoInfo.AudioTracks) { LeftAudioTrack.Items.Add(audioTrack); RightAudioTrack.Items.Add(audioTrack); } foreach (var audioDevice in _videoInfo.AudioDevices) { LeftAudioDevice.Items.Add(audioDevice.Key); RightAudioDevice.Items.Add(audioDevice.Key); } VideoPosition.SetRange(0, _videoInfo.Duration); VideoTimeLabel.Visible = true; VideoPosition.Enabled = true; UpdateVideoTime(); ConfigurationPanel.Enabled = true; if (Properties.Settings.Default.DefaultLeftDevice >= 0 && Properties.Settings.Default.DefaultLeftDevice < LeftAudioDevice.Items.Count) { LeftAudioDevice.SelectedIndex = Properties.Settings.Default.DefaultLeftDevice; } if (Properties.Settings.Default.DefaultRightDevice >= 0 && Properties.Settings.Default.DefaultRightDevice < RightAudioDevice.Items.Count) { RightAudioDevice.SelectedIndex = Properties.Settings.Default.DefaultRightDevice; } if (Properties.Settings.Default.DefaultLeftTrack >= 0 && Properties.Settings.Default.DefaultLeftTrack < LeftAudioTrack.Items.Count) { LeftAudioTrack.SelectedIndex = Properties.Settings.Default.DefaultLeftTrack; } if (Properties.Settings.Default.DefaultRightTrack >= 0 && Properties.Settings.Default.DefaultRightTrack < RightAudioTrack.Items.Count) { RightAudioTrack.SelectedIndex = Properties.Settings.Default.DefaultRightTrack; } } }
public DirectoryManager(VlcClient client) { Client = client; }