Still stuck on playing a sound with a player
Graham Samuel
livfoss at mac.com
Wed Dec 18 13:27:51 EST 2013
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 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
On 18 Dec 2013, at 01:15, spencerlearning wrote:
> Graham Samuel-4 wrote
>> It seems I lack instructions for playing MP3s from beginning to end on a
>> Mac: before I started this, I thought it would be extremely simple and
>> indeed idiot-proof. I guess I was wrong, or I am even more mentally
>> challenged that I normally allow for.
>>
>> Is anyone using MP3 sounds in a desktop app, and if so, what is the
>> idiot-proof method?
>
> Here is the code I use for simple playing of an mp3 file:
>
> put "/Users/Brian/Desktop/mp3file.mp3" into tSoundFile
> stop player "player"
> set the fileName of player "player" to tSoundFile
> set the currentTime of player "player" to 0
> start player "player" of this card
>
> Hope it helps.
>
>
>
>
> -----
> Brian Spencer
> Spencer Learning
> http://spencerlearning.com
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Still-stuck-on-playing-a-sound-with-a-player-tp4673825p4673874.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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