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.
THIS DOES NOTHING:
<html>
<head>
</head>
<body>
<iframe width="100%" height="100%" src="https://drive.google.com/file/d/1pdvh_mEnkXPKA3jivYIpYKTaoukxH5p3Yg/view?usp=sharing"></iframe>
</body>
</html>
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>
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?
Thanks
Steps to Embed Google Drive Video on a Web PageGo to Google Drive and look for the video that you wish to embed. Right-click on the video and tap on the Get Link button. Here change the link permission to Anyone with the link can view. Copy the link and open it.
Open Video Preview in google drive. On the 3 Dots from top left screen, click to open in new window. Click the 3 dots again, and in opened menu this time you'll see Embed item option & Click on that. Now you'll get an iframe tag copy only video id from the link.
EDIT: September 2022
It seems at some point since this answer was first posted, autoplaying has stopped working. As it currently stands, the video player attempts to autoplay but fails to load, indicating that this is probably a bug. I've not yet found a suitable alternative.
Original Answer
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>
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With