Still stuck on playing a sound with a player
livfoss at mac.com
Mon Dec 16 15:35:59 EST 2013
Despite advice both from Jacque Gay and the mother ship, I am still having trouble using a player to play an MP3 file on a Mac. I'm using LC 6.5.1 RC-1 on OSX Lion 10.7.5
Jacque suggested I set the playrate of my player to 1. I did that. RR Support told me to create a handler that keeps calling itself until the currentTime of the player corresponds to its duration - this is because my script carries on after the player starts and eventually switches cards. Turns out (undocumented AFAIKS) that if you move to another card you terminate the sound. As I see it, the recommended handler acts the same way "wait until the sound is done" does for an audio clip. Makes sense.
Well, a combination of these two things made one of my files work. I then wanted to arrange for a button on a different card to play a different (MP3) sound using a hidden player on the same card. Since the script on this one doesn't try to change cards, I left out the 'waiting' handler. The whole script is
set the playRate of player "playComment" to 1
sometimes I put some kind of 'wait' statement at the end just to see if it makes a difference.
Result, zilch - no sound at all. I then used the message box to query the duration of the player, which is linked to a 440Kb MP3 file. The answer was zero! How can this be, considering an ordinary QT player/iTunes will play the sound? It looks almost as if the link to the MP3 file in the player object was somehow ineffective. I have of course checked the link and remade it a few times.
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?
More information about the Use-livecode