What I want

I would like to use a Raspberry Pi 3 attached to my home router to make available a hard drive with a bunch of media files (pictures and videos) to all my devices. (kind of a homemade Dropbox)

Considerations:

Everywhere : it should work whether I'm in my home network or not.

: it should work whether I'm in my home network or not. Phone client: I would prefer to have a client that can download the content so I can after play it rather than directly stream it.

Research I have done

I've been doing some research for the last few days but I didn't come across a satisfactory way of doing it. The two options I found are:

Plex: it will stream the files and I'm concern about the performance. I probably wouldn't see a HD video without problems.

NAS: only available in the home network.

What is the best way to achieve this? If there is one..

Update:

I found ownCloud and nextCloud and look really close to what I want.