I am trying to download remotely a video file and then play it locally. The code I am using is the following. The file is downloaded but it does not load the video (without showing any error messages however). I tried it on the device, not only the simulator.
Following is the code I am using:
local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local function networkListener( event )
if ( event.isError ) then
print ( “Network error - download failed” )
else
local path = system.pathForFile( “video.mov”, system.ResourceDirectory )
local t1 = display.newText( “downloaded”, 0, 250, nil, 8);
media.playVideo( path )
end
local t1 = display.newText( "RESPONSE: " … event.response, 0, 20, nil, 8);
end
network.download( “http://lamp.t-c.gr/puma/video.mov”, “GET”, networkListener, “video.mov”, system.ResourceDirectory ) [import]uid: 4416 topic_id: 6668 reply_id: 306668[/import]