Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

Can we embed a video placed on Google Drive and how to play such video in our website?

Posted on March 15, 2025March 15, 2025 by Habibie

You can’t directly embed and play a Google Drive video just by using its public shared link. Instead, you need to convert the Google Drive sharing URL into a direct file link.

Steps:

  1. Get the Google Drive File ID:
    • If your shared link is: bashCopyEdithttps://drive.google.com/file/d/FILE_ID/view?usp=sharing
    • Extract the FILE_ID from the URL.
  2. Use a Direct Link Format: bashCopyEdithttps://drive.google.com/uc?export=download&id=FILE_ID
    • This serves as a direct file link that a <video> tag can use.

Here’s the HTML + JavaScript Code:

htmlCopyEdit<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Google Drive Video Player</title>
    <style>
        body {
            text-align: center;
            font-family: Arial, sans-serif;
            margin-top: 50px;
        }
        video {
            width: 80%;
            max-width: 800px;
        }
    </style>
</head>
<body>

    <h2>Google Drive Video Player</h2>
    <video id="videoPlayer" controls>
        Your browser does not support the video tag.
    </video>

    <script>
        // Replace with your Google Drive file ID
        const fileID = "YOUR_FILE_ID_HERE";  
        const videoSrc = `https://drive.google.com/uc?export=download&id=${fileID}`;

        document.getElementById("videoPlayer").src = videoSrc;
    </script>

</body>
</html>

Important Notes:

  • Video Format: Ensure the video format is supported by browsers (MP4, WebM, or OGG).
  • Public Access: The video must be publicly accessible or shared with “Anyone with the link” for viewing.
  • Google Drive Download Limitations: If the file is large or accessed frequently, Google might temporarily restrict access.
Post Views: 248
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
  • Advanced Blinking Marker Script to show objects position in your game canvas
  • Ciihuy Images Merger – Fast & Easy Online Image Combiner
© 2025 ThirteeNov | Powered by Superbs Personal Blog theme