Instantiate video file for YouTube API video upload - file-upload

Is there a way to instantiate a JavaScript video file for upload as if it were a file input?
I need to upload a local server file through the YouTube Upload API using the file's URL (essentially trying to automatically upload files from our server to YouTube on behalf of our clients).
I've attempted to upload the following:
FileToUpload = new File([text], "Trial.mp4", {type: "video/*"});
where text is a array buffer from an xttp request.
However, process always results in "Upload failed: cannot process file".
YouTube API seems to work only with <input type=file/> selector.
Essentially, the following is not possible:
document.getElmentById("myfile").files[0] = FileToUpload;
But YouTube Upload API seemingly will not taking any other form with JavaScript.
I've been searching for over a month now and been unsuccessful. Any help would be greatly appreciated.

Related

Downloading private videos inapp react native

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.

Migrate videos from Vimeo to S3

I have a large quantity of videos on my Vimeo account that I would like to migrate to my AWS S3 account.
Rather than go through the time consuming process of downloading from Vimeo to my local machine then uploading from my local machine to S3, is there a way where I can do a direct transfer from Vimeo to S3?
If possible, I would want to create a script to iterate through each video via Vimeo API and set up the path to where it would go into S3 then initiate a direct transfer. Any ideas or suggestions would be much appreciated!
If you have a PRO account or higher, you can use the API to get download links for videos on your account, including download links for the original source file. Those download file links should be able to be used for importing into S3. Note that the links provided via the Vimeo API are expiring HTTP 302 redirects to the video file resource, so make sure you take note of the expiration time also provided in the response.
Download links are returned with the rest of a video's metadata, so I suggest using the fields parameter to only return the metadata needed.
http://developer.vimeo.com/api/common-formats#json-filter
https://developer.vimeo.com/api/reference/videos#GET/users/{user_id}/videos

how to download video from cloudinary using nodejs?

I have uploaded a mp4 file using node.js on my cloudinary account. I have saved public id of video. Is there any api to download the uploaded video?
Use the attachment flag (fl_attachment in URLs) to tell the browser to download the video instead of displaying it.
For example,
http://res.cloudinary.com/<cloud_name>/video/upload/fl_attachment/<public_id>.mp4
For more information on delivery flags,
http://cloudinary.com/documentation/image_transformations#delivery_and_image_format_flags

How to upload file from my iphone application to user own dropbox?

I had created an iphone application witch can generate a pdf file when the user use the application.
how can the user have the option to sent the pdf file to his own dropbox?
I had tryed with dropbox examples: where i can make an api and upload to my own dropbox.
But it's not what i want.
I want my application to do so: when the user generates a pdf file, so the login box of dropbox apear so he can log in and upload the file automaticaly to his own dropbox.
I have google it, but i did't get any examples including this solution.
Please help me if you can.
Have you looked at this blog post that i think describes what you are looking for.
http://www.drdobbs.com/tools/working-with-dropbox/232600482?pgno=1

Get download URL from UIWebView for a media file

I'm building an app that comunicate with a Web Service and I'm trying to download files from it.
I found that, after sending an appropriate request to the server, if the link of the UIWebView contains "DownloadFolder", that's the correct download link; sending an async request with that url the download works well for files like .pdf .doc .xls and so on..
The problems came when i send a request for a media file like mp3 mov and so. The webview work well and display the player, but I can't get the url from the webview.
I also noticed that in the consolle is displayed a line like this:
setting movie path: http://xxx.xxx.xxx.xxx/WEBSERVER/DownloadFolder/NAMEOFWEBSERVER/ADMIN/FA29-12-2011-12-57-04-163pitorb45sluo0g455wwc3u55.mp3
That's the URL I want to use for the download. How can i get it from code?
Thanks in advance.