Freezing in Delphi 2009 on second play

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 09 Feb 2012 05:16

I have installed VLCPlugin2 into a form in Delphi as an ActiveX. I can open a file and show it on the screen with no apparent problems.

VLC1.playlist.add(memOrigFile.Text, 'x1','play-and-stop');
VLC1.playlist.play;

The problem occurs when I then use the same code to choose a different file to load.

VLC1.playlist.add(memOrigFile.Text, 'x1','play-and-stop');
VLC1.playlist.next;
VLC1.playlist.play;

On the second run through, after running the .next command, the screen goes blank and it freezes. (Occurs regardless of if the second file is the same as the first or not).

I have tried putting the following code in front of the above code, but it doesn't help.

If VLc1.playlist.itemCount > 0 then
if VLC1.playlist.isPlaying then
VLC1.playlist.stop;

The following set of code was then tried.

VLC1.playlist.clear;
VLC1.playlist.add(memOrigFile.Text, 'x1','play-and-stop');
VLC1.playlist.play;

This code ran all the way through. However the screen was still showing the final still from the first video, and it again froze.

I then put a button on the form with the following code.

VLC1.input.position := 0.01;
VLC1.playlist.stop;
VLC1.playlist.play;

After running through one video I pressed the button. After the stop line was run (but before play) the screen went black and it froze.

It appears that there is some problem refreshing the playlist. Any thoughts welcome.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Freezing in Delphi 2009 on second play

Postby RSATom » 09 Feb 2012 06:07

what VLC version are you using?

Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 09 Feb 2012 06:30

When I run VLC Media Player (stand alone) it says 1.1.11.

I'm not sure how to check inside the IDE.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Freezing in Delphi 2009 on second play

Postby RSATom » 09 Feb 2012 06:37

You should use at least vlc 2.0 nightly. ActiveX in 1.1.11 is too buggy.

Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 09 Feb 2012 06:51

I have tried the following code. I can click button 3 as often as I want and it works fine (apart from a memory leak). Button 4 leads to a freeze.



procedure TTFrmMedia.Button3Click(Sender: TObject);var
Reg: TRegistry;
begin
blVLCPluginFound := false;

// Is VLC ActiveX Plugin installed on this PC?
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKeyReadOnly('\Software\Classes\VideoLAN.VLCPlugin.1\') then begin
blVLCPluginFound := true;
end;
finally
FreeAndNil(Reg);
end;

if blVLCPluginFound then begin
VLCPlugin1 := TVLCPlugin2.Create(Self);
VLCPlugin1.Parent := Self; // Means: Place the VLC-Player into Form1
VLCPlugin1.Align := alClient;
VLC1.Visible := false;
VLCPlugin1.Show;
VLCPlugin1.playlist.add(memOrigFile.Text, 'x1','play-and-stop');
// you can use any MRL with parameters instead of 'c:\video.mpg' here
VLCPlugin1.playlist.play;
end else begin
ShowMessage('I am really sorry, but VLC (or its ActiveX Plugin) is currently not installed on this PC!');
end;
end;


procedure TTFrmMedia.Button4Click(Sender: TObject);begin
if blVLCPluginFound then begin
blVLCPluginFound := false;
VLCPlugin1.playlist.stop;
FreeAndNil(VLCPlugin1);
end;

Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 09 Feb 2012 07:00

Where do I get version 2.0?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Freezing in Delphi 2009 on second play

Postby RSATom » 09 Feb 2012 07:03


Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 14 Feb 2012 12:15

Version 2 still looks a little too much in beta for my tastes. I'm having trouble with the wrapper as well. Any other ideas?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Freezing in Delphi 2009 on second play

Postby RSATom » 15 Feb 2012 05:07

It will be good if you give me sample application for tests.

Derek McKinnon
New Cone
New Cone
Posts: 7
Joined: 09 Feb 2012 05:12

Re: Freezing in Delphi 2009 on second play

Postby Derek McKinnon » 16 Feb 2012 02:24

Can you PM me your email address. Thanks

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Freezing in Delphi 2009 on second play

Postby RSATom » 16 Feb 2012 03:36

done


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 2 guests