[Flutter]How to download video to app, and make it accessible only through the app (Similarly to Youtube/Netflix) - flutter

i'm fairly new to Flutter and is currently working on a course app that requires downloading the videos to the app.
The downloaded video will only be accessible through the app just like Youtube and Netflix, and will be hidden/encrypted from gallery. Would greatly appreciate if someone if someone could point me in the right direction in building this feature.

On iOS and Android your app has it's own isolated folder for storing documents. Items stored there are not intended to be accessible to the user outside of your app. This folder isn't scanned by the Gallery or accessible to other apps on the device. (However, with a little effort a user can access the files so this is not a complete solution where security is an concern. You would need to add encryption if you didn't, say, want a motivated user to copy the video file to a PC and be able to play it.)
the path_provider plugin gives your Flutter app common file locations on a device. The private app folder location is retrieved with getApplicationDocumentsDirectory()
"Download video" is a vague requirement. Most video on the internet (Netflix, Youtube) is provided via HLS or DASH for streaming, which you do download but the video is split up into many files- sometimes thousands of files for a single video. The dart:http package is likely what you're going to want to use to get/download the files (unless the video files aren't available via HTTP/HTTPS, then you'll need a different transport-specific library, like FTP, RTSP, etc.)

Related

How to implement a media server for local music files on the phone in flutter that can be used by DLNA

I am working on a flutter app (for iOS and Android). One of the function of the app is to find DLNA renderes in the local network and allow user to play the local music files on his phone on these DLNA renderes. I have incorperated the DART-DLNA packagein my app and am Able to list all DLNA-UPNP devices and I can send a url of a media to the selected DLAN renderer and it starts playing. I can also control the play/pause and stop functions. So far so good
Now I want to be able to play the music files that are on the device from this app. When working on ANdrodi native earlier I used DroidUpnp which mainly uses cling and nanoHttpd libraries. Cling provides upnp stack and nanoHttpd is used for creating a webserver to server the media files. The DroidUpnp app lists the music content like this
On going depper when reached to the actual music file the app will send that file via upnp/dlna.
On Flutter I am not sure how to go for it? How to List those files and then get the files urls like http://192.168.1.190:8192/a-24684.mp3 and send it to the render.

Mp4 video not working on iPad *in Offline Mode*

I'm getting a weird problem when embedding an mp4 onto a webpage in iOS Safari. I am embedding it with a video tag:
<video src='gizmo.mp4' width=560 height=320></video>
However, on the page, I'm getting the 'video not available' placeholder graphic (play button with a slash through it)
However, when I go to the direct video on my server (http://www.example.com/gizmo.mp4), the video works perfectly.
I am using the video from here to test this out, I don't have the final video files yet. I have also replaced the gizmo.mp4 file with a gizmo.m4v file that Quicktime generated when I hit "Export for Web." I get the same result.
I am only interested in targeting iOS, so specific solutions for iPhone/iPad are welcome (even if they wouldn't work in the web at large)
Thanks in advance!
-Esa
EDIT: Did a bit more testing. Since this is an offline app that I am working on, I was completely offline for this, relying on the manifest. However, the videos worked once I took the manifest out and was working completely online again. So it looks like something up with iOS not caching video resources? The video in question is 748kB, so it's not a cache size issue (though, when I tries with a 13MB movie online, Safari automatically asked to cache the content)
Videos are regarded by the browser as a streaming resource and are not cached - even when referenced directly in the .appcache manifest file. I think the only way you could get this to work is to package the HTML 5 application up as a native app, using one of the many available tools for this (https://trigger.io, Accelerator etc).

Sencha Touch and Saving Local Media

Does anyone know if it is possible to save media from the internet on the local device using Sencha Touch? From what I've seen so far, I understand it's definitely possible to save XML or JSON data locally on the device, but I have had no luck finding ways to store media locally.
To be more specific, I am looking to program an app that provides the user with a series of audio seminars - like podcasts, really. The user would be able to stream those audio files directly from the internet, but I also need to provide the user with the ability to save an episode/seminar for later. This will be important for when a user is traveling and does not have a reliable internet connection or data plan.
The primary delivery device would be on iOS (iPhone, iPad, iPod Touch) and I would hope to be able to use the same technology on Android devices - but that would be a secondary phase.
If this is possible, how would I go about saving material? And what, if any, would be the limitations on doing so? Any thoughts on this would be greatly appreciated.
I have done something similar using Sencha Touch 1 and PhoneGap to produce a hybrid app.
Basically, I use Sencha Touch to download the JSON, etc and LocalStorage to hold the data. Downloading media/files/etc to the actual device is not supported in Sencha Touch as the framework doesn't have access to a file system.
I then use PhoneGap's API's to tap into the device's native file system and download files to the app's Documents directory and pass the file names/paths to Sencha Touch for use in the app.
I'm assuming you are looking to create a hybrid app based on your question but if this is strictly a web app then there isn't much you can do.
TO add to the above point, you possibly could base64 encode the file and store it within LocalStorage but this isn't a sustainable model as LocalStorage only gives you 5mb of space. If you go over 5mb, the user is prompted (yes, no) to allow LocalStorage to use more space (in 5mb increments). Since the files your reference have the potential to be 5mb each, you can see how this could quickly become unmanageable for both you and the user.
EDIT:
See http://phonegap.com/ for the native wrapper
http://blog.clearlyinnovative.com/post/2056122828/phonegap-plugin-for-downloading-url-all-the-code for the phonegap download plugin
and https://github.com/aaronksaunders/FileDownLoadApp for the code
Check this website out. Scroll down to storing data offline. They discuss Sencha Touch provides a set of data store and proxy classes that make it very easy to work with data from (and going to) a variety of sources - both server- and client-side... hope this helped, cheers.

Importing photos saved in ios device's Documents folder to desktop

I'm creating a catalog/collection ios4 application. One element of the app lets the user take a picture which they use for a new item entry. The image they choose is then saved to their app's local Document folder.
I was wondering if it's possible to give the user the ability to import the photos to their desktop when they plug in their ios device. Like how iPhoto lets you import photos from your camera roll when you plug in your device
I've looked around, and all i can seem to find are posts on saving to the documents folder, and then retrieving the data within the app.
Any help would be great.
Thanks Ian
You could use an intermediate web service to transfer the files. Upload them to your service from the device, download them to the desktop.
Apple locks this stuff down pretty tight, so that might be your best bet.

placing video files on http from my local computer

I am making one application in which I need to play some videos on my webpage or application.
And my videos are placed on my computer locally. Now what kind of URL i need to provide, or what type of streaming do I need to make it playable on other computers, from the webpage only.
Is there any controls, which plays videos locally on my computer and show it to the client side.??
Thanks in advance.
First of all is your web site hosted on your computer or are using a Hosting service?
Either way
You can use either flash Plug in or Windows Media Player Plugin
(silver light is also an option, the risk is the users may not have installed it since it is fairly new)
you must configure them with the URL of the videos, so that they will be served for viewing
Eg:
while doing that place your videos in a seperate folder in the site's root folders
like /videos/video1.mpg