Skip to content

Player SDK quick start

This is a preview of the SDK. The full reference docs open with the beta.

  1. 1. Install the package

    The web SDK has no runtime dependencies and is about 40 KB gzipped.

    terminal
    npm install @we11cloud/player
  2. 2. Upload a video

    Create an upload from your server, then send the file from the client. You get a playback ID back.

    create-upload.sh
    curl https://api.we11cloud.com/v1/uploads \
      -H "Authorization: Bearer $WE11_API_KEY" \
      -d '{ "title": "Launch keynote", "access": "signed" }'
    
    # → { "upload_url": "https://up.we11cloud.com/…", "playback_id": "pl_8Hq2…" }
  3. 3. Play it

    Pass the playback ID to the player. Adaptive streaming, captions and analytics are on by default.

    player.ts
    import { createPlayer } from '@we11cloud/player'
    
    const player = createPlayer('#video', {
      playbackId: 'pl_8Hq2xK',
      autoplay: 'muted',
      captions: ['en', 'vi'],
    })
    
    player.on('qualitychange', ({ height }) => {
      console.log(`Now playing ${height}p`)
    })
player.ts
import { createPlayer } from '@we11cloud/player'

const player = createPlayer('#video', {
  playbackId: 'pl_8Hq2xK',
  autoplay: 'muted',
  captions: ['en', 'vi'],
})

player.on('qualitychange', ({ height }) => {
  console.log(`Now playing ${height}p`)
})

Build your video product on We11cloud

Tell us what you are building. We will set up your beta workspace and help you ship your first stream.