Still stuck on playing a sound with a player

Graham Samuel livfoss at mac.com
Wed Dec 18 14:57:54 EST 2013


Klaus, that's brilliant! I did not notice this and I wouldn't have guessed it. In my case, the filename property is set on the fly before I want the user to hear any sound, so your point is extremely important to prevent my playStopped action taking place at the beginning rather than the end of the playing sequence.

[At the moment, the 'playstopped' message is not being fired at all for some reason (this is in the standalone, whereas it works in the IDE). I hope to find out why shortly.]

Thanks a lot.

Graham

On 18 Dec 2013, at 19:33, Klaus major-k wrote:

> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list