I am downloading a Video from Server in Document Directory of APP & this Video , i need to play using native.newVideo() .
But the Problem is after downloading successfully the Video … The App get’s Crash when i start to play the Video using native.newVideo()
Error : Unfortunately the App has Stopped
-i have ensured that the Video is properly downloaded by playing same downloaded Video from Document Directory using media.play() (& it’s played Successfully …)
-i have also try to change Directory for Video
:The video fails & same problem occurred when i use temporary Directory.
: But it Went playing successfully , when i add the same video in Resource Directory & Play it using native.newVideo() .
-I need the Video to be Download from server & for that i have use network.download , then save it in Document Directory & then Play it using native.newVideo() Only …
-The following is the Code i have used :
local function playVideo()
local video = native.newVideo( display.contentCenterX, display.contentCenterY,320,480 )
video:load( “Latin.mp4”,system.DocumentsDirectory )
video:play()
end
local function networkListener( event )
if ( event.isError ) then
print( “Network error - download failed” )
elseif ( event.phase == “ended” ) then
print( “Progress Phase: ready” )
playVideo()
end
end
local params = {}
params.progress = true
network.download(“http://sirma.no/Latin.mp4”, “GET”, networkListener, params, “Latin.mp4”, system.DocumentsDirectory )