Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, I'm trying to play a video in C# Winforms using LibVLCSharp library and it works well, when the user plays the video it will shows a window pop up that comes with minimize,hide,exit but when I pressed the exit button nothing happens why?


var libvlc = new LibVLC("--input-repeat=2");
                   var media = new Media(libvlc,new
                               StreamMediaInput(_toStream));
                   var mediaPlayer = new MediaPlayer(media);
                   mediaPlayer.Play();


What I have tried:

I've done alot like ALOT of googling arund 200 tabs and still couldn't found a solution.
Posted
Updated 12-Jan-23 1:30am

 
Share this answer
 
Hi,
I couldn't find any videoView in your code, please use latest version of LibVLCSharp and use videoView and attach your mediaplayer instance to the videoView.

Checkout this link.

Samples/LibVLCSharp.WinForms.Sample/Form1.cs · b65e43eef8438a3c07f60ce7605ae1e49a2786de · VideoLAN / LibVLCSharp · GitLab[^]
 
Share this answer
 
Comments
Dan Sep2022 16-Jan-23 10:24am    
OK, I just read documentation from the link and added the videoView but now how do I play from a memory stream?
Mohammad Reza Valadkhani 17-Jan-23 2:44am    
Please note videoView has MediaPlayer property, you can create your mediaplayer instance and set your values ( same as what you've done before to read from memory stream using MediaInput ) and then refer videoView.MediaPlayer to your MediaPlayer instance and from now control your mediaplayer from VideoView.MediaPlayer. so just do it again in case of problem, please share your VLC debug log messages to find out issues
Dan Sep2022 17-Jan-23 4:10am    
Thank you so much sir it's working now!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900