Skip to content

Android and Android TV Integration

Android Integration

Peer5 integrates with Android very well and integration is straightforward and easy.

We have integrations for hybrid apps, PWAs, React Native apps and of course native Android applications. This document covers all forms of this integration.

Android TV and set-top boxes are also supported in the SDK. If you have questions about integrating with set-top boxes or would like to discuss case studies and see if it makes sense for your business please do not hesitate to Chat with us or send us an email.

Non-Native Apps

Hybrid Application

Since a hybrid application is just an HTML5 application in disguise, Peer5 will work out of the box with hybrid applications. In the same page or view in which you initialize your video player - include the Peer5 scripts.

Delivery of P2P content will work on all Android versions from 5.0 and up (versions with WebRTC support).

React Native Application

Integration through React Native depends on whether you're performing video playback using an HTML5 player or a native player.

If you're using an HTML5 player, please follow the web integration instructions. For native playback, please follow the native application instructions below.

Progressive Web App

See our dedicated PWA docs.

Native Application

Peer5 has a thin native Android SDK that is embeddable in your native app. The Peer5 Android SDK works with any Android player although we recommend ExoPlayer which we've found to give good playback results.

Player requests for video segments (.ts files) are intercepted and instead of always serving them directly from HTTP, they are load balanced between HTTP and P2P.

SDK Overview

Supported Technologies

Player: Any Android Player. Android Version Support: Jelly Bean 4.1 (API level 16), P2P Supported from Lollipop 5.0 (API level 21) Playback Technologies: HLS, DASH (Upon Request)

Installation Instructions


  1. In your project's build.gradle add the Peer5 SDK repository inside repositories:
   allprojects {
      repositories {
         maven {
            url ""
  1. Add the SDK as a dependency to your application's build.gradle file under dependencies:
implementation ""


  1. in your pom.xml the the Peer5 SDK repository
  1. Add the SDK as a dependency

It is always recommended to run the latest version of the SDK although older versions are also supported. If you prefer to pin the dependency to a specific version - use this format latest version can be seen in the Maven repo info

  1. Register with Peer5 and get your Customer ID. Add this metadata tag to your AndroidManifest.xml inside the <application> tag after all activities:
<meta-data android:value="Your-CustomerID-Goes-Here" android:name="com.peer5.ApiKey"/>
  1. Before setting your player's stream url, switch it with a Peer5 url:


import com.peer5.sdk.Peer5Sdk;

String peer5Url = Peer5Sdk.getPeer5StreamUrl(url); // kotlin version is similar

Full example with ExoPlayer:

String peer5Url = Peer5Sdk.getPeer5StreamUrl(m3u8Url.toString());
Uri peer5Uri = Uri.parse(peer5Url);

// In older versions of ExoPlayer: use `new HlsMediaSource` instead of HlsMediaSource.Factory 
HlsMediaSource source = new HlsMediaSource.Factory(mediaDataSourceFactory).createMediaSource(peer5Uri);

That’s all that’s needed for you to get started!


Q: How can I check that the SDK is integrated correctly?

A: Go to and under “+Add Filter" select and then enter 'Contains' and then "Android". After correct integration you should be seeing traffic there. Traffic may take several minutes to start appearing in the dashboard.

Q: How can I gradually deploy P2P with the SDK?

A: You can change the amount of traffic you’d like to go through peer-to-peer from your Peer5 dashboard at - note that this change can be made even after your have deployed your app.

Q: How can I change how Peer5 runs on cellular networks?

A: You can change the behavior of Peer5 for users who are connected via cellular or WiFi from your Peer5 dashboard at

Q: Is the SDK stable? Should I expect any performance difference in my app?

A: Peer5’s Android SDK is battle tested both in real world applications and contains an extensive test suite that runs on each version. Integrating the SDK should have no performance impact on your application. Users, on the other hand, will enjoy higher quality streaming with the SDK.

Q: How does Peer5 work?

A: Please refer to

Q: Is Android TV supported?

A: Yes, Android TV is a supported platform for the SDK. However, if you intend to integrate the SDK into a custom set-top box please let us know so we can ensure compatibility with custom versions of Android.

Q: Are encryption, DRM and https supported?

A: Yes, HTTPS, DRM and encryption are supported on newer versions of the SDK (2.1+). However if you’re concerned about your setup please contact send us an email and we'll help you make sure it's compatible.

Q: How long does integration take?

A: The code integration typically takes less than an hour. After the initial integration, Peer5 will run performance tests on your stream to optimize for P2P efficiency. We might contact you and suggest minor modifications in how your server streams HLS during this optimization process.

Please also refer to to the FAQ.


If you have any questions about applying or integration do not hesitate to Chat with us or send us an email.