Time property not correct at the end of video when playing from FileStream
Summary
mediaPlayer.Time property not changing towards the end but video is playing fine. A 52 second video is playing fine but Time property changes from 00:00:00 to 00:00:43 seconds only.
Minimal project and steps to reproduce
// make bugFlag = false and every things work correctly
public void PlayMedia(bool bugFlag = true)
{
LibVLC libVLC;
MediaPlayer mediaPlayer;
libVLC = new LibVLC();
mediaPlayer = new MediaPlayer(libVLC);
videoView.MediaPlayer = mediaPlayer;
mediaPlayer.TimeChanged += MediaPlayer_TimeChanged;
if (bugFlag)
{
FileStream stream = File.OpenRead("D:\\A.mp4");
Media media = new Media(libVLC, stream);
mediaPlayer.Play(media);
}
else
{
Media media = new Media(libVLC, "D:\\A.mp4", FromType.FromPath);
mediaPlayer.Play(media);
}
media.Dispose();
}
private void MediaPlayer_TimeChanged(object sender, MediaPlayerTimeChangedEventArgs e)
{
lblTime.Text = TimeSpan.FromMilliseconds(e.Time).ToString().Substring(0, 8);
}
Call PlayMedia(bugFlag: true)
What is the current bug behavior?
mediaPlayer.Time property not increasing after centain time when playing from FileStream
What is the expected correct behavior?
mediaPlayer.Time property should start from 0 and end to length of media
Does it work on other plaforms? Does it work with the official VLC apps?
Yes, when I play from stand alone VLC media player. it is working file. Yes, when I play via PlayMedia(bugFlag: false) (without Stream)
Environment
- OS: Windows
- Version Windows 7 64 bit
- Device: HP Laptop
- LibVLC version and architecture 3.0.11, x86
- LibVLCSharp version 3.4.6
- IDE Visual Studio 2019 Community Edition
- Language C#
- Platform Winforms