Meta.Vlc icon indicating copy to clipboard operation
Meta.Vlc copied to clipboard

Method LoadWithOptions() constantly ignore options

Open M0n7y5 opened this issue 7 years ago • 2 comments

I have one problem ... When i try load media with custom options via method LoadMediaWithOptions(url, options) it completely ignore options no matter what values it has ...

I am trying play RTSP stream with --network-caching=SOMEVALUE option and during runtime i want change SOMEVALUE and restart stream with changed options, but it doesn't work :(

M0n7y5 avatar Apr 05 '18 15:04 M0n7y5

I have the same problem when i want to record and set the network-caching at the same time. Setting one option work but not multiple options..

saM21785 avatar Apr 07 '18 10:04 saM21785

For those interested, here is my workaround:

public class VlcPlayerExt : VlcPlayer
{
    public VlcPlayerExt()
    {
    }

    public new void LoadMediaWithOptions(string url, params string[] options)
    {
        VlcMediaPlayer.Media?.Dispose();
        VlcMediaPlayer.Media = VlcMediaPlayer.VlcInstance.CreateMediaFromLocation(url);
        if (options != null)
        {
            foreach (var option in options)
            {
                if (string.IsNullOrEmpty(option)) continue;

                VlcMediaPlayer.Media.AddOption(option);
            }
        }

        VlcMediaPlayer.Media.ParseAsync();
    }

    public new void LoadMediaWithOptions(Uri uri, params string[] options)
    {
        LoadMediaWithOptions(uri.ToString(), options);
    }
}

ghost avatar May 25 '18 18:05 ghost