[Lazarus] PasLibVlc error handling?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] PasLibVlc error handling?

Free Pascal - Lazarus mailing list

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?

--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] PasLibVlc error handling?

Free Pascal - Lazarus mailing list
On Mon, 13 May 2019 14:37:32 +0200, Bo Berglund via lazarus
<[hidden email]> wrote:

>
>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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus