Dear users,

I Am visually impaired user so I have spent many many hours to search Pascal language related bundle, which will be able to create .apk package and GUI creation of The resulting app will not involve The number position specification of individual objects on The screen. I have found out, that I can not find out, how to call Android media player API. I have modified Lovecalc project which is available inside The following bundle.

https://sourceforge.net/p/javavcl/code/HEAD/tree/
Here is The source code, which gives The following error after running compiled .apk package on Android 6.0 device.
Information
Attempt to invoke virtual method
'void android.media.MediaPlayer.setDataSource(java.lang.String)' on
a null object reference
OK
I have also .png screen shot, but I do not think, that list moderators would be too glad, if I would send this attachment to all members of this mailing list.
And here is The source code, which produces The error.

unit MainForm;
{$mode objfpc}
{$H+}
interface
uses _System, Classes, Controls, Dialogs, Forms, GenChars, LCLIntf, Menus, StdCtrls, SysUtils, androidr22;
type
TFormMain = class(TForm)
jMediaPlayer1: AMMediaPlayer ;
PlayButton: TButton;
protected
procedure ButtonClick(A: TObject);
public
constructor Create(A: TComponent); override;
end;
var
FormMain: TFormMain;
implementation
constructor TFormMain.Create(A: TComponent);
begin
inherited;
Caption := Application.Title;
PlayButton:= TButton.Create(Self);
PlayButton.Align := alTop;
PlayButton.Parent := Self;
PlayButton.Caption := 'Play live stream';
PlayButton.OnClick := @ButtonClick;
(*
*)
(*
*)
end;
procedure TFormMain.ButtonClick(A: TObject);
begin
if A = PlayButton then begin
jMediaPlayer1.setDataSource('http://icecast7.play.cz/cro1-128.mp3');
jMediaPlayer1.Prepare();
jMediaPlayer1.Start();
end;
end;
end.

_______________________________________________
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply via email to