native.newVideo() causes App crash , when playing a downloaded video from DocumentsDirectory

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 )

Hi @emails2assif,

Can you play the exact same video using “native.newVideo()” if you simply place it in the app’s resources directory (your project folder)? In other words, does the app still crash if you skip the network download and simply play the video like it’s a file local to the app? I’d like to confirm that the file isn’t being corrupted or similar when it downloads.

By the way, what device(s) are crashing? What versions of the OS on those devices?

Brent

Brent, I was troubleshooting this issue with this user, and came to the same conclusion: there appears to be an issue with how the newVideo API handles files in the nonroot directory.

Check out the below thread that had a bit more of what I was seeing (sorry, I’m mobile so its tough to type).

https://forums.coronalabs.com/topic/61203-video-is-not-getting-played-from-document-directory/

Hi everyone,

This issue has been fixed and is available in daily builds 2016.2860 and later.

Hi @emails2assif,

Can you play the exact same video using “native.newVideo()” if you simply place it in the app’s resources directory (your project folder)? In other words, does the app still crash if you skip the network download and simply play the video like it’s a file local to the app? I’d like to confirm that the file isn’t being corrupted or similar when it downloads.

By the way, what device(s) are crashing? What versions of the OS on those devices?

Brent

Brent, I was troubleshooting this issue with this user, and came to the same conclusion: there appears to be an issue with how the newVideo API handles files in the nonroot directory.

Check out the below thread that had a bit more of what I was seeing (sorry, I’m mobile so its tough to type).

https://forums.coronalabs.com/topic/61203-video-is-not-getting-played-from-document-directory/

Hi everyone,

This issue has been fixed and is available in daily builds 2016.2860 and later.