Android (ExoPlayer)

Example of video playback on Android using ExoPlayer

Last updated Apr 21, 2026 Note

Before you can play videos, you must first upload a video to Cloudflare Stream or be actively streaming to a live input

implementation 'com.google.android.exoplayer:exoplayer-hls:2.X.X'

SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();

// Set the media item to the Cloudflare Stream HLS Manifest URL:
player.setMediaItem(MediaItem.fromUri("https://customer-9cbb9x7nxdw5hb57.cloudflarestream.com/8f92fe7d2c1c0983767649e065e691fc/manifest/video.m3u8"));

player.prepare();

Download and run an example app

  1. Download this example app ↗︎ from the official Android developer docs, following this guide ↗︎.
  2. Open and run the exoplayer-codelab-04 example app ↗︎ using Android Studio ↗︎.
  3. Replace the media_url_dash URL on this line ↗︎ with the DASH manifest URL for your video.

For more, see read the docs.

Was this helpful?

YesNo

On this page

Android (ExoPlayer) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/stream/examples/android/#page","headline":"Android (ExoPlayer)","description":"Example of video playback on Android using ExoPlayer","url":"https://developers.cloudflare.com/stream/examples/android/","inLanguage":"en","image":"https://developers.cloudflare.com/stream/examples/android/og.png?v=b537c6780305c48c","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["Playback"]}


description: Broadcast your webcam to Cloudflare Stream with WHIP and play it back with WHEP, using native browser WebRTC and no third-party libraries. title: First WebRTC broadcast in the browser image: https://developers.cloudflare.com/stream/examples/browser-based-webrtc/og.png?v=659204a9e22190de


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/stream/llms.txt
Use this file to discover all available pages before exploring further.