Skip to content

Videos

Embed the video player

Embed the Appwrite video player on any website with an iframe. It streams adaptively, shows captions, and takes options for start time, autoplay, looping, controls, and accent color.

8 min read

Raw

Every video comes with a hosted player, the same one you use in the Console. Embed it on any website with an <iframe>, or share its link, and viewers get adaptive streaming, captions, keyboard shortcuts, and picture in picture without you building a player.

To build playback into your own app with hls.js, Shaka Player, AVPlayer, ExoPlayer, or another player, see Play a video in your app.

What viewers get

  • Adaptive streaming: The player switches between your renditions as the viewer's bandwidth changes. With HLS, it also caps quality at the player's size, so a small embed does not download 4K.
  • Captions and audio tracks: Viewers pick a caption track and its size, and an audio track when the video has more than one.
  • Playback controls: Playback speed from 0.5× to 2×, picture in picture, full screen, and a clock that switches between elapsed and remaining time when you click it.
  • Keyboard and touch: Keyboard shortcuts on desktop, and double tap to seek on phones.
  • Media keys: Media keys, the lock screen, and the system's now playing controls play, pause, and seek the video.
  • A responsive layout: The controls size to the player, so a small embed or a phone keeps full screen and the settings menu.

Before you start

  1. Make sure the video has a ready rendition for the HLS output. Until a rendition is ready, the player shows Not ready to play. Signed-in members can also play DASH and CMAF, but visitors play HLS only.
  2. To let anyone watch, turn on Public playback in the video's Settings. See Who can watch.

Embed a video

  1. Open Videos in your project and select a video.
  2. Click Embed. Optionally, turn on Custom start time and set where playback begins.
  3. Click Copy embed code, and paste it into your page:
Markup
<iframe
src="https://appwrite.io/player/<VIDEO_ID>?project=<PROJECT_ID>"
title="Product demo"
allow="autoplay; fullscreen; picture-in-picture"
allowfullscreen
style="width:100%;aspect-ratio:16/9;border:0;"
></iframe>

The player is served from the Console's domain, at /player/<VIDEO_ID>: appwrite.io on Appwrite Cloud, or your own Console domain when you self-host. Keep the allow attribute: without it, browsers block autoplay, full screen, and picture in picture inside the frame.

The player fills the frame and fits the video inside it, with black bars when the shapes differ. Set aspect-ratio to match your video, such as 9/16 for a vertical clip.

To share the player as a link instead, open the URL from src on its own. It plays the same way.

Preview and customize

Click Preview on a video to open the player live in a large panel, next to the player options. Changing an option updates the preview and the panel's Query string, and editing the query string updates the options.

Player preview panel with the video paused at 0:39, a pink progress bar, Loop turned on, and the query string with start, loop, and color
Player preview panel with the video paused at 0:39, a pink progress bar, Loop turned on, and the query string with start, loop, and color

When it looks right, click Copy embed code or Copy URL, or Open in new tab to try the player on its own. Reset sets every option back to its default.

Player options

Add options to the player URL as query parameters. The player ignores a value it cannot read, so a typo never breaks the embed.

ParameterDefaultWhat it does
projectRequiredYour project ID
start0Where playback begins. Takes seconds (90), units (90s, 1m30s, 1h2m3s), or a clock (1:30, 1:02:03)
autoplayOffPlays as soon as the player loads. See Autoplay
mutedOffStarts with the sound off
loopOffPlays again from the start when the video ends
controlsOncontrols=0 hides the control bar. Viewers click the picture to play or pause
colorWhiteColors the progress bar and the volume. A hex color with 3 or 6 digits and no #, such as fd366e

Turn a flag on with 1, true, yes, on, or the bare parameter, such as ?loop. Turn it off with 0, false, no, or off.

For example, a silent product clip that loops from 12 seconds in, with a pink accent:

Plain text
https://appwrite.io/player/<VIDEO_ID>?project=<PROJECT_ID>&start=12&autoplay=1&muted=1&loop=1&color=fd366e

Autoplay

