Play an audio clip in Android with LC? - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Play an audio clip in Android with LC? - Solved

Post by DR White » Fri Sep 20, 2013 12:09 am

I read a few posts and look around at the limited documentation on LC audio
and it sounds like this might be a weak area for LC.

So I have a game that I play an audio clip on certain events and
want to know the Best way to play an audio clip in LC (in an Android environment)?

Thanks,

David
Last edited by DR White on Fri Sep 20, 2013 10:03 pm, edited 2 times in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What is the Best way to play an audio clip in LC?

Post by Klaus » Fri Sep 20, 2013 10:48 am

Hi David,

on Android you do not have that many choices for this :D
...
play path_to_soundFile
...
Make sure to use the correct sound format for Android.

On mobile the "play" command is not limited to the engine
capabilities of Livecode but the supported formats of the target
platform.

Check this:
http://developer.android.com/guide/appe ... rmats.html


Best

Klaus

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What is the Best way to play an audio clip in LC?

Post by DR White » Fri Sep 20, 2013 11:11 am

Klaus,

I am leaving for work now and will checkout the link latter today.

Would it be possible for you to attach an example stack playing
a sound file, volume control and sound on/off utilizing this method?

Thanks,

David

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What is the Best way to play an audio clip in LC?

Post by Klaus » Fri Sep 20, 2013 11:29 am

Hi David,

I do not develop for Android, so please refer to the docs for this:
http://livecode.com/developers/guides/m ... -features/
Scroll to -> Basic Sound Playback Support

I saw that "mobilePlaySoundOnChannel" is also supported on Android, this will give you more control over your sounds than the "simple" play.


Best

Klaus

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What is the Best way to play an audio clip in LC?

Post by DR White » Fri Sep 20, 2013 3:10 pm

Klaus,

Thanks for the reference links,

David

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What is the Best way to play an audio clip in LC?

Post by DR White » Fri Sep 20, 2013 5:40 pm

So far, I have had no success playing a sound clip in Android with LC.

Some sample code would be very much appreciated.

Thanks,

David

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Play an audio clip in Android with LC? - Solved

Post by DR White » Fri Sep 20, 2013 10:10 pm

Problem Solved! :D

Please see the post of:
jacque » Fri Sep 20, 2013 12:19 pm

Under "Android Development", the topic :

How to use "mobilePlaySoundOnChannel"

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Play an audio clip in Android with LC? - Solved

Post by Klaus » Sat Sep 21, 2013 10:49 am

And it's even in the dictionary with examples! 8)

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Play an audio clip in Android with LC? - Solved

Post by DR White » Sat Sep 21, 2013 1:08 pm

Klaus,

I tried the exact examples in the dictionary for both "Play" and "mobilePlaySoundOnChannel", plus several variations.

I could not get either to work as they appeared in the dictionary, in an android environment.

I believe without the word "engine" as part of the path that Jacque brought to light, the odds of working were slim.

As always Klaus, Thanks for your help,

David

Post Reply