playMaker

Author Topic: Android - Download file to a location[SOLVED]  (Read 2912 times)

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Android - Download file to a location[SOLVED]
« on: January 20, 2017, 04:46:04 AM »
Hello guys!

I have to ... download a mp4 file on Android. My guess is that... file has to be in a particular location, then after the file is downloaded I need to ... play that mp4 file and do some other stuff.

Is there a way to download the mp4 file using Playmaker then know when the file has finished downloading?

Thank you!
« Last Edit: March 16, 2017, 05:26:06 AM by jeanfabre »
Technical Game Designer
www.GamerPET.com

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #1 on: February 08, 2017, 05:37:40 AM »
anyone :(  :o
Technical Game Designer
www.GamerPET.com

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Android - Download file to a location
« Reply #2 on: February 08, 2017, 07:24:12 AM »
Get the WWWPOST mobile action from ecosystem if you don't have it. It gets data from a url and stores it in variables, although I'm not sure if it supports movie textures.


https://docs.unity3d.com/ScriptReference/WWW.html

This is how you would download a movie.
https://docs.unity3d.com/ScriptReference/WWW-movie.html
« Last Edit: February 08, 2017, 07:26:12 AM by elusiven »

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #3 on: February 09, 2017, 07:37:28 AM »
Thanks.

Normally I need something like ... "Having an URL with an mp4 file". I click a buton something something ... that movie starts to be downloaded to a particular PATH (not sure exactly how Android handles the paths).

When the movie finished downloading I go to another scene where I play that video in a 360 sphere (using another Unity plugin).

But thanks for the tips!
Technical Game Designer
www.GamerPET.com

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Android - Download file to a location
« Reply #4 on: February 09, 2017, 08:00:17 AM »
Hmm well you could save it to application's local data path with WWW.

https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html

And then on second scene you just load it from the same path with www again but then put it to a movie texture, and that the can be loaded into a renderer.

I don't think the current WWW action supports movie textures, I will have a look later, it should be relatively easy to write one up.

Also mp4 format isn't supported so it won't play. You need to convert it to .ovg   - Google it up, there should be converters online or something.
« Last Edit: February 09, 2017, 08:05:30 AM by elusiven »

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #5 on: February 14, 2017, 05:08:30 AM »
You sure mp4 isn't supported? I used mp4 before but as I said... I'm using AVPro Video (that 485 euro plugin).
Technical Game Designer
www.GamerPET.com

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #6 on: March 09, 2017, 11:05:10 AM »
So... with that WWW action from the EcoSystem... I can point to a file... I can download that file... then I can pass a viariable to something else?

Can I specify where to download the file?
Can I take the path where the file has been downloaded?

What's the difference betweetn WWW & WWWMobile from the EcoSystem?

Thanks <3
Technical Game Designer
www.GamerPET.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15082
  • Official Playmaker Support
    • View Profile
Re: Android - Download file to a location
« Reply #7 on: March 10, 2017, 02:57:43 AM »
Hi,

 the WWW action do not work on mobile platform, so you need to use the WWMobile version which will compile ok for these targets.

you'll have to check with Unity WWW api wether it's suitable for mobile hardware location, I think it does, but it's been a long time, so I am not sure.

 Bye,

 Jean

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #8 on: March 13, 2017, 06:08:34 AM »
Hello Jean!



Well those are the options for the action.

Is there any way to check the download location of the file? Basically what I'm trying to do is...

0.Check if the file has already been downloaded ... if NOT:
1.Download the file to a location
2.Get the full path location
3.Store that location in a variable so I can pass it later to another script.

Thanks bro! <3


EDIT:
Hmmm.... is it true that WWW downloads the file... but keeps it into memory??
I actually want to file just to be downloaded and stored on the HDD or SD (mobile) card. My file will be a pretty large mp4 and I don't want that loaded in memory.

EDIT2:
https://www.assetstore.unity3d.com/en/#!/content/78958

HMmmmmmmmmmmm........
« Last Edit: March 13, 2017, 07:48:25 AM by PET »
Technical Game Designer
www.GamerPET.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15082
  • Official Playmaker Support
    • View Profile
Re: Android - Download file to a location
« Reply #9 on: March 15, 2017, 10:54:27 PM »
Hi,

 yes, but with script you can download and store in the Application persistent storage folder, So this is likely what this asset does, I have done projects that downloads from the web and then keep, so I know this is possible, but indeed requires scripting.

 If you keep struggling with this let me know.

Bye,

 Jean

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Android - Download file to a location
« Reply #10 on: March 16, 2017, 02:11:07 AM »
I decided to use Easy Action 2 PlayMaker actions so I'm downloading the file with that asset :) Works kind of nice.
Technical Game Designer
www.GamerPET.com