Skip to main content

Player API

The createPlayer function lets you play the AI-processed video output from Daydream.

Basic Usage

Configuration Options

State Machine

The player goes through these states:

Events

Attach to Video Element

The attachTo method connects the player to a <video> element:
The video element should have these attributes for best results:
  • autoplay - Start playing automatically
  • playsinline - Don’t go fullscreen on mobile
  • muted - Required for autoplay in most browsers

Get Media Stream

You can access the raw MediaStream for custom rendering (e.g., canvas):

Stop Playback

This will:
  1. Close the WebRTC connection
  2. Detach from the video element
  3. Set state to "ended"

Complete Example

Playback via Livepeer

Alternatively, you can use the playback ID with Livepeer’s player. This has higher latency than WHEP but is useful when you don’t have the WHEP URL:

Next Steps