Delphi Wrapper for LibVLC v1.1

This forum is about all development around libVLC.
Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Delphi Wrapper for LibVLC v1.1

Postby Derek McKinnon » 14 Feb 2012 06:52

I have been trying to get this working for the last few days. Slowly I have worked through multiple issues (including all of the ones above). I think I now have it working, but nothing appears on screen.

It is as if the vidoe isn't linked in to the TPanel. Watching the threads click over in the debug environment indicates something is playing, as the threads stop changing quickly on a short video, but take longer on a long video.

Can anyone have a look at my code. I am about to give up showing video's in my application as I can't afford to spend any more time on it.

Thanks

Benoypix
New Cone
New Cone
Posts: 1
Joined: 07 Jun 2012 05:42

Re: Delphi Wrapper for LibVLC v1.1

Postby Benoypix » 07 Jun 2012 05:48

you can handle this by using a mousehook
-> http://delphi.about.com/od/windowsshell ... sehook.htm
How can I detect the mouse click if it is clicked in other application?

blugir
New Cone
New Cone
Posts: 5
Joined: 23 Jul 2018 09:24

Re: Delphi Wrapper for LibVLC v1.1

Postby blugir » 23 Jul 2018 09:40

Have anyone been able to receive mouse events once a video is playing? the only one that appears to fire is OnMouseActivate (i.e. not mouse down / mouse up etc). The panel does not seem to receive the WM_LBUTTONDOWN etc messages once the video is playing?

shafique121
New Cone
New Cone
Posts: 5
Joined: 10 Feb 2020 07:19

Re: Delphi Wrapper for LibVLC v1.1

Postby shafique121 » 10 Feb 2020 07:54

I'm trying to run your demo but without success (Delphi 2010).
Do you have a minimalist version, just with play and stop command to try to understand how it works?

shavlo
New Cone
New Cone
Posts: 6
Joined: 24 Feb 2021 10:23

Re: Delphi Wrapper for LibVLC v1.1

Postby shavlo » 24 Feb 2021 10:59

You can use those headers: https://prog.olsztyn.pl/paslibvlc/

And then adapting any C++ example will work for you.

A simple example included below. It simply plays a video on the TPanel. You also need to add _release calls to free the vlcMediaPlayer and the library itself when you're done.

Code: Select all

vlcInstance := libvlc_new(0, nil); vlcMedia := libvlc_media_new_path(vlcInstance, UTF8Encode('...path_to_file...')); vlcMediaPlayer := libvlc_media_player_new_from_media(vlcMedia); libvlc_media_release(vlcMedia); libvlc_media_player_set_hwnd(vlcMediaPlayer, Pointer(Panel1.Handle)); libvlc_media_player_play(vlcMediaPlayer);

Gronky
Blank Cone
Blank Cone
Posts: 13
Joined: 31 Mar 2022 19:52

Re: Delphi Wrapper for LibVLC v1.1

Postby Gronky » 18 Jan 2024 21:27

Code works great for me, except for somewhat rare and totally random crashing of app with no exceptions/errors generated, and even skips the main form's finalization code and embedded madexcept code.

Adding code to append all actions to a logfile shows the crash occurs with either a set media, play media, or play stop call.

I'm assuming it's due to an unhandled exception within one of VLC's DLL's. Anyone else experience this?

Gronky
Blank Cone
Blank Cone
Posts: 13
Joined: 31 Mar 2022 19:52

Re: Delphi Wrapper for LibVLC v1.1

Postby Gronky » 16 Feb 2024 00:54

^^^ An update to the above post...

I've just noticed that the crash occurs much more frequently if my system is getting low on free RAM and Windows starts thrashing the hard disk with pagefile swap-outs. So I guess it's an unhandled memory allocation exception within one or more of the libvlc DLL's?

Gronky
Blank Cone
Blank Cone
Posts: 13
Joined: 31 Mar 2022 19:52

Re: Delphi Wrapper for LibVLC v1.1

Postby Gronky » 21 Jun 2024 00:40

^^^ FWIW another update to the above, I replaced the following DLL files (dated 2022) with the latest versions (June 2024) however that weird random crashing still persists.
axvlc
libvlccore
libvlc
npvlc

I suppose I could learn C and play with the VLC code, might be easier though to just write a complementary Delphi program that sits in the background and automatically restarts the Delphi media player on detecting a sudden crash :-D


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests