Search code examples
c#wpfaudiolibvlc

Change Audio Stream in VideoLan DotNet for WPF


We're using VideoLan DotNet for WPF to play DVD movies in our WPF application. Some movies have multiple audio stream. (for example in multiple languages) How can we choose the desired audio stream?
While searching VideoLan's Wiki, I found this:

[Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int AudioTrack
        {
            get
            {
                return this.nativeVlc.GetVlcObjectInt(ObjectType.VLC_OBJECT_INPUT, "audio-es", -1);
            }
            set
            {
                this.nativeVlc.SetVlcObjectInt(ObjectType.VLC_OBJECT_INPUT, "audio-es", value);
            }
        }

But I can't find the same property in the project I'm using (Vlc.DotNet)
So how can I detect how many audio streams exist and choose one?


Solution

  • I found out how to do so (mediaPlayer is an instance of VlcControl):
    We can count audio streams using mediaPlayer.AudioProperties.TrackCount and select the index using mediaPlayer.AudioProperties.Track.
    Now is there any way to get their description? (They usually have a name such as "English")