Rtmp Player Android using Exo-Media Player

Karthik Ponnam
1 min readAug 9, 2017

--

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
Karthik Ponnam

Written by Karthik Ponnam

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