getting videos in google drive (and Microsoft onedrive) to show in a video tag? - google-drive-api

I have a website that has a web page with a html5 video-tag, and the user can supply a URL, and it will play in the video-tag.
The webpage uses JavaScript commands that control the video-tag - for instance, it can pause the video, move to a different point in the video, etc.
It works fine with the cloud. Videos stored on Microsoft Azure can be used, for instance (Azure gives you a way to get a URL to any video on your cloud storage, and streams it too).
However, I have users that store videos on Google-drive, and also on Microsoft One-Drive.
From what I can see, I can play these videos, but only in a page (probably with Google's own player in it) on their site.
It seems that there is no way to get a URL to these videos that I can put in a video tag.
Without the ability to do that, I can't use the javascript commands that work with the html5 video-tag.
Is there any workaround?
Or am I missing something?
Thanks.

For playing videos that are stored in google-drive using your app:
you need oauth2 credentials to access the user's drive, but assuming you have the oauth part covered :
you can create a drive application as a google appengine app and deploy it in a part of your website.
enable the drive-sdk and set the open-url to your website (that you have verified)
-> basically this tells drive to redirect towards your website whenever the user clicks on the video (from his drive)
when drive redirects to your website a json file will be sent, you'll have informations such as fileId from there i think you can execute the method files().get() to retrieve the necessary information for you to play the video
I advise you to take a look at this course in codeschool.

Related

Attach/reattach subtitles to video in Google Drive

I have a directory of video files in my Google Drive that I would like to attach subtitles to, and keep the subtitles updated regularly.
I am aware that this can be achieved through the in-browser Google Drive interface, by manually right-clicking on each video to "Manage caption tracks" and then locating the subtitles file (format: .vtt) in my Google Drive. However, I noticed that when I update the subtitles file later, the video does not "refresh" its access to it, but instead continues to display an older version of the subtitles .vtt file.
Is there a way to add and/or update the subtitles track using the Google Drive API? For background, I use PyDrive, and when I look at the GoogleDriveFile properties for one of my videos with subtitles, I don't see any parameters that look like the subtitles file or a link to the subtitles file, or any other parameters like the language code (en for English, etc.).
At the moment there are no API methods to do this. The Drive API documentation doesn't show any. Also, the metadata for Drive files does not include anything related to captions/subtitles. This means that adding these subtitles is probably done on a different "layer" unique to the Drive player that doesn't affect the files at all, and an API has not been considered for it.
There's also this issue tracker post requesting this feature, but it seems that it was shot down as they want Drive to focus more on file sharing. This may or may not change in the future.
As an alternative you could consider importing your videos from Drive to YouTube since the YouTube API does have methods to manage captions.
Google also has an API called Transcoder. I'm not familiar with it but after reviewing the documentation it seems that it allows you to transcode videos and add subtitles to them. This would be more complex and would probably require you to download, transcode, and reupload the videos which would end up with built-in subs, but it is something that you could potentially fully automate with APIs.

Link specific time of video hosted in Google Cloud

I have a video hosted on a Google Cloud bucket that can be publicly accessed. I've previously been able to host a video on Google Drive and create a link that would start playing the video from a specific timestamp (https://webapps.stackexchange.com/questions/99936/is-there-a-way-to-link-to-a-specific-position-inside-a-video-on-google-drive)
How can I do a similar thing with Google Cloud videos? Adding ?t=XXs to the end of the URL does not work.
Cloud Storage links aren't actually streaming video. They're just downloading the file, and the browser is playing it as the file content is downloaded. So you won't be able to seek to a specific time by simply specifying a time in the query string. If you want true video streaming with seeking and adaption to the speed of the connection, you should use a video streaming service.
Cloud Storage is where you have saved your video on the cloud. Depending on your app's programming language, there are tools available to you by google client library for that language where you can determine the starting point of video stream. For example, if you use Node.js the following code will start the video from a specific start to end point within video.
let f = fs.createReadStream("myVideo.mp4", {start, end});

How to access low definition videos of my own through Vimeo API?

I would like to access my own videos through Vimeo API and to download low and high definition versions that Vimeo encoded.
I have a Premium account on Vimeo.
I didn't find it in their doc :(
Is there a way? I would like to avoid encoding videos myself in different sizes...
Thanks!
First off, you'll need to be a Vimeo PRO member to get the direct video file URLs.
Using the latest API, do an authenticated GET https://api.vimeo.com/videos/[clip_id]. In the response you'll see an attribute named files that contain the HD, SD, and mobile transcodes that Vimeo generates. These URLs are meant for use with other video players (JWPlayer, or simply with the <video> tag, for example).
If you want to get the URLs to use for downloading (providing a download link on your site, for example) do the same authenticated GET https://api.vimeo.com/videos/[clip_id] to find the download attribute in the response. These URLs expire, and with them you'll see an expires attribute with the date and time.
Note that to get the download URLs, not only must you be authenticated as the clip owner, the API app itself must also be created by the clip owner.

Gdrive - Need mp3 direct permanent url to play it in wordpress site

I have large audio files to be played in my wordpress site. As my server being shared hosting, streaming has become much slow. I am thought of uploading the mp3 in gdrive and give the mp3 url in wordpress.
I have followed the below process-
1
clicked on download mp3 from gdrive, took the address, gave &type=.mp3 to the last. It worked for a day, but from next day onwards my audio doesn't play in my site. I am thinking that google is changing the url on daily basis dynamically.
2
thought of using the shared public link. But that takes me to google's download page. What all I need is a direct permanent link with mp3 extension for streaming purposes. This is not serving the purpose.
Any other approach in getting the permanent url with mp3 extension? Thanks.
Have you tried this URL ?
https://drive.google.com/uc?export=download&id=YOUR_FILE_ID
Check also this page for another way; but you must use the Drive API. The idea is to use the webViewLink url provided by the Drive API.

Which VIMEO API to use for our needs - web based help "tutorials"

We have a web based system that we are looking at replacing our existing "help system" from uploading flash videos directly to our website to instead "embedding" content we upload to our vimeo account. We have setup a vimeo pro account and these videos need to be "private" i.e. not accessible to the general public. Which API version should I use? And do you have any sample code in say PHP I could take a peek at with the functionality we are after
The Advanced and Simple API's will no longer receive new features, and soon you will not be able to create new apps for them.
Vimeo has moved towards a unified API, which you can read about at http://developer.vimeo.com/api. Make sure to use the api through api.vimeo.com, not vimeo.com/api/rest/v2.
Vimeo has an official PHP library, with some very basic examples that you can see at http://github.com/vimeo/vimeo.php