Recent

Author Topic: how playing sound file in lazarus android ?  (Read 4411 times)

karika

  • New Member
  • *
  • Posts: 20
how playing sound file in lazarus android ?
« on: February 14, 2019, 11:03:43 pm »
how playing sound file in lazarus android ?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: how playing sound file in lazarus android ?
« Reply #1 on: February 15, 2019, 11:49:29 am »

LAMW???

You can try the demos:

   AppMediaPlayerDemo1
   AppVideoViewDemo1
   AppLoadImageVideoSoundFromInternet

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #2 on: February 18, 2019, 05:09:20 pm »
iam using laztoapk version #:1.8.0
now i have file sound 'hello.mp3'  How to make it work in lazarus android by MediaPlayer For example  ?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: how playing sound file in lazarus android ?
« Reply #3 on: February 19, 2019, 01:02:51 am »

Have you a complete lazarus-android installation?

if not, try here:

https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW%20Getting%20Started.txt

but if you  have a complete lazarus-android installation then you can try the demos: 

[LAMW folder  "....../demos/GUI"]

   AppMediaPlayerDemo1
   AppVideoViewDemo1
   AppLoadImageVideoSoundFromInternet
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #4 on: February 23, 2019, 12:05:13 pm »
thx,Yes I tried it but it is complicated,
I want simple steps to use MediaPlayer on LAMW [Gui] Android jform?
« Last Edit: February 23, 2019, 12:06:58 pm by karika »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: how playing sound file in lazarus android ?
« Reply #5 on: February 23, 2019, 09:59:25 pm »
Quote
thx,Yes I tried it but it is complicated....

Can you do a simple "hello"  App?

[just a button and some  showmessage('Hello')  to handle the button click event...]
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #6 on: February 23, 2019, 10:41:41 pm »
 >:( >:( >:( >:( >:( >:(

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #7 on: February 23, 2019, 10:43:50 pm »
Why not give the answer in detail this first time to me

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: how playing sound file in lazarus android ?
« Reply #8 on: February 23, 2019, 11:10:31 pm »
Hi, karika...

0) Configure paths... lazarus menu: "Tools" ---> "[LAMW] ...." --> "Paths Settings ..."

1) Your project construction is incorrect... please, do:

menu "Project" ---> "New Project" ---> "LAMW [GUI] Android Module"

2) after project construction put your "mp3" file in project folder "assets" ...
 [ex.  pipershut2.mp3]

3) Put a jButton and a jMediaPlayer on the form...

4) handle the button "OnClick" event:

Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. begin
  3.   jMediaPlayer1.LoadFromAssets('pipershut2.mp3');
  4. end;
  5.  

5) handle the jMediaPlayer "OnPrepared" event:

Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jMediaPlayer1Prepared(Sender: TObject;
  2.   videoWidth: integer; videoHeight: integer);
  3. begin
  4.   jMediaPlayer1.Start();
  5. end;
  6.  

6) Connect your device by usb cable... [you need active "mode developer"]

7) lazarus menu "Run" --> "[LAMW] Build Apk and Run"

..............Listen to the sound and enjoy!

note: there are some help here:
https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW%20Getting%20Started.txt 
« Last Edit: February 24, 2019, 04:55:01 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: how playing sound file in lazarus android ?
« Reply #9 on: February 24, 2019, 03:04:10 am »
>:( >:( >:( >:( >:( >:(

I understand you want to get the answer and you're impatient. But no one here owe you money.

So please don't show the red angry face>:(
« Last Edit: February 24, 2019, 12:48:00 pm by Handoko »

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
Re: how playing sound file in lazarus android ?
« Reply #10 on: February 24, 2019, 05:05:32 am »
>:( >:( >:( >:( >:( >:(

How arrogant you are. Please be polite.
Holiday season is online now. :-)

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #11 on: February 25, 2019, 11:51:05 pm »
I am very sorry I did not mean this but I mean that I was angry with myself because I did not understand something that's my intention and I repeat my apology again

karika

  • New Member
  • *
  • Posts: 20
Re: how playing sound file in lazarus android ?
« Reply #12 on: February 25, 2019, 11:52:11 pm »
This succeeded me from the first time
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. begin
  3.   jMediaPlayer1.SetDataSource('pipershut2.mp3');  //from  .../assets...
  4.          jMediaPlayer1.Prepare();
  5.          jMediaPlayer1.Start();
  6.  
  7. end;  
  8.  

 

TinyPortal © 2005-2018