mobilePlaySoundOnChannel - how to toggle looping of a sound ?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
okk
Posts: 177
Joined: Wed Feb 04, 2015 11:37 am

mobilePlaySoundOnChannel - how to toggle looping of a sound ?

Post by okk » Tue Apr 30, 2024 9:29 am

Hi,
I run into an issue when I try to toggle the looping of a sound that was started with the mobilePlaySoundOnChannel command.

Code: Select all

mobilePlaySoundOnChannel sound, channel, type
What I would like to do is analogous to this command for desktop:

Code: Select all

set the looping of player myplayer to not the looping of player myplayer 
Any suggestions on how to achieve this? I try to avoid using the mobile player, I like the simplicity of the mobilePlaySoundOnChannel command.

When thinking about it, the current implementation of mobilePlaySoundOnChannel is a bit unlogical, with the options being "now", "next" or "looping". I think "looping" should be rather treated like a property such as Channel Volume. It would be nice to set it independently from the mobilePlaySoundonChannel command, but maybe it is possible, I just didn't see it yet...

Thanks for any pointers!
Oliver

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7283
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: mobilePlaySoundOnChannel - how to toggle looping of a sound ?

Post by jacque » Tue Apr 30, 2024 6:41 pm

Any call to mobilePlaySoundOnChannel will stop the current sound if the sound channel is the same. You can stop the loop by calling mobilePlaySoundOnChannel with empty as the sound. Or you can replace it by calling mobilePlaySoundOnChannel with the same sound and passing "now" as the type.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Xavierguirre
Posts: 1
Joined: Tue Jun 25, 2024 5:06 pm
Contact:

Re: mobilePlaySoundOnChannel - how to toggle looping of a sound ?

Post by Xavierguirre » Wed Jun 26, 2024 10:19 am

jacque wrote:
Tue Apr 30, 2024 6:41 pm
Any call to mobilePlaySoundOnChannel will stop the current sound if the sound channel is the same. You can stop the loop by calling mobilePlaySoundOnChannel with empty as the sound. Or you can replace it by calling mobilePlaySoundOnChannel with the same sound and passing "now" as the type.
How to add empty as the sound?

Post Reply

Return to “Android Deployment”