Help, how to set fast forward when using MediaPlayer object to play m3u8?
The problem I have is that when I try to fast forward, the video always starts playing from the beginning, but after my debugging I found that there is no problem when I set the fast forward duration longer than the duration of a single ts file, for example, the duration of _playlist0.ts is 122 seconds, and when the fast-forward duration I set is less than 122 seconds, the video will start from the beginning, but as long as it exceeds 122 seconds (regardless of jumping to _playlist1.ts or jumping to any subsequent _playlist.ts file) It can be successfully fast-forwarded. In addition, MP4 files can be fast-forwarded arbitrarily.
My code is as follows:
public partial class MainWindow : Window { static LibVLC _libVLC; static MediaPlayer _mediaPlayer; videoView.Loaded += VideoView_Loaded;//VideoView load complete event void VideoView_Loaded(object sender, RoutedEventArgs e) { Core.Initialize(); _libVLC = new LibVLC(); _mediaPlayer = new LibVLCSharp.Shared.MediaPlayer(_libVLC); videoView.MediaPlayer = _mediaPlayer; Media media = new Media(_libVLC, new Uri("http://192.168.1.5:8066/Content/01/_playlist.m3u8"); _mediaPlayer.Play(media); this.KeyDown += VideoView_KeyDown;//Triggered when a keyboard key is pressed } private void VideoView_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { switch (e.Key) { case System.Windows.Input.Key.Right: **//_mediaPlayer.SeekTo(TimeSpan.FromMilliseconds(_mediaPlayer.Time + 15000)) //_mediaPlayer.Time += 15000; //_mediaPlayer.Position = 0.01F;** break; } } }
Where did I set it wrong?