Hello,
Having an issue here. I’m trying to download 5 images then load the download paths into a table and feed it into an image slider. I’ve managed to do this, however, on 3G, the amount of images is inconsistent. One load will be 2 images total, the next 5, the next 3, etc.
Below is new code I’m working on, I’m trying to set it up so that when one listener detects an image is downloaded(I presume with the ‘ended’ event phase), I begin downloading the next, as I read multiple concurrent downloads can have issues. However, my listener function never registers a phase of any kind, only return nil if I print out event.phase.
Am I missing something here? Progress is set to true in the params slot of network download, as mentioned in the api, so I should be getting phases, yes? I would appreciate any insight.
local fetch = function(name, path) local function networkListener( event ) if ( event.isError ) then print ( "Network error - download failed" ) elseif ( event.phase == "began" ) then print("Began") elseif (event.phase == "progress") then print("progressing...") elseif (event.phase=="ended") then print("ended") end print(event.response) end network.download( path, "GET", networkListener, {progress = true}, name, system.TemporaryDirectory ) end