Playing Media

Hi guys I am experiencing a little problem, I ignore how to resolve it.
can you help me please ?

local function play()

-----if file exist then
media.playVideo( “folder/file.mp4”, media.RemoteSource, true )

-------if file does’nt exist then

media.playVideo( “http://www. mysite/the/file.mp4”, media.RemoteSource, true ) download and save it to the folder

------elseif download incomplete then resume it
end

local Bl = display.newImageRect( sceneGroup, “image.png” , 240, 75 )
Bl.x = 140
Bl.y = 270
Bl:addEventListener( “tap”, play)

If you are on Windows, then that’d be the cause. This API is not (yet) supported on Windows.

thanks for your reply
I test the code on device it works.
Now I want to save the downloaded video for offline playing.
I don’t know how to do it !!!

I don’t know whether the player controls provide that option, but you can download files using this:

it’s not interesting to put a video file in the APK . video file must be located in a website and player can download

FYI, you may have to set permissions to access a streaming access, depending upon where it is hosted

thank you for your reply !
Player is already granted access the streaming media.

my big problem is to know how to keep video file in local drive to play later when it’s finished downloaded. I don’t need to download the same video each time I need it. I want to download it once !
but next time I start play button it will not show me download progress