I´m trying to download a mp4 video from a webpage, save it in TemporaryDirectory and playing it using native.newVideo.
The video downloads and gets saved but I cant play it on my Android device. The app exits.
I have tried the same with a mp3 sound-file. That works great.
Please help :rolleyes:
Here is my code:
local video = native.newVideo( display.contentCenterX, display.contentCenterY, 320, 480 )
local function startvideo()
video:load( “Latin.mp4”, system.TemporaryDirectory )
video:play()
end
local function networkListener( event )
if ( event.isError ) then
print( “Network error - download failed” )
elseif ( event.phase == “began” ) then
print( “Progress Phase: began” )
elseif ( event.phase == “ended” ) then
print( “Progress Phase: ready” )
startvideo()
end
end
local params = {}
params.progress = true
network.download(
“GET”,
networkListener,
params,
“Latin.mp4”,
system.TemporaryDirectory
)