DriveLoader Logo
DriveLoaderv1.2.0
DriveLoader v1.2.0 ReleasedYouTube Support, Drive Video & Mixed Galleries

Turn Google Drive into your React Media CDN.

The complete React library for loading, streaming, caching, and resolving Google Drive and YouTube media instantly.

App.tsx
1import {
2 DriveMedia,
3 DriveImage,
4 DriveVideo
5} from "@driveloader/react";
6
7export function App() {
8 return (
9 <>
10 <DriveImage src="https://drive.google.com/file/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs/view" />
11
12 <DriveVideo
13 src="https://drive.google.com/file/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs/view?type=video"
14 controls
15 preload="metadata"
16 />
17
18 <DriveMedia src="https://youtu.be/dQw4w9WgXcQ" />
19 </>
20 );
21}

Why Standard Drive Links Fail

Understand the CORS and HTML wrapper restrictions of Google Drive URLs, and see how DriveLoader fixes them seamlessly.

Standard <img /> or <video /> Tag

drive.google.com/file/d/.../view

HTML Viewing Page Wrapper: Drive share links return an HTML web page rather than pure binary media bytes.
CORB / Cross-Origin Blocking: Chrome blocks responses with MIME type text/html inside media tags.
Broken UI & Broken Video Players: Renders missing image icons or media playback errors across browsers.
GET https://drive.google.com/file/d/ID/view -> 200 OK (text/html) [CORB Blocked]

DriveLoader (<DriveImage /> & <DriveVideo />)

lh3.googleusercontent.com/d/...

Direct CDN Binary Stream: Resolves file IDs into working Google Drive CDN endpoints (image/* & video/*).
Endpoint Learning & Retry: Prioritizes fastest working candidate endpoints and caches CDN urls in memory.
Skeletons, Fade & Lazy Loading: Built-in skeleton placeholders, smooth opacity transitions, and IntersectionObserver.
GET https://lh3.googleusercontent.com/d/ID -> 200 OK (image/jpeg) [CDN Streamed]

Resolution Pipeline Architecture

Click through the 6-stage resolution pipeline engine powering DriveLoader's instant CDN delivery.

1. Google Drive Link

Raw URL or File ID

Step 1 of 6

Accepts any link format: drive.google.com/file/d/{ID}/view, open?id={ID}, uc?id={ID}, docs.google.com, lh3.googleusercontent.com, or raw 28+ char File IDs.

Pipeline Execution Trace
const input = "https://drive.google.com/file/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs/view";

Built for Production React Apps

Everything you need to deliver high-performance Google Drive media CDN features out of the box.

Smart URL Resolution

Parses drive.google.com/file/d/, open?id=, uc?id=, docs, lh3, and raw 28+ char file IDs instantly.

Google Drive Video Support

Stream videos with poster thumbnails, HTML5 controls, and metadata extraction (duration, width, height).

YouTube First-Class Embeds

Native support for YouTube URLs via <YouTubeVideo /> and <DriveMedia /> with lazy thumbnails and privacy-mode.

Public Folder Loading

Load all media assets from public Google Drive folders using API v3 with pagination and extension filters.

Mixed Media Galleries

<DriveGallery /> automatically inspects assets and renders images and videos side-by-side seamlessly.

Endpoint Learning

Remembers working CDN endpoints per file ID and prioritizes them in future resolutions.

Request Coalescing

Deduplicates concurrent in-flight requests for identical file IDs to eliminate redundant network traffic.

In-Memory Caching

LRU capacity eviction and TTL expiration with real-time performance metrics (getCacheStats()).

Stateful Custom Hooks

React hooks (useDriveImage, useDriveVideo, useDriveFolder) for total programmatic state control.

100% TypeScript & Zero-Deps

Fully typed API contracts, actionable error hierarchy, ultra-lightweight and tree-shakeable.

Get Started in Seconds

Install via your favorite package manager and start loading Google Drive media immediately.

npm install @driveloader/react

Open Source & Developer First

100%
Open Source MIT
Zero
Runtime Dependencies
TypeScript
100% Type-Safe
v1.2.0
Latest Release