Home > other >  Vlc. DotNet. How Wpf looping local video
Vlc. DotNet. How Wpf looping local video

Time:11-26

Vlc. DotNet. Wpf, events at the end of the play, I play again change the file, but the picture has been stopped at the end of the end of a picture, not start playing again? Which Daniel guidance about how to achieve looping,

CodePudding user response:

No API documentation

CodePudding user response:

No, only four DLL files,

CodePudding user response:

refer to the second floor HeZhiChuJian response:
no, there are only four DLL files,

That is according to the method to understand the meaning of test,

CodePudding user response:

 myVlcControl. State==Vlc. DotNet. Core. Interops. Signatures. The LibVlc. Media. States. Ended 

Is your myVlcControl VlcControl instance objects, check where it is end of the play, play the next to go, in addition to:
Vlc. DotNet. Core. Interops. Signatures. The LibVlc. Media. States. Error playback Error
Vlc. DotNet. Core. Interops. Signatures. The LibVlc. Media. States. Playing there is
Vlc. DotNet. Core. Interops. Signatures. The LibVlc. State Media. States. Stopped Stopped playing
Vlc. DotNet. Core. Interops. Signatures. The LibVlc. Media. States. Paused hold
There are a lot of yourself and see what you need, after reading English, slowly grope for

CodePudding user response:

 sourceProvider. MediaPlayer. EndReached +=MediaPlayer_EndReached; 

Private void MediaPlayer_EndReached (object sender, Vlc DotNet. Core. VlcMediaPlayerEndReachedEventArgs e)
{
Task. Factory. StartNew (()=& gt; {
This. SourceProvider. The Dispose ();
//this. SourceProvider=null;
Application. The Current. The Dispatcher. The BeginInvoke (new Action (()=& gt; {
Enclosing sourceProvider=new VlcVideoSourceProvider (Application. Current. The Dispatcher);
This. SourceProvider. CreatePlayer (libDirectory);
SourceProvider. MediaPlayer. Audio. Volume=0;
Enclosing sourceProvider. MediaPlayer. Play (new to the FileInfo (AppDomain. CurrentDomain. + PalyFileName2 BaseDirectory + @ \ ""));
SourceProvider. PropertyChanged +=SourceProvider_PropertyChanged1;
SourceProvider. MediaPlayer. EndReached +=MediaPlayer_EndReached;
SourceProvider. MediaPlayer. VideoOutChanged +=MediaPlayer_NewVideoOutChanged;
}));
});

}

CodePudding user response:

Big problem solved? Please share

CodePudding user response:

Seems to be only at the end of its events to play again in the
Public void MediaEndReached (object sender, EventArgs args)
{
ThreadPool. QueueUserWorkItem (_=& gt; This. The MediaPlayer. Play (" & lt; Another file>" ));
}

CodePudding user response:

Directly to the information is not enough, will be a deadlock, library mentioned on the git:

One of the most common issue reported is that Vlc. The DotNet freezes under certain the conditions.
Vlc. DotNet USES libvlc under the hood. The When libvlc calls a code, it is running in libvlc 's thread. In that thread, if you call libvlc code, the libvlc code will deadlock because it waits for method to return.
You need to make sure that your method returns control to libvlc so that it can execute your request.
For example, let 's say you want the video to loop, and you do something like this
Public void MediaEndReached (object sender, EventArgs args)
{
This. The MediaPlayer. Play (" & lt; Another file>" );
}
You will experience deadlocks.
Home, do something like this:
Public void MediaEndReached (object sender, EventArgs args)
{
ThreadPool. QueueUserWorkItem (_=& gt; This. The MediaPlayer. Play (" & lt; Another file>" ));
}
This ensures that your code is executed asynchronously on another thread, and the control is correctly returned to libvlc.
  • Related