Announcement

Collapse
No announcement yet.

Download, save and usage of media files during runtime

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Download, save and usage of media files during runtime

    Hello there,

    I have two related topics concerning downloading and playing of videos and images on Android during runtime. I need to save the files in order to access them when I am offline.

    Topic 1: I want to download video (mp4) and image (png) files from the internet and save them somewhere on my Android device (internal storage/ sd card) so I can access them later. Is there any way to do this in Unreal?
    (Note: In Unity there is the WWW class and the Application.dataPath stuff so you are able to download and save whatever you want to your phone)

    Topic 2: Afterwards I want to access the downloaded files and use them as textures (Tx2D, movie texture) to display them on 3D objects. Any idea how to load images/movie from storage/sd card as texture? For videos: How to also play the sound?
    I already figured out that there is a BP node (DownloadImage) where you can pass an URL and get a texture but I also want to save it so I am able to access it when I am offline. The same applies to the video topic as well where I found a way to stream a video (set URL) but nothing to save and load from storage/sd.

    Note: I have no issue dealing with C++ code.

    Thanks
    Aesir Interactive

    #2
    Hi imbakeks,

    You can get the path to write to the application sandbox on Android from GExternalPath (defined in AndroidFile.cpp). Just add an extern FString GExternalPath; and access it protected with #if PLATFORM_ANDROID.

    DownloadImage is implemented in AsyncTaskDownloadImage.cpp. Look in HandleImageRequest() to see how ImageWrapper is used to load the data into a texture. Just feed in the data you read from the file.

    Comment


      #3
      Hi Chris,

      thanks for the fast reply! That pointed me into the right direction where to search inside the engine code. I'll post an update (and maybe some code snippets) as soon as I got it all working.
      Aesir Interactive

      Comment


        #4
        Any chance of a share of code for this...
        I am too trying to download mp4 to disk...
        I'm a bit sketchy on C++ so not been able to get the code to work !

        Comment


          #5
          Hey DrunkenKBliths, I'm sorry but I didn't implement a lot. As far as I can remember I started working on the image download but it didn't work before the project was canceled.
          Aesir Interactive

          Comment


            #6
            Hey, is any idea to save the download Image to local disk at runtime? I can download and save some texture already in the project folder, however, i can't save the download image to local disk.
            If anyone knows, please let me know this, i doing this for whole day.
            Thanks advance!

            Comment

            Working...
            X