Skip to content

feat: Add private video support with oEmbed-first API strategy#30

Open
lucasjahn wants to merge 3 commits intoluwes:mainfrom
lucasjahn:phase-1-private-video-support
Open

feat: Add private video support with oEmbed-first API strategy#30
lucasjahn wants to merge 3 commits intoluwes:mainfrom
lucasjahn:phase-1-private-video-support

Conversation

@lucasjahn
Copy link

Overview

  • Resolves: Private video support limitation
  • Maintains: Original performance characteristics and API compatibility

Private Video Support

  • New attributes: privacy-hash, video-url
  • URL formats supported:
    • https://vimeo.com/123456789/abc123def456
    • https://player.vimeo.com/video/123456789?h=abc123def456
  • Attribute format: videoid="123456789" privacy-hash="abc123def456"

Modern API Strategy

  • oEmbed API for all videos (Vimeo's 2024+ recommendation)
  • Vimeo API v2 deprecated fallback (will be removed in future versions)
  • HD thumbnails: 1280×720 instead of 480×360
  • Consistent behavior across public and private videos

Enhanced Component

  • New events: lite-vimeo-ready, lite-vimeo-play, lite-vimeo-error
  • Public methods: refresh(), getVideoInfo()
  • Comprehensive error handling with recovery strategies

🔧 Technical Implementation

New Files

  • lite-vimeo-embed-enhanced.js - Enhanced component with private video support
  • src/api/vimeo-api-client.js - oEmbed-first API client with fallback strategy
  • src/utils/privacy-hash-parser.js - Privacy hash detection and URL parsing
  • src/utils/error-handler.js - Error handling with recovery mechanisms

Architecture

All Videos → oEmbed API (recommended)

Success → HD thumbnails + metadata

Fallback (public only) → Deprecated V2 API

Final Fallback → Direct iframe embed

Why This Matters

  1. Vimeo API v2 deprecated - Using it risks future breakage
  2. Private videos unsupported - Major limitation for enterprise users
  3. Inconsistent quality - Mixed thumbnail resolutions
  4. Future-proofing - Aligns with Vimeo's 2024+ recommendations

Existing Users

No changes required - existing code works unchanged:

Private Video Users

Simply add privacy hash:

Before: Failed with 404
<lite-vimeo videoid="123456789"></lite-vimeo>
After: Works perfectly
<lite-vimeo videoid="123456789" privacy-hash="abc123def456"></lite-vimeo>

- Add private/unlisted video support via privacy hash detection
- Migrate to oEmbed API for all videos (V2 API deprecated)
- Implement HD thumbnails (1280x720 vs 480x360)
- Add comprehensive error handling and recovery strategies
- Maintain 100% backward compatibility
- Add new component events and public API methods

New files:
- lite-vimeo-embed-enhanced.js: Enhanced component with private video support
- src/api/vimeo-api-client.js: oEmbed-first API client with fallback
- src/utils/privacy-hash-parser.js: Privacy hash detection and validation
- src/utils/error-handler.js: Error handling with recovery mechanisms

Tested with real videos:
- Public: 524933864 ✅
- Private: 1114813712/365e3d021c ✅
@vercel
Copy link

vercel bot commented Sep 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lite-vimeo-embed Ready Ready Preview Comment Sep 16, 2025 4:24pm

- Replace lite-vimeo-embed.js with enhanced version content
- Backup original as lite-vimeo-embed-legacy.js for compatibility
- Private video support now standard feature
- oEmbed-first API strategy for all videos
- HD thumbnails (1280x720) by default
- 100% backwards compatible upgrade
- Update package version to 0.4.0
- Update CHANGELOG.md with new features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant