RVE LogoReact Video EditorDOCS
React Video Editor Documentation

Pexels Video Adapter

Integrate Pexels videos with React Video Editor

Pexels Video Adapter

The Pexels video adapter integrates with the Pexels API to access their extensive video library.

Overview

The Pexels adapter allows you to:

  • Search and browse Pexels videos
  • Download videos for editing
  • Access video metadata
  • Handle Pexels API authentication

Setup

First, you'll need a Pexels API key:

  1. Sign up at Pexels
  2. Get your API key from the dashboard
  3. Configure the adapter with your key

Usage

import { PexelsVideoAdapter } from 'react-video-editor';

const adapter = new PexelsVideoAdapter({
  apiKey: 'your-pexels-api-key'
});

// Search for videos
const videos = await adapter.search('nature', {
  page: 1,
  perPage: 20
});

// Load a specific video
const video = await adapter.load('pexels-video-id');

Configuration

OptionTypeDefaultDescription
apiKeystringRequiredYour Pexels API key
baseUrlstring'https://api.pexels.com'Pexels API base URL
timeoutnumber30000Request timeout in milliseconds

API Methods

Search Videos

const results = await adapter.search(query, options);
const popular = await adapter.getPopular(options);

Get Video by ID

const video = await adapter.getById(videoId);

Error Handling

The Pexels adapter handles:

  • API rate limiting
  • Authentication errors
  • Network timeouts
  • Invalid video IDs

Examples

// Search for nature videos
const natureVideos = await adapter.search('nature', {
  page: 1,
  perPage: 10,
  orientation: 'landscape'
});

// Get a specific video
const video = await adapter.getById('1234567');
console.log('Video URL:', video.video_files[0].link);