How to download a video file on android / gearvr

Is there a way to download a hosted video file onto my android device within a GearVR / GoogleVR app for playback later?

Reason: rather than packaging a large video file within the application it would be ideal to download the file once the app has started. Obviously it needs to go into a folder that the UE4 media player can use for playback.

If it’s not already possible with bluerprints (and it doesn’t appear to be as all I can find is “Download Image” and “Open URL” nodes which don’t do the job) - is there a plugin or source code I could compile that could add the functionality?

Many thanks in advance for any replies!

Take a look in Engine\Source\Runtime\UMG\Private\Blueprint\AsyncTaskDownloadImage.cpp. It uses HttpRequest to download the URL. You can copy the way this works. HandleImageRequest() gets the result and tries to treat the result as an image to place into a texture. Just take the HttpResponse->GetContent().GetData() and write it to a file.

Hey thanks Chris for the great starting point :slight_smile:

Once I figure out how to write it to a file how do I get the media player to play it? As per my current knowledge the android media player only plays from the content/movie folder in the packaged project. Is it possible to get it to play a file in a different location?

Use OpenUrl on the mediaplayer with “file://mypath/myfile.mp4”. If you didn’t download it to GExternalFilePath you will need to remove the checking in PathToAndroidPaths in AndroidFile.cpp for AllowLocal case.

hi. can this also be applicable to download a pak file

Hi, I’m interested in having multiple Texture files downloaded on runtime and then load them into a set of materials. Currently Oculus limits .apk file sizes to 500mb for the Gear VR which makes it impossible to load large projects.

How should I go about and handle this as the only way I see to load textures is by packaging them. Thanks

hey cgiteach:

To download an image for a material texture there is already a blueprint node for that. See Chris’s example here:

Anyone fancy sharing some code of how to do this ?

ie … load a MP4 file from the Web and save to Disk ?

muchley appreciated !!!

Dunk

Hey Aussieburger,

have you managed to read a media from android! Chris starting point is great but now for unexpierienced c++ user ;(

Any more hints,

Thanks

I have managed to do it wihout C++ and used a couple of plugins available in the Market Place…(very cheap)

LE http Request and LE File Manager

if you have a problem…the developer is very responsive…

I have managed to do it without C++ and used a couple of plugins available in the Market Place…(very cheap)

LE http Request and LE File Manager

if you have a problem…the developer is very responsive…