private void SkipBackSimpleButton_Click(object sender, EventArgs e) { if (_player.IsMediaLoaded) { _player.SeekAsync(_player.Position.TotalSeconds - 15 < 0 ? 0 : _player.Position.TotalSeconds - 15); } }
private void seekBar_MouseUp(object sender, MouseEventArgs e) { if (player.IsMediaLoaded) { player.SeekAsync(seekBar.Value); } //player.Position.Seconds = seekBar.Value; if (!positioncchangedevent) { player.PositionChanged += PositionChanged; positioncchangedevent = true; } }
private void MediaLoaded(object sender, EventArgs e) { ParseTracksAndSetDefaults(); if (!isChannel && player.Duration.TotalSeconds > 0) { seekBar.Invoke((System.Threading.ThreadStart) delegate { seekBar.Enabled = true; seekBar.Value = 0; seekBar.Maximum = Convert.ToInt32(player.Duration.TotalSeconds); if (SetPositionOnLoad) { seekBar.Value = positionOnLoad; } }); if (!positioncchangedevent) { player.PositionChanged += PositionChanged; positioncchangedevent = true; } } /*else * { * cmbLangs.Invoke((System.Threading.ThreadStart)delegate * { * cmbLangs.Enabled = false; * cmbLangs.Items.Clear(); * }); * cmbSubs.Invoke((System.Threading.ThreadStart)delegate * { * cmbSubs.Enabled = false; * cmbSubs.Items.Clear(); * * }); * seekBar.Invoke((System.Threading.ThreadStart)delegate { * seekBar.Enabled = false; * seekBar.Value = 0; * }); * }*/ player.Resume(); if (SetPositionOnLoad) { player.SeekAsync(positionOnLoad); SetPositionOnLoad = false; } btnPlayPause.BackgroundImage = Image.FromFile("./resources/images/pause.png"); btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch; if (currLang > -1) { cmbLangs.Invoke((System.Threading.ThreadStart) delegate { cmbLangs.SelectedIndex = currLang; }); currLang = -1; } if (currSub > -1) { cmbSubs.Invoke((System.Threading.ThreadStart) delegate { cmbSubs.SelectedIndex = currSub; }); currSub = -1; } panelvideo.Invoke((System.Threading.ThreadStart) delegate { panelvideo.Focus(); }); }
private void MediaLoaded(object sender, EventArgs e) { if (AmiConfiguration.Get().ENABLE_LOG) { string msg = "[MediaLoaded-MPV] MPV load streaming with next values: "; msg += $"SetPositionOnLoad => {SetPositionOnLoad} "; msg += $"currLang => {currLang} "; msg += $"isChannel=> {isChannel} "; msg += $"positioncchangedevent=> {positioncchangedevent} "; msg += $"player.Duration.TotalSeconds=> {player.Duration.TotalSeconds} "; Logger.Current.Debug(msg); } ParseTracksAndSetDefaults(); if (!isChannel && player.Duration.TotalSeconds > 0) { seekBar.Invoke((System.Threading.ThreadStart) delegate { seekBar.Enabled = true; seekBar.Value = 0; seekBar.Maximum = Convert.ToInt32(player.Duration.TotalSeconds); if (SetPositionOnLoad) { seekBar.Value = positionOnLoad; } }); if (!positioncchangedevent) { player.PositionChanged += PositionChanged; positioncchangedevent = true; } } /*else * { * cmbLangs.Invoke((System.Threading.ThreadStart)delegate * { * cmbLangs.Enabled = false; * cmbLangs.Items.Clear(); * }); * cmbSubs.Invoke((System.Threading.ThreadStart)delegate * { * cmbSubs.Enabled = false; * cmbSubs.Items.Clear(); * * }); * seekBar.Invoke((System.Threading.ThreadStart)delegate { * seekBar.Enabled = false; * seekBar.Value = 0; * }); * }*/ player.Resume(); if (SetPositionOnLoad) { player.SeekAsync(positionOnLoad); SetPositionOnLoad = false; } btnPlayPause.BackgroundImage = Image.FromFile("./resources/images/pause.png"); btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch; if (currLang > -1) { cmbLangs.Invoke((System.Threading.ThreadStart) delegate { cmbLangs.SelectedIndex = currLang; }); currLang = -1; } if (currSub > -1) { cmbSubs.Invoke((System.Threading.ThreadStart) delegate { cmbSubs.SelectedIndex = currSub; }); currSub = -1; } panelvideo.Invoke((System.Threading.ThreadStart) delegate { panelvideo.Focus(); }); }