0

I am putting together a winforms app using libvclsharp wrapper. It is a basic app that hosts 4 x VideoView windows and plays 4 different mp4 videos.

It plays ok and seems stable mostly, but the lib has some odd quirks that i cant seem to find an answer to

I need to click a button on the form and sent all the videos to a specific time, they are all the same length at the moment

using

  _mediaPlayer1 = new MediaPlayer(_libVLC1);
  _mediaPlayer2 = new MediaPlayer(_libVLC1);
  _mediaPlayer3 = new MediaPlayer(_libVLC1);
  _mediaPlayer4 = new MediaPlayer(_libVLC1); 

  media1 = new Media(_libVLC1, @"D:Video.mp4", FromType.FromPath);
  media2 = new Media(_libVLC1, @"D:Video2.mp4", FromType.FromPath);
  media3 = new Media(_libVLC1, @"D:Video3.mp4", FromType.FromPath);
  media4 = new Media(_libVLC1, @"D:Video4.mp4", FromType.FromPath); 

 _mediaPlayer1.Media = media1;
 _mediaPlayer2.Media = media2;
 _mediaPlayer3.Media = media3;
 _mediaPlayer4.Media = media4;

 videoView1.MediaPlayer = _mediaPlayer1;
 videoView2.MediaPlayer = _mediaPlayer2;
 videoView3.MediaPlayer = _mediaPlayer3;
 videoView4.MediaPlayer = _mediaPlayer4;

so to send all 4 to same time i use

foreach (var player in _PlayersCollection)
       {
        player.Time = 12000);
       }

the problem is when click button the if the videos are playing it moves straight to the new time location.

if the videos are paused the videos twitch like they are moving just one frame, then you if click again they jump to the right time location.

this is very annoying and i cant see a reason why.

I saw a tip online to suggest setting the output renderer for the lib to D3d9 instead of D3d11 but i cant find any examples of how to change that for this lib.

Does anyone have any suggestions please who is familiar with lib on winforms.

thanks

VillageTech
  • 1,968
  • 8
  • 18
Manity
  • 21
  • 1
  • 6
  • Can you make a video of the problem or share your full code in a git repo? It's hard to visualize whats your issue here – mfkl Dec 20 '19 at 05:09

1 Answers1

1

I also noticed this problem in vlc.dotnet

Looks like the player does not like it's time too be changed to fast. My solution was to limit the update rate of my tracker. Some thing similar may work for you.

long lngLastScrollTimeStamp=0;

private void trkVideo_Scroll(object sender, EventArgs e)
  {
  if (((Stopwatch.GetTimestamp() / TimeSpan.TicksPerMillisecond) - lngLastScrollTimeStamp) > 250)
    {
    vlcControl1.Time = trkVideo.Value;
    lngLastScrollTimeStamp = Stopwatch.GetTimestamp() / TimeSpan.TicksPerMillisecond;
    }
  }
Regis St-Gelais
  • 3,156
  • 5
  • 27
  • 40