PlayVideo

PlayVideo CLI

The CLI is the fastest way to manage uploads, collections, and videos from your terminal.

PlayVideo CLI

npm version npm downloads License: MIT

Command-line interface for PlayVideo API. Upload, manage, and stream videos from your terminal.

Features

  • Interactive mode - Guided workflows for uploads and management
  • Video management - List, inspect, and delete videos
  • Collections - Organize videos into collections
  • Authentication - OAuth login or API key support
  • Webhooks - Configure and test webhooks
  • API keys - Create and manage API keys
  • Embed settings - Inspect embed configuration
  • Usage - View plan limits and usage

Installation

npm install -g @playvideo/playvideo-cli

Or run without installing:

npx @playvideo/playvideo-cli <command>

Quick Start

playvideo

The CLI will guide you through authentication and present a menu:

Upload Video     - Upload and transcode videos
Manage Videos    - List, view, delete videos  
Collections      - Organize videos into collections
Webhooks         - Configure event notifications
API Keys         - Manage API keys
Embed Settings   - Customize video player
Account          - View account & usage

Command Mode

# Login (opens browser for authentication)
playvideo auth login

# Create a collection
playvideo collections create "My Videos"

# Upload a video
playvideo upload video.mp4 -c my_videos

# Check status
playvideo videos list

Short alias: You can use pv instead of playvideo for all commands:

pv auth login
pv upload video.mp4 -c my_videos

Authentication

The CLI uses browser-based OAuth for secure authentication.

# Login via browser (recommended)
playvideo auth login

# Or use an API key directly
playvideo auth login --api-key play_live_xxx

# Check auth status
playvideo auth status

# Logout
playvideo auth logout

Commands

Collections

# List all collections
playvideo collections list
pv col ls

# Create a collection
playvideo collections create "Tutorial Videos" -d "Video tutorials"

# Show collection details
playvideo collections show tutorial_videos

# Delete a collection (requires --force)
playvideo collections delete tutorial_videos --force

Videos

# List all videos
playvideo videos list
pv vid ls

# Filter by collection or status
playvideo videos list -c my_collection
playvideo videos list -s COMPLETED
playvideo videos list -s PROCESSING

# Show video details
playvideo videos show <video-id>

# Delete a video
playvideo videos delete <video-id>

Upload

# Upload a video
playvideo upload video.mp4 -c my_collection

# Upload and wait for processing
playvideo upload video.mp4 -c my_collection --wait

Usage & Billing

# Check current usage and limits
playvideo usage

API Keys

# List API keys
playvideo api-keys list
pv keys ls

# Create a new API key
playvideo api-keys create "My App"

# Delete an API key
playvideo api-keys delete <key-id>

Webhooks

# List webhooks
playvideo webhooks list

# Create a webhook
playvideo webhooks create https://example.com/webhook -e video.completed,video.failed

# Test a webhook
playvideo webhooks test <webhook-id>

# Delete a webhook
playvideo webhooks delete <webhook-id>

Embed Settings

# Show current embed settings
playvideo embed show

Account & Domain Settings

# Show account settings
playvideo config show

Examples

Upload and Get Stream URL

# Upload and wait for processing
playvideo upload tutorial.mp4 -c tutorials --wait

# Output:
# Uploading tutorial.mp4 (125.5 MB)...
# Uploaded: clx1234567890
# Status: PENDING
#
# Waiting for processing...
# Processing complete!
#
# Playlist URL: https://cdn.playvideo.dev/{userId}/.../playlist.m3u8
# Thumbnail: https://cdn.playvideo.dev/{userId}/.../thumb.jpg

Batch Upload

# Upload multiple files
for f in videos/*.mp4; do
  playvideo upload "$f" -c my_collection
done

CI/CD Integration

# GitHub Actions example
- name: Upload video
  env:
    PLAYVIDEO_API_KEY: ${{ secrets.PLAYVIDEO_API_KEY }}
  run: |
    npx @playvideo/playvideo-cli upload ./demo.mp4 -c releases --wait

Configuration

The CLI stores configuration in ~/.config/playvideo/config.json.

Environment Variables

VariableDescription
PLAYVIDEO_API_KEYAPI key (overrides saved key)
CISet to true to disable interactive mode
PLAYVIDEO_NO_INTERACTIVESet to true to disable interactive mode
# Use environment variable instead of saved key
export PLAYVIDEO_API_KEY=play_live_xxx
playvideo videos list

# Disable interactive mode in CI/CD
CI=true playvideo upload video.mp4 -c my_collection

Troubleshooting

”API key not configured”

Run playvideo auth login or set PLAYVIDEO_API_KEY environment variable.

”Collection not found”

Make sure the collection exists. List collections with playvideo col ls.

Upload fails with “File too large”

Check your plan limits with playvideo usage. Upgrade for larger file sizes.

Browser doesn’t open for login

If the browser doesn’t open automatically, the CLI will print the URL. Copy and paste it manually.

License

MIT