如何将视频从 Google 驱动器嵌入到网页?

我正在尝试在网页上加载视频,并且它适用于 YouTube 嵌入代码.但是,当我将代码中的 src 替换为视频的 Google Drive 链接(打开共享)时,什么也没有出现.我的意思是,没有错误,但它是空白的.为什么这里什么都没有出现?我怎样才能让这个谷歌驱动器视频也加载到我的网页上?我不想在 chrome 中手动粘贴 url.

I'm trying to load a video on a web page and for YouTube embed code it works. However, when I replace the src in the code with a Google Drive Link of a video (with sharing turned on), nothing comes up. I mean, there is no error but its blank. Why does nothing come up here? How can I get this Google drive video to also to load on my webpage? I dont want to have to paste the url manually in chrome.

这没有任何作用:

<html>
<head>
</head>
<body>
<iframe width="100%" height="100%" src="https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/view?usp=sharing"></iframe>
</body>
</html>

YouTube 版本完美运行:

The YouTube version works perfectly:

<html>
<head>
</head>
<body>
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/UTt33udwRw0" frameborder="0" allowfullscreen></iframe>
</body>
</html>

如何让 Google Drive 中的视频像 YouTube 视频一样在我的网页上播放?如果不能直接嵌入 - 可以使用哪些替代方案让视频出现 - iframe 显然不起作用,必须有一些替代方案.

How do I get the video from Google drive to play on my web page like how the YouTube video plays? If it cant be directly embedded - what alternatives can be used to get the video to appear - iframe is clearly not working, there must be some alternatives.

还有,有人知道如何让它自动播放吗?

Also, anyone know how to make it autoplay?

谢谢

推荐答案

您需要使用 Google Drive Embed 选项.这是您要查找的网址:https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/preview

You need to use the Google Drive Embed option. This is the URL you are looking for: https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/preview

<html>
<head>
</head>
<body>
<iframe width="100%" height="100%" src="https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/preview"></iframe>
</body>
</html>

您可以通过将 ?autoplay=1 附加到 URL 来使其自动播放,因此它现在是 https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/preview?autoplay=1.

You can make it autoplay by appending ?autoplay=1 to the URL so it is now https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/preview?autoplay=1.

相关文章