Meta.Vlc icon indicating copy to clipboard operation
Meta.Vlc copied to clipboard

Recommended exception handling

Open Transigent opened this issue 8 years ago • 9 comments

Hi I noted in #95 you mentioned that "Yes, it is known issue for xZune.Vlc", I presume this means there will be no solution for using this control in Windows 7.

Since we have to make our applications compatible with all modern operating systems, and Windows 7 is still the most popular operating system, I need to implement robust error handling to deal with this situation where one video hangs after playing another. I can tolerate a video not playing but having the app hang is not an option.

Is there a recommended error trapping pattern that can be used? It looks like xZune is spinning up a separate thread to run the VLC control, so I am not clear how this error can be trapped. Any thoughts would be appreciated! Thanks

Transigent avatar Apr 14 '16 02:04 Transigent

The one solution of this issue is when you want to play a new media release the old VlcMediaPlay and create a new.

The disadvantage is that the settings(like volume or others) of old player can not be applied to new.

devkanro avatar Apr 14 '16 04:04 devkanro

Tried to create a new VlcMediaPlayer before opening new video file to avoid "AccessViolationException" on Windows7 and now each video is opening in separate window with title "VLC (Direc3D output)". I'm using latest sources. Any ideas hot can I avoid that?

Divaite-zz avatar Apr 22 '16 13:04 Divaite-zz

After you create a new VlcMediaPlayer some callback and event need to be attached. Maybe I can add a method to VlcPlayer later. VlcPlayer.RebuildPlayer();

devkanro avatar Apr 22 '16 14:04 devkanro

Check the new code, and use the VlcPlayer.RebuildPlayer(); method after stop to create a new VlcMediaPlayer.

devkanro avatar Apr 22 '16 16:04 devkanro

Awesome, thanks for the change, it helps in some case. Now on Windows 7 there is no exception, but video is not shown after calling RebuildPlayer(). Looks like Vlc object (VlcPlayer.Vlc) should also be rebuilt. There is no such problem on Windows 8,10.

Divaite-zz avatar Apr 25 '16 15:04 Divaite-zz

Thanks for your test. From your description... I think the problem about LibVlc in Win7 is VLC instance have been released after stop video.

I don't know is it a issue of xZune.Vlc, you can help me to test it, you can take a breakpointer in Vlc.Dispose(). I think xZune.Vlc maybe call the Vlc.Dispose() after stop video.

devkanro avatar Apr 25 '16 16:04 devkanro

Did some tests. It's not about Vlc.Dispose(), but happens because Stop() call inside RebuildPlayer() function. VideoSource changes twice, first it sets BitmapSource correctly and then sets to null, because of asynchronous Stop() function. After removing this call, player works as expected.

Strange that it works ok on Win8 and 10.

Divaite-zz avatar Apr 26 '16 09:04 Divaite-zz

Ummmm, I got it. Maybe some fix will be commit later.

devkanro avatar Apr 26 '16 11:04 devkanro

FYI, I just wanted that this happens in Windows 10 as well. I haven't been able to pinpoint the cause or what's happening, unfortunately.

CntPickle avatar Jun 02 '16 15:06 CntPickle