Google Drive – Video Streaming

OK, I’ve just managed to get this working as follows –

In google drive I placed the video file in a publicly shared folder then rightclick the file and select share > share..

Google then gives me a link to share that looks like

https://docs.google.com/file/d/0B4BsAbG4atWHQzVfLUU3UnhhZTA/edit?usp=sharing

I’ve cut what I guessed to be the file ID from the URL –

0B4BsAbG4atWHQzVfLUU3UnhhZTA

And added it to metal7’s url to create a src attribute for a source tag

<source src="https://drive.google.com/uc?export=download&id=0B4BsAbG4atWHQzVfLUU3UnhhZTA" type="video/webm"/>

Now I’ve got a video working with the following html.

<html>
<head>
    <title>Video Test</title>
</head>
<body>
    <video controls="controls">
        <source src="https://drive.google.com/uc?export=download&id=0B4BsAbG4atWHQzVfLUU3UnhhZTA" type="video/webm"/>
    </video>
</body>
</html>

A lot of people seem to be suggesting creating an API app in order to get the file ID, but it looks like you can guess it pretty easy. That said, I’d be interested to see some proper documentation from google on it – I want to use this in production, but feel like I need to do more reading to be confident.

UPDATE

I’ve done a bit more reading and I’m afraid the video will only play on browsers that are logged into a google account. I spent a lot of time trying to get around this (inc building a google drive app with the api), I’m afraid it looks like there’s no way round it.

Don’t use google drive to serve up video in html unless you know all your users will be authenticated with google.

Leave a Comment