I am daisy chaining audio files in Director so that when one finishes it charges the next with onComplete. This works well with the function below:
local playChain = function ()
if (_G.autoPlay) == 1 then
timerStash.timer_ns = timer.performWithDelay( 100, act_sc2, 1 )
end
end
audio.play( vars.Eng01, { channel=1, onComplete= playChain } )
But when this page is disposed and another one opened before the end of the audio track, vars.Eng01 (15secs), the console reports errors getting nil values while attempting to call methods in act_sc2. But act_sc2 shouldn’t be called in the instance you turn the page before the audio track has finished playing (in this case before 15 seconds).
All works well without errors if you remove onComplete from the audio expression.
I guess onComplete needs to be stopped and disposed. The timer is disposed before the new scene opens but that’s not working.
How to dispose or stop onComplete? Or should the formula above be adapted somehow?