Home > Back-end >  LibVLCSharp SetSpuDelay() is not working in WPF App
LibVLCSharp SetSpuDelay() is not working in WPF App

Time:06-15

I've implemented a player in my WPF app and used LibVLCSharp library. Everything is working as expected except 1 thing. To delay the subtitles.

I'm using MediaPlayer.SetSpuDelay(400) method from the library, it returns true (meaning, it says it worked). However, when I see the subtitle it is not actually delayed.

I even tried increasing the delay value to 6000 (6 secs.) but no luck! :(

Here is my method which I'm using to delay the subs:

public void SeekSubtitle(bool doPositiveSync)
{
      int _subtitleDelay = 0;
      MediaPlayer _mp = VideoView.MediaPlayer;

      //Negative value increase the timing of subtitle delay.
      if (doPositiveSync)
           _subtitleDelay  = 1000;
      else
           _subtitleDelay -= 1000;
    
      var result = _mp.SetSpuDelay(_subtitleDelay);
}
                

Kindly suggest what I'm missing here as this is crucial part of the app.

Thanks. :)

CodePudding user response:

Okay. So, I got the solution byself.

I was adding the value in form of Milliseconds. SetSpuDelay() requires value in MICROSECONDS.

I had to add /- 100000 to adjust subtitle.

  • Related