Possible Goofy Fix Found for Missing PlayStopped

Scott Rossi scott at tactilemedia.com
Fri Jan 30 23:07:27 EST 2004


After spending the better part of today messing around with players, sound
files and wet towels to clear the bloody remains from my forehead, I may
uncovered a goofy fix for the missing playStopped message Jacqueline and I
batted around in December.  The RunRev folks may have already implemented a
fix for this, but in case they haven't, here's a recap:

On 12/5/03 11:14 AM, "J. Landman Gay" <jacque at hyperactivesw.com> wrote:

> Make a stack with a single player object, and
> assign the player an audio filename. I haven't tried with MP3 files,
> because my sources are all audio-only quicktime movies. So maybe try one
> of those.
> 
> Then put this script into the card:
> 
> on playLoop
>  global gPlay
>  if the shiftkey is down then -- stop loop
>    put false into gPlay
>  else
>    put true into gPlay
>    start player 1
>  end if
> end playLoop
> 
> on playStopped
>  global gPlay
>  if gPlay = true then playLoop
> end playStopped
> 
> Trigger it with either a button or from the message box, with
> "playloop". While it plays, click back and forth between the stack and
> the message box. You should see the problem. If the stack is frontmost,
> you don't get a playStopped message. You can verify by watching the
> message watcher, though the behavior speaks for itself.


OK, so while playing around with this stuff, I tried to find some way to
force update the player or the card, and discovered by accident that
resizing the stack causes the loop to continue.  So I created a repeating
handler that continuously sets the rect of the stack to itself (hey, I said
it was goofy, I didn't say it was pretty).  The above script was modified as
follows:

 on playLoop
   global gPlay
   if the shiftkey is down then -- stop loop
     put false into gPlay
     stop player 1
   else
     put true into gPlay
     start player 1
     goofyFix
   end if
 end playLoop

 on playStopped
   global gPlay
   if gPlay then playLoop
 end playStopped

 on goofyFix
   global gPlay
   if not gPlay then exit goofyFix
   set rect of this stack to rect of this stack
   send "goofyFix" to me in 100 milliseconds
 end goofyFix

The strange thing is, even though the script seems to work, the playStopped
handler won't return the name of the stopping player, which almost leads me
to believe whatever mechanism is handling the player messages is leaving out
that information somewhere.

Anyway, hope this is useful for folks in the interim.

[Tested on OSX 10.2.8]

Regards,

Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the metacard mailing list