# Oneboxing google drive videos does not work

**URL:** https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896
**Category:** Feature
**Created:** [December 18, 2015, 1:49pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896 "2015-12-18T13:49:16Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [December 18, 2015, 1:49pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/1 "2015-12-18T13:49:16Z")

</div>

We make active use of google drive in my organization, and would like to encourage sharing of screencasts and webinar recordings using google drive via discourse. I just attempted this and it does not onebox properly.

Am I doing this wrong, or can oneboxing of google drive videos be considered as a new feature? It seems to me that this should be possible via these steps:

- upload video to drive, wait for it to process
- share video with public (“anyone on the internet can find and view”)
- get embed code
- paste URL from embed code on its own line in discourse post

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 18, 2015, 9:48pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/2 "2015-12-18T21:48:05Z")

</div>

Does Google Drive support oEmbed or Open Graph summaries of its content?

This is a bit like dumping a video in Dropbox and expecting it to be YouTube? It’s a file sharing service, not a video site..

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [December 18, 2015, 9:55pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/3 "2015-12-18T21:55:59Z")

</div>

I don’t know about oEmbed or Open Graph summaries, but drive supports embedding videos and provides embed code to copy and paste into web pages.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 18, 2015, 10:01pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/4 "2015-12-18T22:01:51Z")

</div>

Are these public URLs? Remember that onebox is an anonymous user, so it won’t work with anything that requires auth, and that’s by design.

(Most YouTube videos are viewable to anyone, for example.. because it’s a video sharing service, not file storage.)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [December 18, 2015, 10:09pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/5 "2015-12-18T22:09:28Z")

</div>

yeah they are public

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 18, 2015, 10:11pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/6 "2015-12-18T22:11:23Z")

</div>

Well, a raw video file works:

`https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4`

