Page 1 of 1

start the video at a specific time

Posted: 21 Jan 2023 00:33
by sokrakes
Hi,
I'm using the Delphi code shown here - https://wiki.videolan.org/Using_libvlc_with_Delphi, it works fine.
However, I can't seem to add there to run the video at a specific time.
It is

Code: Select all

libvlc_media_player_set_time(libvlc_media_player, 10000);
I searched for a while for the settings, declension, when I managed to run it a message pops up.

Code: Select all

Access violation at address 65E85B78 in module Ílibvlccore,dll. Read of address 00000044
.
Do you have a tip please, point me to working code, for Delphi X5, I'm running on Windows.

Re: start the video at a specific time

Posted: 22 Jan 2023 15:48
by Rémi Denis-Courmont
This is a NULL pointer dereference, and that's pretty much all that can be inferred from the very little info provided.

Re: start the video at a specific time

Posted: 22 Jan 2023 18:09
by sokrakes
This is a NULL pointer dereference, and that's pretty much all that can be inferred from the very little info provided.
That's why I'm asking here, if anyone knows how to add the code above or has something working.
I've tried a lot of ways and nothing comes to mind anymore. Finding something functional or that would direct me with libvlc_media_player_set_time hasn't worked.
It would be ideal to add this to the code above for others.

Re: start the video at a specific time

Posted: 23 Jan 2023 16:55
by wbtcpip
the player must be playing or paused before to call libvlc_media_player_set_time

Re: start the video at a specific time

Posted: 23 Jan 2023 18:36
by sokrakes
the player must be playing or paused before to call libvlc_media_player_set_time
Thanks for the kick even though I had it on an already running video so the error was

Code: Select all

libvlc_media_player_set_hwnd(vlcMediaPlayer, Pointer(Panel1.Handle)); libvlc_media_player_play(vlcMediaPlayer); libvlc_media_player_set_time(libvlc_media_player, 170000); should be libvlc_media_player_set_time(vlcMediaPlayer, 170000);

Re: start the video at a specific time

Posted: 23 Jan 2023 18:51
by sokrakes
I added to this code https://wiki.videolan.org/Using_libvlc_with_Delphi

Code: Select all

implementation {$R *.dfm} var .................... libvlc_media_player_set_time : procedure(p_media_player : plibvlc_media_player_t; time : Int64); cdecl; ......................

Code: Select all

/ ----------------------------------------------------------------------------- // Get address of libvlc functions // ----------------------------------------------------------------------------- function LoadVLCFunctions(vlcHandle: integer; failedList: TStringList): Boolean; begin ................ GetAProcAddress(vlcHandle, @libvlc_media_player_set_time, 'libvlc_media_player_set_time', failedList); ............... end;

Code: Select all

..................... // play media libvlc_media_player_play(vlcMediaPlayer); libvlc_media_player_set_time(vlcMediaPlayer, 170000);