A couple of months back, I came across a client requirement who wanted to build a feature to download and restrict video files in Android App, just like YouTube, Netflix, Amazon Prime does with us.
The steps need to be implemented is as follows :
Download the video from the URL
Encrypt the video file
Decrypt the video file at the time of playing
I use RNFetchBlob for download the video from the urls and RNFS is used for file access.
Requirement :
I need to encrypt the video file and decrypt the video file from the App.
If anyone knows the solution please help me......
I need to encrypt the video file and decrypt the video file from the App.
I am trying to implement something in react native:
I have a url of video which i'm showing in react native video component, how can i give a button to download that same video in mobile but it should not appear in gallery.
Also if the video is private where the headers can be passed and how?
How to download any file ?
Well for downloading any file like video,img you first need permission to read and write into internal/external storage of phone and after that you need a native module that can download files from server to the local folders of phone.
there are two best known libraries for downloading files
https://www.npmjs.com/package/react-native-fs
https://www.npmjs.com/package/react-native-fetch-blob
Now you can follow their documentation to download files like Videos,images or whatever you want to your user's phone.
Now Lets come to the part that you dont want it to be available to user via gallery.
For this i suggest using react-native-fetchblob as it has builtin intent actions and views.
You can download a video file with any random name like 1234CACHE any random name without any extension to it, specially dont give it extension like video.mp4 because gallery detects .mp4 files so dont give it any extension and the file won't be available in any gallery.
Now how to hide the file?
react-native-fetch-blob allow us to save files into directories that are not publicly available i mean user cannot reach those directory and these directories are used only for saving App's data so you can save your video file in one of these directories.
Now after completing your download, You can open your file with the Intent.
For Example:-
const VIDEO_PATH = res.path() //the path where your downloaded video is saved, you will actually receive this in the response of download function.
const MIME_TYPE = "video/mp4"
//Now finally call the intent with video mime so the video will be opened in user's media player, or if you want your own media player you can use any library for that.
android.actionViewIntent(VIDEO_PATH , MIME_TYPE)
Note: You can only download a video if you have a path URL to the video file, You must not mix web URL with Video File URL, Video file url has file name and video extension at the end of the url. such as https://someURL.com/video.mp4 this is video file url, but if you have something like https://SomeURL.com/video it is not a video file instead it is a webpage displaying that video file so you cant really download that specific video from a webpage!.
There can be multiple approaches to this.
I hope you have an idea about your video player, download option depends on your server and site.
You can change the file extension of downloaded video, like my_video.notMP4. So the video will not show in the Gallery as it not detected as a video file now.
Hide the folder where the video file is downloaded, adding a dot(.) before the folder name can hide the folder in Android/Unix and video will be hidden from Gallery. Example .my_Video_folder
For more safety, you can encrypt the video and make them in custom chunk which only your player can play. But you may need to make or find such a video player.
I could not understand the headers part, please explain.
So I am designing an reactnative app where I need to embed vimeo video player.
Can I give my users an option to download the video for offline mode ?
How can I restrict the downloaded file in app itself like netflix does?
Is that possible? PLease guide.
I was looking for a plugin that could play both audio and video files and was happy to come across mediaelement.js. I host all of my audio and video from Dropbox. The audio is playing fine but the video does not, just hangs on the loading screen.
I saw another thread posted here with no response. Below is the shortcode I'm using:
[video src="https://www.dropbox.com/s/udprb5o5p3n6uu8/WCN.mp4" width="242" height="136" poster="http://wellsmartsolutions.com/video/video.png"]
Not other plugins are active that would be causing any conflict. What am I doing wrong?
Try this URL instead: https://dl.dropboxusercontent.com/s/udprb5o5p3n6uu8/WCN.mp4. I've changed the domain to dl.dropboxusercontent.com per https://www.dropbox.com/help/201. This links directly to the video rather than a web page that previews the video.
I have recently created an iPhone app where i recorded voice in .ima4 format. This application uploads these recordings to my web server, where user can play these recorded files.
But i don't know how to decode or play .ima4 files in a website.
Its better to use html5 for audio playing
Consider this link for workAround for ima4 format
Refer soundmanager link for playing audio in html