VLC Activex V2 - playlist.stop never returns (deadlock?)

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
ffr
New Cone
New Cone
Posts: 2
Joined: 13 Aug 2014 19:57

VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby ffr » 13 Aug 2014 20:41

Hi

I am creating a piece of software in WPF that uses VLC 2.1.3 ActiveX v2.
The program can be started multiple times and can play synchronized video on several screens.

I have a master application that communicates with the other programs and tells them what video to play or to jump to a specific location in a video.
Most of the time it works just fine!

Problem

Sometimes when wanting to stop a video, before starting a new one, one of the programs will hang in playlist.stop()
When debugging the C# code on the application that hangs, I can see that playlist.stop() never returns.

Cause

I can't reproduce it every time, but when changing videos fast it will happen eventually.
Below is the C# code that causes problems.

The vlcPlayer variable is the AxVLCPlugin2.
I am using "WindowsFormsHost" to host the ActiveX control in the WPF application.

Code: Select all

private void SetPlayStatus(MediaPlayerCommand _playCommand) { if (VlcNotPresent) return; var oldStaus = GetCurrentStatus(); // what is the play status before we apply the new play status if (_playCommand == MediaPlayerCommand.Play) { if (oldStaus == MediaPlayerCommand.Pause) { vlcPlayer.playlist.play(); return; } var index = _playlist.IndexOf(currentMediaFile); if (index < 0) // the playlist will always contain currentMediaFile, but just in case :-) { return; } vlcPlayer.playlist.playItem(index); } else if (oldStaus == MediaPlayerCommand.Play && _playCommand == MediaPlayerCommand.Pause) { vlcPlayer.playlist.pause(); } else if (_playCommand == MediaPlayerCommand.Stop) { if (vlcPlayer.input.state == 3 || vlcPlayer.input.state == 4) // Checking if VLC is playing or is paused, added this to try and avoid my problem... but it has no effect { vlcPlayer.playlist.stop(); // this is where the application hangs } } }
It seems like it could be some sort of timing issue since it appears more or less random :-(
Can it be a threading issue??

I really hope you clever guys have an answer to this!

Best regards
/Freddie

michael-h
New Cone
New Cone
Posts: 1
Joined: 05 May 2015 21:18

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby michael-h » 05 May 2015 21:22

Freddie,

Did you ever get a solution to this? I am getting exactly the same issue...

M.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby Jean-Baptiste Kempf » 05 May 2015 22:29

What stream are you playgin?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ffr
New Cone
New Cone
Posts: 2
Joined: 13 Aug 2014 19:57

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby ffr » 08 May 2015 11:30

Oh, first responses to this old post.

We are loading mp4 files into the playlist.
The problem might arise when using a playlist and trying to avoid auto change to next track we call stop on the playlist.
It is always in the transistion between movies.

This is what is happening in my appliction.
1) A movie is playing.
2) I stop this Movie
3) Find the next movie in the playlist
4) Play the found movie

To me it seems like there might be a deadlock between start and stop, because of the auto play and we can't disable that in the Active X (at least not to my knowlegde)

I did implement a bad hack where I put the stop command in a Thread and kill the thread if it takes to long.
This is really something I would like to get rid of, so please if you have any suggestions.

BR.
Freddie

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby Jean-Baptiste Kempf » 08 May 2015 14:45

Please share a test case, and we'll fix.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ivang
New Cone
New Cone
Posts: 1
Joined: 24 Mar 2016 11:13

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby ivang » 24 Mar 2016 11:20

Hello,
I encountered the same problem. My application never returns from playlist.stop. Are there any news about the problem? Walk around?
Best regards Ivan

Jacoboon
New Cone
New Cone
Posts: 2
Joined: 30 Sep 2016 22:06

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby Jacoboon » 30 Sep 2016 22:25

This is the only post I've found that represents my problem. I TO have encountered this bug. I have a bot that plays videos mostly from youtube or m3u8's from twitch vods. It works fine most of the time with the exception that it sometimes fails to start or stop. Now, when it fails to start, it does not hang. I can simply (and sadly) skip the video and move on. However, when it fails to stop, it will hang indefinitely. The bot goes into 'not responding' status and must be force ended, and restarted. It is without a doubt the playlist.stop() method that never returns. I would have to install metrics to trace down if it has anything to do with WHICH video it's playing, sorry I do not have more info there.

I'd rather use VLC and not embed chromium. For the simple fact that I do not want to use anyone's embedded player when I can just do it this way.

I made an account just to post this message.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby da2424 » 03 Oct 2016 12:48

Can you see this problem with VLC 3.0, too?

Jacoboon
New Cone
New Cone
Posts: 2
Joined: 30 Sep 2016 22:06

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby Jacoboon » 05 Oct 2016 10:22

I didn't realize there was a v3. So I just checked, and I see it in the nightlies. I might have to wait until it's a stable release to try it out :/ Or I might just give it a go anyway. Either way I will post a follow up eventually.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby da2424 » 07 Oct 2016 18:37

You can find the nightlies on http://nightlies.videolan.org/

novan
New Cone
New Cone
Posts: 1
Joined: 21 Aug 2018 09:58

Re: VLC Activex V2 - playlist.stop never returns (deadlock?)

Postby novan » 24 Aug 2018 00:23

I had a similar issue happening to me when I replaced my Windows Media Player plugin with the VLC one. My application was occasionally freezing when I would switch videos. After reading the OP's post I started experimenting with managing how I stopped the playing video and switched to a new one using only files over 4GB. With files of that size I was consistently able to recreate the error which told me that it had something to do with how long the player was taking to stop the playing large video files before it tried to load the next one. The issue completely went away if I hit the stop button and then selected the next video.

I added the following to my VB code:
For DC = 1 To 1000000
Application.DoEvents()
Next

I first used Thread.sleep but did not like how it locked the application for 2 seconds. It will probably work with a smaller number, but I was not concerned with finding the lowest possible number.

Anyway the loop solved the problem and I was able to use the Next Video button in my application to successfully cycle through my videos without the application failing. However I discovered that when I used my application's video browser to select a video it would still freeze. Because my video browser shrinks the player my guess is that the resize and swapping of video was too much for the player to handle. I modified my player so that it only closed the browser after the new video was successfully loaded and that solved the problem.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 13 guests