hi,
I have a big problem with audio.stop()
when I call it , the next audio gets call
I want to stop all audios before changing scene
but its not working the next audio starts playing in the next scene.
here is my code so I can explain better.
here I start the first audio file.
function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then narrativeChannel = audio.play( audio1, { channel=5, onComplete=NarrationStart } ) elseif phase == "did" then end end
NarrationStart = function ( ) narrativeTimer = timer.performWithDelay( 100,function ( ) catBubble.isVisible = true catText.isVisible = true transition.from(catText, {time = 400,alpha = 0,y = catText.y - 15, onComplete = function () narrativeChannel = audio.play( audio2, { channel=5}) end })end, 1 )
and here is where I stop it
function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then if(narrativeChannel ~= nil) then audio.stop( ) print("stoped") --gets call end transition.cancel() if(narrativeTimer ~= nil)then timer.cancel( narrativeTimer ) end elseif phase == "did" then -- Called when the scene is now off screen end end
when I change scene while the first audio1 is play, the first audio gets stoped but right after that the audio2 start…
I dont know why is that happening.
please any ideas or coments how to fix this.
I tried audio.stop() , audio.stop(channelUsed)
and nothing keeps playing the next audio I dont want that.
thanks in advance.
Info: scene Manager: Composer
Corona build : Version 2014.2463 (2014.10.14)