[fpc-pascal] Free Pascal JVM And Android APIS issue

Mgr. Janusz Chmiel janusz.chmiel at volny.cz
Tue Mar 26 13:41:32 CET 2019


Dear users and developers,
Who of us know, why The following source code, which uses The following 
modules
https://­sourceforge.net/p/­javavcl/code/HEAD/­tree/
Do not play live stream after user compile it to Android and when user 
press play button?

         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.
Sure, androidmanifest.xml contain Internet permission.
Who of us would try to find The cause of this problem with Me? Do I use 
Android APIS incorrectly? DO I have to put some APi calls to separate 
procedure?
Do I have to create some neverending loop inside .pas source at The 
right place so play could start?



More information about the fpc-pascal mailing list