Skip to main content
Version: 2.16

Android SDK Samples

The Android SDK comes with many ready-to-use samples under the webrtc_android_sample_app module. These samples demonstrate different use cases and scenarios for WebRTC streaming.

  • The webrtc_android_sample_app module has three packages:

1. Minimal

  • Contains the simplest PublishActivity, a minimal WebRTC publish sample.

2. Basic

  • Includes multiple samples: publish activity, play activity, screen capture activity, conference activity, data channel only activity, peer activity, and settings.

3. Advanced

  • Provides samples for more complex use cases: conference activity with speaker indicator, MP3 publish activity, MP4 publish activity, MP4 publish with surface activity, multi-track play activity, publish activity with “Are You Speaking”, and USB camera activity.

Getting the Android SDK

The WebRTC Android SDK is free to download. You can download or clone it from the Android SDK Github repository.

After downloading/cloning:

  1. Open the project in Android Studio.

  2. Navigate to the samples:

webrtc-android-sample-app > java > io.antmedia.webrtc_android_sample_app
  1. Connect an Android device to your computer — either an emulator or a physical device. For this guide, a physical device is used.

Run the WebRTC Android SDK

Connecting the Android Device

  1. Connect your Android device and enable Developer Mode.
  2. Enable USB Debugging in the developer options.
  3. In Android Studio, your connected device will appear in the device selector.

connected-device-01

Build and Launch the SDK

  1. Click Run to build the project.

run-sdk-02

  1. Once the build completes, the WebRTC Android Sample App will launch on your device.

launching-app-03

  1. On your device, you will see all the available sample activities:

samples-04-new

WebRTC Android SDK Samples Overview

Settings

  • Enter your Ant Media Server WebSocket URL and Room Name (for conferences).

  • All streams published or played by the samples will connect to this server.

settings-06

Publish Activity

  • Publishes WebRTC streams and includes a data channel.

  • Verify the stream via the Ant Media Server web panel or the embedded player.

publish-sample-07

Play Activity

  • Plays WebRTC streams and also supports the data channel.

play-sample-08

Conference Activity

Supports multi-user video conferences.

Includes Play Only mode and allows enabling/disabling audio and video.

conference-sample-09

Screen Share Activity

  • Demonstrates screen sharing via WebRTC.

  • Supports Screen, Front Camera, and Rear Camera sources.

screen-share-010

screen-variations-011

Data Channel Only Activity

  • Sends arbitrary data between clients over WebRTC.

  • Useful for chat, control messages, or file sharing.

  • Ensure the data channel is enabled in the application settings.

data-channel-012

Stats Activity

  • Displays audio and video stats for published streams.

stats-013

Conference with Speaking Indicator Activity

  • Indicates which participant is currently speaking.

speaker-014

Publish with “Are You Speaking”

  • Shows a warning if the speaker is muted but talking.

Peer Activity

  • Demonstrates peer-to-peer connections.

  • Ant Media Server is used only for signaling; audio/video is sent directly between peers.

peer-015

info

Additional samples include USB Camera, MP3, MP4, MP4 with Surface, and Multi-Track activities.

Android SDK Sample Applications Installation Demo

Congratulations!

You now have access to the full set of WebRTC Android SDK samples.

  • You can explore minimal, basic, and advanced use cases.

  • You can publish and play streams, run conferences, share screens, and experiment with data channels.

  • With these examples, you can quickly build your own custom streaming Android applications.