Embedding Google Drive videos

Google drive is a handy place to store videos. I find myself having more and more videos saved there since Google added call recording to Google Meet, as the resulting recording gets saved to the organiser's drive. Often those videos need to be shared and embedded elsewhere (internal presentations, etc), but finding the embed code for these videos isn't nearly as simple as with Youtube or Vimeo!

Load the video

Open the video in Google drive, then when it has loaded, click the 3 dots in the top right of the screen. On the panel which appears, click "Open in new window".


Embed item

In the new window which has opened, again click the three dots in the top right, and select "Embed item..."


Get the code

A modal pops up, which contains the embed code for this video. This code can be pasted wherever the embed needs to be shared.

Embed code

All done?

Not quite! Notice in the previous screenshot the yellow box with Only the owner and explicitly shared collaborators have access. By default, if anyone trying to view the embed doesn't already have access to the underlying video file, the embed won't work.

Google 403 error

This may be desired behaviour in some cases (an internal training video limited to users on the same email domain, for example), but what if we want our video to behave a bit more like Youtube, and be visible by anyone?

If we click the three dots at the top right once more, and select "Share", we have the option to make the file globally-visible.

Share settings

Selecting Anyone with the link then clicking Done means that our embed code should now work for anyone who tries to view it!

Well, almost anyone...

These video embeds are not nearly as reliable as YouTube or Vimeo. If you embed a video, with "anyone with the link"-level access, at the time of writing (Jan 23) it will still only work for some of your users. If your user is logged into a gmail account of any type (gmail.com or Google Apps), it'll work fine. If they're not logged into a gmail account, the video won't play, despite the permission settings appearing to be open to all. This can be quite a pain, as there isn't a good error message shown to users to let them know why this has failed.

Hopefully this is something Google will resolve at some point. Until then, YouTube and Vimeo are still the best bet for videos requiring wide distribution. But if you're looking to embed a Drive-based video for a known audience (or one which you know will all be logged into a gmail account of some description..) then the above guide should do the trick!

Share This Article

Related Articles

Lazy loading background images to improve load time performance

Lazy loading of images helps to radically speed up initial page load. Rich site designs often call for background images, which can't be lazily loaded in the same way. How can we keep our designs, while optimising for a fast initial load?

Idempotency - what is it, and how can it help our Laravel APIs?

Idempotency is a critical concept to be aware of when building robust APIs, and is baked into the SDKs of companies like Stripe, Paypal, Shopify, and Amazon. But what exactly is idempotency? And how can we easily add support for it to our Laravel APIs?

Calculating rolling averages with Laravel Collections

Rolling averages are perfect for smoothing out time-series data, helping you to gain insight from noisy graphs and tables. This new package adds first-class support to Laravel Collections for rolling average calculation.