Rtmp Player Android using Exo-Media Player

Karthik Ponnam
Aug 9, 2017 · 1 min read

Hello Reader’s, before we start

Lets see What is RTMP ?

RTMP stands for real-time messaging protocol. It provides for high-performance transmission of audio, video, and data from an encoder to a server, which distributes the signal across the Internet. Many streaming providers and encoder developers support RTMP streaming, including Livestream.

read more about rtmp here.

No more Theory lets start coding :-)

Step 1:

change minimum SDK version

defaultConfig {
...
minSdkVersion 15
...
}

because in order to use this extension-rtmp library the minimum sdk needed is 15

edit your build.gradle file and add the following two dependencies

compile 'com.google.android.exoplayer:exoplayer:2.7.3'                       compile 'com.google.android.exoplayer:extension-rtmp:2.7.3'

then sync your project

Step 2:

Create a simple exoplayer view in your layout file

<com.google.android.exoplayer2.ui.PlayerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/simple_player">

</com.google.android.exoplayer2.ui.PlayerView>

Step 3:

Now in your player activity add the lines to prepare the player

Run your code and the rtmp stream will be playing in your app and the size of is approx ~2.5Mb

download the project here.


If you find this article useful please recommend and share.

Karthik Ponnam

Written by

❤️ to Code. Full Stack Developer, Flutter, Android Developer, Web Development, Known Languages Java, Python so on.,

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade