Further testing uncovered that

play empty

is the culprit... using this command on iOS cause some corruption that cause 
the next request to

play someSoundFile

to crash the app.

BUT  if you do

play nadanada # a bogus variable with no content.

the native behavior which causes the player to stop in order to start another 
one... seems to work

I had only to change that one line in the script which was meant to stop the playing  from 
"play empty" to "play nadanada" and everything works now.






I have the following behavior running in a series of buttons that play
audio which is local to the app.

They work fine on the desktop (OS X) but in iOS  if I click on any
button too soon, the app crashes.

I've done some  tests and I have to wait at about 5.5 seconds  before
clicking again, if we allow the app to have this time... then it does
not crash.

   This "must wait" delta  is more than users would want to experience.

It seems to be coming from  toggling between

play empty
play soundfile
play empty
play soundfile

it too rapid a succession...

play empty
      # wait 5.5 seconds
play soundfile
      # wait 5.5 seconds
play empty
      # wait 5.5 seconds
play soundfile
  # wait 5.5 seconds

and everything works fine.

It's almost as if iOS needs to clear something in the mobile player...
before you can reset it. i don't think any of the other
processes/handlers in my script are causing this...

Anyone have any clues?

------------------
global gPlayerIsRunning, gCurrentAudio

local aAudioMetadata,tTitle,tDuration,tAudioPath,tButton

on mouseUp
    set the itemdel to "_"
    put item 2 of the short name of me into tButton # e.g "audio_2"
    set the itemdel to comma

# metadata for eight audio files is stored locally in a JSON file.
    put fetchAudioJson() into aAudioMetadata
    put (localPath()&  "audio/"&
aAudioMetadata["audioOnBoard"][tButton]["filename"]) into tAudioPath

# the rest is very simple, play the sound, move some indicators on the
UI or stop the sound:

    if (gPlayerIsRunning = 1) AND (gCurrentAudio = (the label of me) ) then
       # We are just stopping the current audio
       # by tapping on the same audio button
       set the icon of btn "audioToggle" to 1304 # start playing icon
       if the environment<>  "mobile" then
          set the dontUseQT to true
          stop player "listenToGurudeva"
       else
          play empty
       end if
       put 0 into gPlayerIsRunning

    else
   put the loc of btn "audioToggle" into tNewLoc
    put the loc of fld "duration" into tNewDurationLoc
    put the loc of me into tCurrentLoc
    put ( (item 2 of tCurrentLoc) ) into item 2 of tNewLoc
    set the loc of btn "audioToggle" to tNewLoc
    put ( (item 2 of tCurrentLoc)  +2 ) into item 2 of tNewDurationLoc
    set the loc of fld "duration"  to tNewDurationLoc
     put the uDuration of me into fld "duration"
       set the icon of btn "audioToggle" to 1303 # pause icon
       if the environment<>  "mobile" then
          set the dontUseQT to true
          set the filename of player "listenToGurudeva" to tAudioPath
          start player "ListenToGurudeva"
       else
          play tAudioPath
       end if
       put 1 into gPlayerIsRunning
       put the label of me into gCurrentAudio
    end if
end mouseUp

BR


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to