Playing UDP, RTP stream using Exoplayer2

Jatin Mishra
1 min readNov 27, 2019

Photo by O12 on Unsplash

Hello, this is a simple and minimal code example to play UDP, RTP stream videos using ExoPlayer 2.

Please find useful resources regarding Network streaming and Exoplayer 2 at the end of the article.

Step 1:

Add INTERNET permission in the manifest file.

<uses-permission android:name=”android.permission.INTERNET” />

Step 2:

Add exoplayer 2 dependencies in your app’s build.gradle file.

implementation ‘com.google.android.exoplayer:exoplayer:2.10.0’

Note: use the latest exoplayer version when using the example.

Step 3:

Create a simple playerview in your layout file.

<com.google.android.exoplayer2.ui.PlayerViewandroid:id=”@+id/player_view”android:layout_width=”match_parent”android:layout_height=”wrap_content” />

Step 4:

Add the following code to initialize defaults and play the UDP stream.

Useful resources:

1. UDP (Wikipedia)- https://en.wikipedia.org/wiki/User_Datagram_Protocol

2. What is UDP https://searchnetworking.techtarget.com/definition/UDP-User-Datagram-Protocol

3. Exoplayer 2 https://exoplayer.dev/hello-world.html

4. Exoplayer 2 (Github)https://github.com/google/ExoPlayer

Photo by Yancy Min on Unsplash

Please check out the complete project on GitHub

Thanks.

Sign up to discover human stories that deepen your understanding of the world.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Jatin Mishra
Jatin Mishra

Written by Jatin Mishra

Senior iOS Engineer with 6+ years of experience, specializing in high-performance app development and architecture optimization. Join me for special insights.

No responses yet

Write a response