Getting Started with PlayVideo
Upload your first video in under 5 minutes.
Prerequisites
- A PlayVideo account (sign up free)
- Your API key from the dashboard
Step 1: Install the SDK
npm install @playvideo/playvideo-sdk
Or use yarn/pnpm:
yarn add @playvideo/playvideo-sdk
pnpm add @playvideo/playvideo-sdk
Step 2: Initialize the Client
import PlayVideo from '@playvideo/playvideo-sdk';
async function main() {
// Initialize
const bb = new PlayVideo(process.env.BLOCKBUSTER_API_KEY);
// Create collection (only needed once)
try {
await bb.collections.create({ name: 'Tutorials' });
} catch (e) {
// Collection might already exist
}
// Upload video
const result = await bb.videos.upload({
file: './my-tutorial.mp4',
collection: 'tutorials'
});
console.log('Uploading...', result.video.id);
// Wait for processing
const video = await bb.videos.waitForReady(result.video.id);
console.log('Ready!');
console.log('Stream URL:', video.playlistUrl);
console.log('Thumbnail:', video.thumbnailUrl);
}
main().catch(console.error);
Next Steps
- Authentication Guide - Secure your API keys
- Upload Best Practices - Large files, progress tracking
- Video Playback - Players, adaptive streaming
- API Reference - Full API documentation
Using cURL Instead?
No SDK needed. Here’s the same flow with cURL:
# Create collection
curl -X POST https://api.playvideo.dev/v1/collections \
-H "Authorization: Bearer play_live_xxx" \
-H "Content-Type: application/json" \
-d '{"name": "My App Videos"}'
# Upload video
curl -X POST https://api.playvideo.dev/v1/videos \
-H "Authorization: Bearer play_live_xxx" \
-F "[email protected]" \
-F "collection=my_app_videos"
# Check status
curl https://api.playvideo.dev/v1/videos/VIDEO_ID \
-H "Authorization: Bearer play_live_xxx"