Page 1 of 1
playing audio on Android
Posted: Tue Apr 22, 2014 12:08 pm
by keram
Hi,
After reading few posts about problems with playing audio files on Android devices I'm still not sure what should be done.
My tablet is supporting audio formats: AAC, AAC+, AMR-NB, AMR-WB, eAAC+, MP3, OGG, WAV, WMA, AC-3, FLAC. I used a wav file that plays OK in IDE but not in the android standalone.
So I'd like to confirm:
1. If I import the audio file as Control, do I have to Copy Files in the Standalone Application Settings as well?
if yes,
2. Do I have to specify the path for it?
if yes,
3. is the path below correct?
put specialFolderPath("engine") into gPath
and
put this in the handler:
play audioClip file (gPath &"/audio.wav")
keram
Re: playing audio on Android
Posted: Tue Apr 22, 2014 12:23 pm
by LCNeil
Hi Keram,
The imported audio controls will not playback when deployed to either iOS and Android. As you have mentioned, you will need to use the "Copy Files" section of your standalone application settings if you wish to include any audio/video within your mobile apps.
Your script is almost correct but you do not need "file" after your play command. Remember to declare your global variable as well.
I have tested the following and the sound plays as expected-
Code: Select all
global gPath
on mouseUp
put specialFolderPath("engine") into gPath
play audioClip (gPath &"/audio.wav")
end mouseUp
Kind Regards,
Neil Roger
--
RunRev Support Team ~
http://www.runrev.com
——
Re: playing audio on Android
Posted: Tue Apr 22, 2014 1:29 pm
by keram
Thanks Neil,
runrevneil wrote:you will need to use the "Copy Files" section of your standalone application settings if you wish to include any audio/video within your mobile apps.
Does it meant that in this case I'm not limited to the use of only audio wav files that LC can play but can use mp3 files that most of the mobiles can play?
Or is the ability to play particular formats in standalones dependent on LC engine as well?
keram
Re: playing audio on Android
Posted: Tue Apr 22, 2014 1:36 pm
by LCNeil
Hi Keram,
With this method you are not limited to WAVS as MP3's will work fine. A list of the media formats that are supported by default on Android can be viewed at the following link-
http://developer.android.com/guide/appe ... rmats.html
Kind Regards,
Neil Roger
--
RunRev Support Team ~
http://www.runrev.com
——
Re: playing audio on Android
Posted: Thu Apr 24, 2014 3:22 pm
by newtronsols
I got this to work on Android:
by ticking Copy Referenced Files, and the destination folder became _ReferencedFiles
Re: playing audio on Android
Posted: Mon Nov 09, 2020 7:25 pm
by adamkatz2003
HI i know that i replay couple of years later but can i get a test project to learn from? i can't get the audio to work on my device
Re: playing audio on Android
Posted: Mon Nov 09, 2020 8:04 pm
by Klaus
Hi Adam,
welcome to the forum!
Add your sound(s) via the "Copy files" tab in the "Standalone Application Settings".
You will find them in your standalone in -> specialfolderpath("resources")
Code: Select all
...
play audioClip (specialfolderpath("resources") &"/your_audio.wav")
...
Best
Klaus