Flopdong
Flopdong

Reputation: 369

How to clear VlcMediaPlayer media source

I have a VlcControl with embedded VlcMediaPlayer in my C# WPF tool.

I can choose and play a video source using:

    VlcControl.SourceProvider.MediaPlayer.SetMedia(sourceUri);

I want to be able to clear the media source from the player. Something like:

    VlcControl.SourceProvider.MediaPlayer.SetMedia(null);

Is there an easy way to do this without destroying and recreating the VlcMediaPlayer? This method works, but seems like a waste of resources.

Thanks!

Upvotes: 0

Views: 1881

Answers (1)

cube45
cube45

Reputation: 3979

This is not currently supported, but I created an issue on github for that : https://github.com/ZeBobo5/Vlc.DotNet/issues/535 .

A PR would be appreciated if you have time to work on it.

You could also call "Stop()", but this doesn't really free the media resources.

EDIT: In Vlc.DotNet 3.0.0, there is now a ResetMedia() method, see PR 539

Upvotes: 2

Related Questions