So I am new as far as fundamentals go to corona development and I am trying to build a duplicate version of a video app I have already done in director, using the storyboard api.
My main issue is that I cannot get my video listener to fire properly and I’m wondering if anyone can point me in the right direction. I don’t know if I am placing my listener in the wrong area or if I am doing something fundamentally wrong but I have been unsuccessful moving to a new scene (in this case video_test) after the video has ended.
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local bgImage
local video = native.newVideo( 0, 0, 1024, 768 )
local function videoListener( event )
if event.errorCode then
native.showAlert( "Error!", event.errorMessage, { "OK" } )
end
if event.phase == "ended" then
storyboard.gotoScene( "video\_test" )
end
end
function scene:createScene( event )
local screenGroup = self.view
bgImage = display.newImage( "assets/home\_bg.png" )
video:load( "test.mp4")
video:seek( 0 )
video:addEventListener( "video", videoListener )
video:play()
end
function scene:enterScene( event )
local prior\_scene = storyboard.getPrevious()
storyboard.purgeScene( prior\_scene )
end
function scene:exitScene( event )
print( "1: exitScene event" )
end
function scene:destroyScene( event )
print( "((destroying Home Screen view))" )
end
scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
scene:addEventListener( "exitScene", scene )
scene:addEventListener( "destroyScene", scene )
return scene
[import]uid: 150370 topic_id: 36293 reply_id: 336293[/import]