Hi,
I want to create an image button that can play a video from local. Here is what I’ve done. But it is still doesn’t work when I install on my device even in the simulator.
– Video Button aka posterFrame
local playVideoFeatured = display.newImage(“playv.png”)
playVideoFeatured:setReferencePoint(display.CenterReferencePoint)
playVideoFeatured.x = display.contentWidth * 0.5
playVideoFeatured.y = playVideoFeatured.y + 80
– Video Function
local playVideo = native.newVideo(0,0,320,480)
local function videoListener(event)
print ("Event phase : "…event.phase)
if event.errorCode then
native.showAlert(“Error!”, event.errorMessage,{“OK”} )
end
end
function playVideoFeatured:tap(e)
playVideo:load( “video.mp4”, system.DocumentsDirectory )
playVideo:play ()
video = nil
end
– Listeners
playVideoFeatured:addEventListener(“tap”, playVideoFeatured)
playVideo:addEventListener(“playVideo”, videoListener)
Appreciate if someone can help me.