I have a in-app webView and run into a problem:
If the webpage has a youTube video playing and when I exit the webView, the UI is back to normal, but the audio is still playing in the background!
This does not happen in Corona Simulator. The audio stops.
But I test my app in a real device (Galaxy Tab), the audio problem shows up.
I am pretty sure I remove the webView when the scene exits, please see the code below:
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local webView function scene:createScene( event ) local group = self.view local url = event.params.theURL webView = native.newWebView(0, 0, display.viewableContentWidth, display.viewableContentHeight ) webView:request(url) group:insert(webView) end function scene:enterScene( event ) local group = self.view end function scene:exitScene( event ) local group = self.view webView:removeSelf() webView = nil end function scene:destroyScene( event ) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
I use this scene as a overlay scene. I exit this scene by
storyboard.hideOverlay( "fade", 400 )
Anything wrong with my code?
Or a bug in Corona?