Still stuck on playing a sound with a player
Klaus major-k
klaus at major-k.de
Wed Dec 18 13:33:46 EST 2013
Hi Graham,
Am 18.12.2013 um 19:27 schrieb Graham Samuel <livfoss at mac.com>:
> Thanks Brian for your sample. I am encouraged that such a simple script works for you - I too am aiming at the simplest possible script.
>
> Thanks to you and others I am almost there, but I want to bundle my sounds with my app in the Mac plist, so I need a different way to find the path to them: that bit seems to be working in the IDE, and it works in the standalone in that I don't get an error (my script looks to see if the file is actually found), but so far no sound actually plays.
>
> Also I can't stop my player before I start like you, since I have a 'playStopped' handler
this might give a hint!
From the docs: about "playstopped":
...
The playStopped message is sent when a card containing the player closes and when the player's filename property is changed.
...
Maybe this is causing your trouble?
Do this to prevent this:
...
lock messages #!!!
set the filename of player "xyz" to "path to mp3 here..."
start player "xyz"
unlock messages
...
At least worth a try :-)
> for doing the next thing in my app when playing has finished (in my app, the playing isn't background music but takes centre stage while it's playing, and I need to wait for it to stop and then do something else). I don't think this matters since my sound is of a definite duration and doesn't loop, so it only needs to stop naturally as it were.
>
> Finally I don't understand what setting the currentTime does in your script. When I play the sound in the IDE without setting the currentTime, it always plays, but not (so far) in the standalone. I have no idea why.
>
> Got further, but still tinkering.
>
> Thanks again.
>
> Graham
Best
Klaus
--
Klaus Major
http://www.major-k.de
klaus at major-k.de
More information about the use-livecode
mailing list