Meta.Vlc
Meta.Vlc copied to clipboard
Method LoadWithOptions() constantly ignore options
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 :(
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..
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);
}
}