1

Closed

Application not shuts down Correctly

description

Hello
 
I work with the Source Code 62051, on a Windows 7 64Bit.
 
If i start the Player play a movie and close the Windows Form application.
It not gets closesd fully. It hangs.
 
When i break the Debug i see it Hangs on the Line:

VlcContext.InteropManager.MediaPlayerInterops.Stop.Invoke(VlcContext.HandleManager.MediaPlayerHandles[this]);
in the File VlcControl.Common function public void Stop();
 
However if i stop the movie before i close the app it closes fully and goes back to Visual Studio.
 
I tried to fix the issue with a FormClose/Closing Event without any luck. If i try to stop the movie there the same Problem happens, i guess some Reference is not there anymore.
 
Second Thing:
 
Had to fix the Take_Snapshot function in Order to compile. Otherwise it is working fine.
 
    public void TakeSnapshot(string filePath, uint width, uint height)
    {
        if (VlcContext.InteropManager != null &&
            VlcContext.InteropManager.MediaPlayerInterops != null &&
            VlcContext.InteropManager.MediaPlayerInterops.VideoInterops.TakeSnapshot.IsAvailable)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Background,
                (Action)(() => VlcContext.InteropManager.MediaPlayerInterops.VideoInterops.TakeSnapshot.Invoke(VlcContext.HandleManager.MediaPlayerHandles[this], 0, StringToByteArray(filePath), width, height)));
        }
    }
    private byte[] StringToByteArray(string str)
    {
        System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
        return enc.GetBytes(str);
    }
 
Third:
 
When will the In Memory Snapshot function appear?
 
Forth:
 
vlcControl1.IsSeekable is missing.
vlcControl1.CanPause is missing.
 
Best Regrads and keep up that good Work
Really like the Api soon i use WPF as well to test that thing out :)
Closed Apr 18 at 7:09 AM by ZeBobo5

comments

ZeBobo5 wrote Jun 6, 2011 at 12:06 PM

Try to use latest release.
Thanks

rvs75 wrote Jun 10, 2011 at 11:19 AM

For the hang see "LibVLC Deadlock on libvlc_media_player stop (win32) [Fixed]" http://forum.videolan.org/viewtopic.php?f=32&t=87932&p=293122#p293122

DieBagger wrote Jul 16, 2011 at 12:51 PM

I still experience this deadlock (playing a http stream) with vlc-1.2.0-git-20110712-0002-win32.zip

It hangs in:
VlcContext.InteropManager.MediaPlayerInterops.Stop.Invoke(VlcContext.HandleManager.MediaPlayerHandles[this]);

fotisgpap wrote Aug 7, 2011 at 9:07 AM

Subscribe to the ShutdownStarted event of the Dispatcher of your usercontrol or window that you keep your vlc player in.

Dispatcher.ShutdownStarted += new EventHandler(Dispatcher_ShutdownStarted);

at the event, check to see if the player is still playing and stop it.
    void Dispatcher_ShutdownStarted(object sender, EventArgs e)
    {
        Dispatcher.ShutdownStarted -= new EventHandler(Dispatcher_ShutdownStarted);
        // Here you can check if player is still running and stop it. Do not stop it if it is not running
        // also a good place to call VlcContext.CloseAll(); after the stop.
    }