Browsers often block autoplay with sound. When a browser refuses, the player starts the video muted instead and shows an Unmute button. To autoplay silently on purpose, such as a background clip, add muted=1 as well.

Leave autoplay off for videos people choose to watch, and let them press play.

Settings menu

The gear button in the control bar opens the player's settings:

Player settings menu with Quality on Auto at 1080p, Playback speed, Keyboard shortcuts, Stream format on HLS, Inspector, and Reload stream
Player settings menu with Quality on Auto at 1080p, Playback speed, Keyboard shortcuts, Stream format on HLS, Inspector, and Reload stream

SettingWhat it does
QualityAuto picks a rendition from bandwidth and player size, and shows the one playing. Pick a rendition to stay on it. Renditions of 720p and up show an HD badge, and 2160p and up a 4K badge
Playback speed0.5× to 2×
SubtitlesTurns captions off, or picks a track. Shows when the video has captions
Subtitle sizeCompact, standard, or large subtitles
AudioPicks an audio track. Shows when the video has more than one
Keyboard shortcutsLists the keyboard shortcuts. Shows on devices with a mouse or trackpad
Stream formatSwitches between HLS, DASH, CMAF, and Source, the original file in Storage. A format with no ready rendition is turned off
InspectorOpens the inspector in a separate window, to check how the stream plays
Reload streamLoads the stream again. A dot marks it when renditions finished after the player loaded

The player starts on the first format with a ready rendition, in this order: HLS, CMAF, DASH. Source needs read access to the file in Storage.

Where the browser plays HLS on its own, as on some iPhones, the browser picks the quality and Quality does not show.

Keyboard shortcuts

Shortcuts work while the player has focus, so click an embedded player first. Press ? to see the list in the player.

Keyboard shortcuts list open in the player's settings menu, from Play or pause to Jump to 0% to 90%
Keyboard shortcuts list open in the player's settings menu, from Play or pause to Jump to 0% to 90%

KeysAction
Space or KPlay or pause
← →Seek 5 seconds back or forward
J LSeek 10 seconds back or forward
, .Step one frame back or forward, while paused
↑ ↓Change volume
MMute or unmute
< >Change playback speed
CTurn subtitles on or off
FFull screen
IPicture in picture
0 to 9Jump to 0% to 90% of the video
Home EndGo to the start or end
?Show keyboard shortcuts

With a mouse, double-click the picture to enter or leave full screen.

Touch

On phones and tablets:

  • Tap the picture to show the controls, and tap again to play or pause.
  • Double tap the left or right side of the picture to seek 10 seconds back or forward. Each further tap seeks another 10 seconds.
  • In full screen, a landscape video turns the phone to landscape.

Who can watch

The player follows the video's permissions:

  • Public videos play for anyone. Turn on Public playback in the video's Settings, or grant Read to Role.any(). Visitors who are not signed in play the HLS output, so the video needs a ready HLS rendition. They get the stream without scrubbing thumbnails, because they cannot read the video's timeline.
  • Private videos play only for viewers signed in to the Console with an account that can read the video, such as members of your project. Everyone else sees This video is private and a Sign in button.

The player signs viewers in with an Appwrite Console account, not as users of your app. To show a private video to your app's users, build playback into your app as described in Private playback.

Troubleshooting

MessageCheck
Missing projectThe URL needs a project parameter, such as ?project=<PROJECT_ID>
Not ready to playNo rendition is ready yet. Wait for encoding to finish, or create a rendition
This video is privateTurn on Public playback, or sign in with an account that can read the video. For a public video, check that it has a ready HLS rendition: visitors cannot play DASH or CMAF
Access deniedThe signed-in account cannot read the video. Check the video's permissions
Video not foundThe video ID in the URL, and whether the video was deleted
Autoplay starts mutedThe browser blocked sound. Viewers click Unmute. See Autoplay
Full screen or picture in picture does nothingThe iframe's allow attribute, and allowfullscreen
Shortcuts do nothingClick the player first so it has focus
Stalls or low qualityOpen Inspector from the settings menu to see buffer, bitrate, and network timing

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.