Bo Berglund wrote 17 lines
Does anyone here know how to make PasLibVlc supply an error code or
error message when an error occurs?
I have implemented the event OnMediaPlayerEncounteredError in order to
check what is happening. So in this event handler I just display the
vlcPlayer.LastError and it is always an empty string...
I would like to know exactly what has happeden when trying to open a
media stream or file.
There are numerous possibilities like: non-existing target, http login
required, unsupported stream format etc.
What I have encountered is the login required error when the media
resides on a password protected directory on the webserver.
Anyone who has used PasLibVlc and solved the error handling?
Forgot to add the underlying event code from PasLibVlc:
property LastError: string
read FError
write FError;
procedure TPasLibVlcPlayer.WmMediaPlayerEncounteredError(var m:
TVlcMessage);
var
tmp : PAnsiChar;
begin
tmp := libvlc_errmsg();
if (tmp NIL) then
begin
FError := {$IFDEF
DELPHI_XE2_UP}UTF8ToWideString{$ELSE}UTF8Decode{$ENDIF}(tmp);
end
else
begin
FError := '';
end;
if Assigned(FOnMediaPlayerEncounteredError) then
FOnMediaPlayerEncounteredError(SELF);
m.Result := 0;
end;
And here is my simple test code:
procedure TfrmMain.vlcPlayerMediaPlayerEncounteredError(Sender:
TObject);
begin
MessageDlg('Error: ' + vlcPlayer.LastError, mtError, [mbOk], 0);
end;
The message dialog always shows "Error: ", i.e the LastError string is always empty.
Bo Berglund
Developer in Sweden