4

I see that google drive use a flash player in order to stream uploaded video.

Do you know if google drive api provide an absolute url to the video in order to use an html5 player to stream the video?

George Stocker
  • 57,289
  • 29
  • 176
  • 237
Luca
  • 848
  • 1
  • 14
  • 33

1 Answers1

3

The answer will be very similar to this one for embedding images.

So basically to get the URL of the embeddable video you will have to:

  • In a Drive application you get the ID of the file through a URL parameter when the user clicks on a file and opens it with your app.
  • Query the file metadata using the Drive API and the ID of the file: the file metadata returned is a JSON object containing a bunch of info.
  • In the File metadata there is an attribute called "downloadURL" which gives a URL to the actual file.

Samples to get a file metadata are here.

The URL will be directly accessible if your file has been shared publicly. If the file is not public you will have to use OAuth 2.0 to authorize requests to that URL.

Problem: That URL only works momentarily. So it's not usable for every use-case.

Community
  • 1
  • 1
Nicolas Garnier
  • 12,134
  • 2
  • 42
  • 39
  • I Thank you for you quick answer, but I'm not sure this reply to my question. Let's say I have some code like this one: Simple Movie Player This doesn't works since the download url is not the movie url. Can I get the movie url through api? Thanks again! – Luca Apr 26 '12 at 12:40
  • It explains how to retrieve the URL of the file. To get it you have to query the metadata of the file and look at the *downloadUrl* attribute there are many samples that shows how to do that on the Drive documentation. Also the same argument about the short time to live of the URL is also valid. – Nicolas Garnier Apr 26 '12 at 12:46
  • Where did you get this Download URL? :) The one you get through the API is definitely not of that form ;) – Nicolas Garnier Apr 26 '12 at 12:48
  • I edited my response does it help you better? – Nicolas Garnier Apr 26 '12 at 13:04
  • great! Is get that url on the video page under File -> Download section. Thank you again for you support. – Luca Apr 26 '12 at 13:05