Users are discussing the inability to onebox Google Drive videos in Discourse. tobiaseigen reports that embedding Google Drive videos doesn’t work despite videos being public and embeddable via iframe. codinghorror questions whether Google Drive supports oEmbed or Open Graph, noting it’s a file-sharing service, not a video platform. cpradio suggests whitelisting Google Drive domains, but hits a browser security error: X-Frame-Options: SAMEORIGIN, preventing embedding. riking clarifies the issue lies with Google’s server headers, not Discourse. Later, tobiaseigen observes videos appear in preview but vanish after saving, and reports audio (.aac) files also fail. Mittineague explains previews use <img>, not <iframe>, while Mittineague confirms the SAMEORIGIN header blocks cross-origin framing. omarfilip provides a workaround: manually inserting an iframe with /preview URL instead of /view?usp=sharing, after whitelisting https://drive.google.com in allowed iframes. techAPJ links to a related discussion, and lisandro_iaffar thanks the community. The consensus is that native oneboxing won’t work due to Google’s security policies, but manual iframe embedding is viable with configuration.
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
If you whitelist 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)
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'.
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.
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.
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 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: