Help with native.newVideo() functionality

Hi,
I am able to get a video to play and but I cant get the following to work properly.

  1. When a user touches the screen I want the video to stop playing and want the user take to another scene.

  2. If the user watches the entire video, I want the user taken to the next scene automatically on completion of the video.

I am using the storyboard api to go between scenes and have included the code from the scene:createScrene(event).

Heres my code:

[blockcode]function scene:createScene( event )
local group = self.view
local bgcolor
local vidLength

– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.


local introVideo = native.newVideo( 0, 0, 640, 960 )

introVideo:load(“videos/video.mp4”)
introVideo:play()
group:insert(introVideo)

function onScreenTouch (event)
storyboard.gotoScene( “scripts.game”,“fade”, 100 )
end

vidLength = (introVideo.totalTime)*1000 – calculates video length in milliseconds

– will automatically move to the game.lua screen after the video plays

local function skip ()
introVideo:pause()
print (“going to scripts/game.lua”)
storyboard.gotoScene( “scripts.game”,“fade”, 100 )
end

Runtime:addEventListener( “touch”, onScreenTouch )

videoTmr = timer.performWithDelay(vidLength, skip, 1 )

end[/blockcode]
Please help this is driving me nuts!

Scott
Code Delivey Boy LLC [import]uid: 46725 topic_id: 31141 reply_id: 331141[/import]