play resolves with the position where the viewer stopped.
Options
Stream format. If you leave it out, the SDK infers it from the URL:
.m3u8 is hls, .mpd is dash, .webm is webm, and anything else is mp4. Set it when a manifest’s URL doesn’t end in the usual extension.Close the player when the video ends. Without it, the player stays open on the last frame. Ignored with
loop.Let the viewer send the video to a TV with AirPlay or Chromecast. Set it to
false for content you aren’t allowed to show on a second screen.While playing, send a
progress event every this many seconds. With 0, no progress events are sent. The final position always comes with the result.Events
The optional second argument ofplay (or openPlayer) receives every state change while the player is open:
What happened.
cast means playback moved to a TV or came back to the device.On
cast events only. Where the video plays now, or null when it’s back on the device.progress events and the final position keep working, so you can save resume points the same way.
Result
not_available: this surface has no player. busy: another video is already open. invalid_source: the URL is not http(s), or this platform can’t play the format. playback_failed: the stream couldn’t be loaded.Supported formats
Check
availability.formats, or call getPlayerAvailability(), before you choose which URL to pass.
The player doesn’t support DRM or custom request headers. To protect a stream, use a signed URL that carries its token in the query string.
Casting to a TV
On iOS the viewer can send the video to a TV with AirPlay. On Android a Cast button appears next to the title when a Chromecast is on the same network. The video continues on the TV from the same position, and the phone shows a remote with play, pause and seek. When the viewer stops casting, playback continues on the phone from where the TV left off.availability.cast lists where the current shell can cast: ['airplay'] on iOS, ['chromecast'] on Android, and [] everywhere else.
The TV downloads the video itself, not through the phone. Make sure that:
- The URL works from the TV. A signed URL must stay valid until the viewer is likely to finish watching.
- For HLS and DASH on Chromecast, your server sends an
Access-Control-Allow-Originheader on the manifest and its segments.
close() (or closePlayer()). Without the hook, use openPlayer(options, onEvent?), closePlayer() and getPlayerAvailability(). isPlayerAvailable() is a shortcut that resolves only the available flag, and inferPlayerFormat(src) returns the format openPlayer would report for a URL.