0

I am currently using VlcControl ( Vlc.DotNet.Forms ) to play the video in latest VLC Media player using rtsp url in c# code _videoControl.Play(new Uri(networkUrl), options);

The issue here is ,the video is not playing in default Video Track 1 but it is playing in Video Track 2.

Is there any way to set the Video Track to 1?

Kindly let me know if any options available to set the video track and play.

mfkl
  • 1,914
  • 1
  • 11
  • 21
PraveenK
  • 61
  • 9

1 Answers1

0

You can use this to select the track you want to play : (disclaimer : I'm on my phone and I didn't test the code)

mediaPlayer.SetMedia(...);
mediaPlayer.Parse();
var videoTracks = mediaPlayer.Video.Tracks.All.ToArray();
mediaPlayer.Video.Tracks.Current = videoTracks[0];

mediaPlayer.Play();

The same can be achieved with Audio for audio tracks

cube45
  • 3,429
  • 2
  • 24
  • 35
  • Thank you so much I was able to set the current track . Is there a way to find out in which default video track (1,2,3,4,5) the video plays? Thanks in advance . – PraveenK Jun 27 '19 at 07:09
  • `mediaPlayer.Video.Tracks.CurrentTrack` also has a getter, so you can inspect that and compare to tracks from `.All` – cube45 Jun 27 '19 at 08:30
  • Sorry i missed your reply. My question was wrongly framed, what i meant is the video is playing defaultly in Video Track 2 but the mediaPlayer.Video.Tracks.CurrentTrack is Video Track 1. Is there a flag or method to know in which Video Track the stream is loaded? Thanks in Advance – PraveenK Jul 02 '19 at 07:32
  • If `Tracks.Current` is giving you another result than the one you're expecting, either your expectations are wrong or there is a bug in libvlc. Can you try with VLC and see if you can select the track correctly? if not, you should file a bug to VLC directly and attach the video file you're trying to play – cube45 Jul 02 '19 at 11:57
  • Thank you for the help. I want to do the same functionality as above but using the old version of VLC player (2014.4.18.0). using Vlc.DotNet.Core; using Vlc.DotNet.Core.Interops.Signatures.LibVlc.Media; using Vlc.DotNet.Core.Interops.Signatures.LibVlc.MediaListPlayer; using Vlc.DotNet.Core.Medias; VlcControl _videoControl; String rtspUrl = networkUrl; var media = new LocationMedia(rtspUrl); media.AddOption("rtsp-tcp"); _videoControl.Play(media); Kindly can you give more info regarding setting the video Track to 2 in old vlc Thanks in advance. – PraveenK Jul 17 '19 at 11:07
  • This is unreadable and out of scope of the question. I don't know what this version is, but chances are that you will not be able to get good support for 5-year-old versions... – cube45 Jul 17 '19 at 20:42
  • Hi ,I have just formatted the above comment and resubmitted question under answer section below. – PraveenK Jul 22 '19 at 09:07