Play a video in your app
Play Appwrite Videos streams on the web, Apple platforms, Android, Flutter, and React Native by loading the master manifest in a standard player.
4 min read
Appwrite Videos streams work with standard HLS and DASH players. You give the player the master manifest URL, and it handles adaptive bitrate and captions on its own. There is no Appwrite SDK to add for playback.
To put a video on a website without building a player, embed the video player with an iframe instead.
Open a video and select Install. Pick a platform, player, framework, and format to get install steps and code with your stream URL already filled in. Copy prompt copies the same setup as instructions for an AI coding agent.

Before you start
- Make sure the video has at least one
readyrendition for the output you want to play. - Grant read access on the video to the viewers who should watch it. For a public video, turn on Public playback in the video's Settings. See Permissions.
- Copy the master manifest URL from the video's Streaming page, or build it as described in Outputs:
https://<REGION>.cloud.appwrite.io/v1/videos/<VIDEO_ID>/outputs/cmaf/master.m3u8?project=<PROJECT_ID>Use the .m3u8 manifest with HLS players and the .mpd manifest with DASH players.
In your app, build the URL from the video ID you store with your data, rather than hard-coding it:
const APPWRITE_ENDPOINT = 'https://<REGION>.cloud.appwrite.io/v1';const PROJECT_ID = '<PROJECT_ID>';
function manifestUrl(videoId, format = 'm3u8') { return `${APPWRITE_ENDPOINT}/videos/${videoId}/outputs/cmaf/master.${format}?project=${PROJECT_ID}`;}Choose a player
| Platform | Start with | Why |
|---|---|---|
| Web | hls.js | Small, plays HLS everywhere, falls back to Safari's native player |
| Web, with DASH or more control | Shaka Player or Video.js | Plays HLS and DASH, with richer APIs and plugins |
| iOS, iPadOS, tvOS, macOS | AVPlayer | Built into the OS, nothing to install |
| Android | Media3 ExoPlayer | Google's recommended player, plays HLS and DASH |
| Flutter | video_player | The official Flutter plugin |
| React Native | react-native-video | The most widely used React Native player |
Add a player
hls.js plays HLS in every modern browser. Safari plays HLS natively, so fall back to the <video> element there. If you only target Safari and iOS, a plain <video src="<HLS_MANIFEST_URL>"> is enough.
npm install hls.jsimport Hls from 'hls.js'
const video = document.getElementById('player')const src = '<HLS_MANIFEST_URL>'
if (Hls.isSupported()) { const hls = new Hls() hls.loadSource(src) hls.attachMedia(video)} else if (video.canPlayType('application/vnd.apple.mpegurl')) { // Safari plays HLS natively video.src = src}<video id="player" controls playsinline></video><script type="module" src="/main.js"></script>Shaka Player plays both DASH and HLS.
npm install shaka-playerimport shaka from 'shaka-player'
shaka.polyfill.installAll()
const video = document.getElementById('player')const player = new shaka.Player()await player.attach(video)await player.load('<DASH_OR_HLS_MANIFEST_URL>')<video id="player" controls playsinline></video><script type="module" src="/main.js"></script>Video.js plays both DASH and HLS. Set the source type to match the manifest.
npm install video.jsimport videojs from 'video.js'import 'video.js/dist/video-js.css'
const player = videojs('player', { fluid: true })player.src({ src: '<HLS_MANIFEST_URL>', type: 'application/x-mpegURL' // 'application/dash+xml' for DASH})<video id="player" class="video-js" controls playsinline></video><script type="module" src="/main.js"></script>AVPlayer is part of AVKit on iOS, iPadOS, tvOS, visionOS, and macOS, so there is nothing to install. It plays HLS.
import AVKitimport SwiftUI
struct PlayerView: View { @State private var player = AVPlayer( url: URL(string: "<HLS_MANIFEST_URL>")! )
var body: some View { VideoPlayer(player: player) .onAppear { player.play() } .onDisappear { player.pause() } }}Media3 ExoPlayer plays both HLS and DASH. Add the module for your format to build.gradle.kts, and allow network access in AndroidManifest.xml.
implementation("androidx.media3:media3-exoplayer:1.8.0")implementation("androidx.media3:media3-exoplayer-hls:1.8.0") // or media3-exoplayer-dashimplementation("androidx.media3:media3-ui:1.8.0")<uses-permission android:name="android.permission.INTERNET" />import androidx.compose.runtime.Composableimport androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.rememberimport androidx.compose.ui.Modifierimport androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.viewinterop.AndroidViewimport androidx.media3.common.MediaItemimport androidx.media3.common.MimeTypesimport androidx.media3.exoplayer.ExoPlayerimport androidx.media3.ui.PlayerView
private const val STREAM_URL = "<HLS_MANIFEST_URL>"
@Composablefun PlayerScreen(modifier: Modifier = Modifier) { val context = LocalContext.current val player = remember { ExoPlayer.Builder(context).build().apply { setMediaItem( MediaItem.Builder() .setUri(STREAM_URL) .setMimeType(MimeTypes.APPLICATION_M3U8) // APPLICATION_MPD for DASH .build() ) prepare() playWhenReady = true } } DisposableEffect(player) { onDispose { player.release() } } AndroidView( modifier = modifier, factory = { PlayerView(it).apply { this.player = player } }, )}The video_player package plays HLS.
flutter pub add video_playerimport 'package:flutter/material.dart';import 'package:video_player/video_player.dart';
const streamUrl = '<HLS_MANIFEST_URL>';
class PlayerScreen extends StatefulWidget { const PlayerScreen({super.key});
State<PlayerScreen> createState() => _PlayerScreenState();}
class _PlayerScreenState extends State<PlayerScreen> { late final VideoPlayerController _controller;
void initState() { super.initState(); _controller = VideoPlayerController.networkUrl( Uri.parse(streamUrl), formatHint: VideoFormat.hls, )..initialize().then((_) { setState(() {}); _controller.play(); }); }
void dispose() { _controller.dispose(); super.dispose(); }
Widget build(BuildContext context) { if (!_controller.value.isInitialized) { return const Center(child: CircularProgressIndicator()); } return AspectRatio( aspectRatio: _controller.value.aspectRatio, child: VideoPlayer(_controller), ); }}react-native-video plays HLS.
npm install react-native-videocd ios && pod installimport { StyleSheet } from 'react-native'import Video from 'react-native-video'
const src = '<HLS_MANIFEST_URL>'
export function VideoPlayer() { return ( <Video source={{ uri: src, type: 'm3u8' }} style={styles.video} resizeMode="contain" controls /> )}
const styles = StyleSheet.create({ video: { width: '100%', aspectRatio: 16 / 9 },})Captions
Captions are listed in the master manifest, so players that support text tracks show them in their captions menu without extra setup. The default caption turns on automatically.
Poster and thumbnails
Videos does not set a poster image. To show a frame before viewers press play, set the <video> element's poster to your own image. For scrubbing thumbnails, load the timeline into your player's thumbnail track, or render them yourself.
Autoplay
Browsers block autoplay with sound. To start playback on load, for example in a background or preview clip, mute the video and keep playsinline so iOS does not open it fullscreen:
<video id="player" muted autoplay playsinline loop></video>Attach the stream as usual. Leave autoplay off for videos people choose to watch, and let them press play.
Clean up
Players hold network connections and decoders. In single-page apps, release them when the view goes away: call hls.destroy() for hls.js, player.destroy() for Shaka Player, and player.dispose() for Video.js. On mobile, release ExoPlayer and pause AVPlayer when the screen closes, as the examples above do.
Troubleshooting
| Symptom | Check |
|---|---|
404 with video_not_found on the manifest | The video's read permissions, and whether the request carries the viewer's session. See Private playback |
404 with video_rendition_not_found on the master manifest | No rendition for that output is ready yet. Wait for encoding, or create a rendition for that output |
| Plays in the Console but not in your app | The Console plays private videos for project members. Turn on Public playback, or see Private playback |
| DASH does not play in Safari | Safari has no native DASH. Use the HLS manifest, or CMAF HLS |
| Stalls or low quality | Open the inspector 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.