Google Drive video link does not embed video

Just encountered this on one of my sites. Confirmed the issue on try.discourse.org. When the following link is added to a post, instead of displaying a video player, it causes a file download!.
https://drive.google.com/file/d/0BwkewGYgOeyIVWhRY2pjTi1LQmM/view?usp=sharing

5 Likes

The opengraph tags for that link look like this:

<meta property="og:video" content="https://video.google.com/get_player?docid=0BwkewGYgOeyIVWhRY2pjTi1LQmM&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1">
<meta property="og:video:type" content="application/x-shockwave-flash">

So google is supplying an flash format video :rolling_eyes:

The current “generic onebox” behavior is to assume it’s an html embed, unless it’s an MP4 embed:

https://github.com/discourse/onebox/blob/master/lib/onebox/engine/whitelisted_generic_onebox.rb#L292

Personally I don’t think Onebox should add logic for flash embeds, they’re not gonna be around much longer anyway. Probably worth just adding a check for video:type=flash, and not oneboxing things that try to use flash.
If that’s the correct course of action I can make a PR?

Is this still an issue?

Just tested on try: https://try.discourse.org/t/testing-google-drive-video-links/876. It doesn’t appear to cause a download anymore, but the video player produced doesn’t work.

3 Likes

Any suggested fix for this issue?

Use something other than Google drive to host videos, since it isn’t designed as a video hosting service? Try that to start with.

3 Likes

Thanks, not a crisis. Just something a user posting ran into so was trying to figure it out and also report it here. Appreciate the response.

Regardless you should be able to link to the video and someone could click through to view it. That seems like a perfectly fine workaround.

I must have missed something. What workaround are you referring to? In the current state is a user posts a link with a video on google drive it show up like the screenshot above and one can’t click the play button.

Are you saying that’s a workaround to make it play and clickable?

To prevent oneboxing, simply type any character in front of, or after, the link. Then you have a plain link that can be clicked in the browser like any other link.

like so https://example.com

https://example.com like so

 https://example.com <-- spaces in front also work
2 Likes

One workaround is to whitelist https://drive.google.com/ on Discourse settings:

Then embed video player iframe:

Then just paste it inside the topic in a new paragraph:

Take a look at this video explanation:

<iframe src="https://drive.google.com/file/d/[hash]/preview" width="640" height="360" frameborder="0"></iframe>
4 Likes

Is this fixed?

2 Likes

Looks like
nope! Just ran into this same issue.

Per this post an embed does work if a) I whitelist the drive.google.com source domain AND b) I paste in the complete iframe HTML rather than the raw Google Drive URL.

However I think the main issue here is that as user wouldn’t necessarily think to grab the embed code rather than just copying and pasting the URL the same way you would a YouTube link.

(Yes I realize that Google Drive is a very different service than YouTube
but when you click play on a video in Google Drive, the video plays in what looks exactly like the YouTube player, so I think understandable that an average user might assume they’d work similarly!)

Also an issue that, as mentioned here, the video appears to display in the preview (actual thumbnail shows at least), but upon posting just shows the tiny blank non-functional preview. For example:

If it’s not possible to get these embeds to work (with onebox as opposed to iframe workaround), I’d suggest it might be worth adding an exception to just not onebox them at all.

Regardless of technical cause, this weird looks-like-an-embedded-player-but-actually-non-functional-little-box-that-isn’t-even-clickable I think is worse than just defaulting to a totally un-oneboxed link.

3 Likes

We should fix this @techAPJ – it does not need to be a video player just “not broken” :hammer_and_wrench:

4 Likes

I am working on a new onebox engine to onebox Google Drive files. Right now here is how we see Google Drive links in preview:

The video preview doesn’t work once the post is created and the pdf and zip files doesn’t get oneboxed at all.

Here is how it will look after having google drive onebox engine in action:

5 Likes

Okay, this is now done. Demos:

Video file:

Zip file:

Documents (text/pdf file):

.

6 Likes