Player API
ThecreatePlayer 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
TheattachTo method connects the player to a <video> element:
autoplay- Start playing automaticallyplaysinline- Don’t go fullscreen on mobilemuted- Required for autoplay in most browsers
Get Media Stream
You can access the raw MediaStream for custom rendering (e.g., canvas):Stop Playback
- Close the WebRTC connection
- Detach from the video element
- 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
- Broadcast - Send video to Daydream
- React Hooks - Use
usePlayerhook - Compositor - Combine multiple sources