[https://sample-videos.com/video123/mp4/720/big\_buck\_bunny\_720p\_1mb.mp4](https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4)

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [December 18, 2015, 10:22pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/7 "2015-12-18T22:22:33Z")

</div>

Can you copy/paste the embed code into a code block here? Chances are you will have to have a plugin that whitelists the tags they use.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [December 18, 2015, 11:00pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/8 "2015-12-18T23:00:24Z")

</div>

```
<iframe src="https://drive.google.com/file/d/0B6YHEHRKfGNLZnBqcTUzREc2OFk/preview" width="640" height="480"></iframe>

```

that’ll do it.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [December 18, 2015, 11:25pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/9 "2015-12-18T23:25:17Z")

</div>

More info:

If you whitelist [drive.google.com](http://drive.google.com) for onebox, it does attempt to load it, but for me it is throwing a error regarding SAMEORIGIN (then use the src attribute URL in your post)

```plaintext
Refused to display 'https://video.google.com/get_player?docid=0B6YHEHRKfGNLZnBqcTUzREc2OFk&ps=docs&partnerid=30&cc_load_policy=1' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

```

I’m unsure how to get past that.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [December 18, 2015, 11:44pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/10 "2015-12-18T23:44:16Z")

</div>

I just tried the information at  
[https://meta.discourse.org/t/x-frame-options-sameorigin-header-prevents-embedding/14928/2?u=cpradio](https://meta.discourse.org/t/x-frame-options-sameorigin-header-prevents-embedding/14928/2)

And the onebox shows the oembed data, but posting it still results in a blank post with the above error in the dev console. I feel like I’m closer, but it still isn’t quite right.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [December 22, 2015, 7:13pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/11 "2015-12-22T19:13:21Z")

</div>

It’s because [video.google.com](http://video.google.com) needs to unset that header, not your site.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [December 22, 2015, 7:14pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/12 "2015-12-22T19:14:27Z")

</div>

Ah. Okay, so that is why it is getting tricky. I figured it must be somewhere else, but I lost time to dig into it. Thanks for taking a quick look.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [January 31, 2017, 2:46pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/14 "2017-01-31T14:46:39Z")

</div>

Looks like embedding videos hosted on google drive is working now, including the example I gave above. Taking the UrL on its own will create a onebox. But I just came across a problem with embedding .aac audio hosted on google drive - it will not onebox correctly. Anyone have any ideas what’s going on and can it be fixed?

_update: ah, well.. the video appears to display in the preview but not in the final post after saving._

aac file url: `https://drive.google.com/file/d/0B288V3vGChdtLWItTFhFU2lzS0U/preview`

[https://drive.google.com/file/d/0B288V3vGChdtLWItTFhFU2lzS0U/preview](https://drive.google.com/file/d/0B288V3vGChdtLWItTFhFU2lzS0U/preview)

image url: `https://drive.google.com/file/d/0B6YHEHRKfGNLZnBqcTUzREc2OFk/preview`

[https://drive.google.com/file/d/0B6YHEHRKfGNLZnBqcTUzREc2OFk/preview](https://drive.google.com/file/d/0B6YHEHRKfGNLZnBqcTUzREc2OFk/preview)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [January 31, 2017, 7:07pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/15 "2017-01-31T19:07:24Z")

</div>

> [@tobiaseigen](#):
>
> update: ah, well.. the video appears to display in the preview but not in the final post after saving.

```plaintext
Refused to display 
'https://video.google.com/get_player
?docid=0B6YHEHRKfGNLZnBqcTUzREc2OFk
&ps=docs&partnerid=30&cc_load_policy=1'
in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

```

The Preview is an `<img>` not an `<iframe>`

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [January 31, 2017, 7:36pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/16 "2017-01-31T19:36:51Z")

</div>

let me try a different URL - this is the link I get directly from google drive. Also appears not to work as onebox. I’m just not an expert at this. 😕

[https://drive.google.com/file/d/0B288V3vGChdtLWItTFhFU2lzS0U/view?usp=sharing](https://drive.google.com/file/d/0B288V3vGChdtLWItTFhFU2lzS0U/view?usp=sharing)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [January 31, 2017, 7:49pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/17 "2017-01-31T19:49:15Z")

</div>

It’s a security thing

That returns a Response Header

```plaintext
alt-svc:quic=":443"; ma=2592000; v="35,34"
cache-control:no-cache, no-store, max-age=0, must-revalidate
content-encoding:gzip
content-type:text/html; charset=utf-8
date:Tue, 31 Jan 2017 19:45:19 GMT
expires:Mon, 01 Jan 1990 00:00:00 GMT
pragma:no-cache
server:GSE
status:200
x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
x-robots-tag:noindex, nofollow, nosnippet
x-xss-protection:1; mode=block

```

The SAMEORIGIN bit

> **[X-Frame-Options header - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options)**
>
> The HTTP X-Frame-Options response header can be used to indicate whether a browser should be allowed to render the document in a ,

> SAMEORIGIN  
> The page can only be displayed in a frame on the same origin as the page itself.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [March 20, 2018, 11:51pm UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/18 "2018-03-20T23:51:11Z")

</div>

I just ran into this limitation myself, but it’s possible. You’ll have to whitelist the iframe source domain `https://drive.google.com` in `allowed iframes`.

Then grab the _Embed item_ HTML which will look like this:

`<iframe src="https://drive.google.com/file/d/1UQyQdaQyuDxbUm5krcB7vckNwwhPHCJi/preview" width="640" height="480"></iframe>`

If working with a _Share with others_ link, it will look like this:

`https://drive.google.com/file/d/1UQyQdaQyuDxbUm5krcB7vckNwwhPHCJi/view?usp=sharing`

so you’ll have to replace `/view?usp=sharing` with `/preview` for the iframe to work.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [April 10, 2019, 8:57am UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/19 "2019-04-10T08:57:20Z")

</div>

> [@Google Drive video link does not embed video](https://meta.discourse.org/t/google-drive-video-link-does-not-embed-video/59719/20):
>
> Okay, this is now [done](https://github.com/discourse/onebox/commit/79033b8520ad06606f87f69b3579cae0e6761fff). Demos: Video file: [https://drive.google.com/file/d/0BwkewGYgOeyIVWhRY2pjTi1LQmM/view?1](https://drive.google.com/file/d/0BwkewGYgOeyIVWhRY2pjTi1LQmM/view?1) Zip file: Documents (text/pdf file): .

---

<div class="post-metadata">

### Author: ![lisandro\_iaffar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lisandro_iaffar/32/315816_2.png) [@lisandro\_iaffar](https://meta.discourse.org/u/lisandro_iaffar)
#### Post date: [December 17, 2022, 4:20am UTC](https://meta.discourse.org/t/oneboxing-google-drive-videos-does-not-work/36896/20 "2022-12-17T04:20:44Z")

</div>

Awesome!! Thank you!! 🙂
