• Stars
    star
    471
  • Rank 93,216 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Native RTMP client for publishing and playing video streams for Android

Please submit your issues on Ant-Media-Server

LiveVideoBroadcaster

Native Android app that can broadcast and play live video via RTMP - It is developed by Ant Media

How to Develop a Live Streaming Mobile App in 3 Steps?

Developing a live streaming mobile app is not a very quick and easy job if you develop every piece on your own. It requires extensive knowledge about video streaming etc. so you may prefer to find some libraries and samples that makes this job easy. Yeah in this post, we are going to tell how to develop a live streaming app by providing sample codes on Github.

Let's make it easy, you can develop a live streaming app in 3 general steps.

Step 1: Get a Media Server

First of all, a live stream should be sent to a media server that can distributes the live stream to subscribers in real time so a media server should be running in somewhere like Amazon AWS, Google Cloud, IBM Bluemix or in any other infrastructure. You may even use your own local computer to first test the app.

Anyway, there are media servers you can purchase licence, fortunately you do not need to pay anything and you can download Ant Media Server Community Edition at antmedia.io. Ant Media Server can distribute live stream in RTMP, RTSP and HLS formats. Moreover, it records live streams in MP4 format. It means your live streams and recorded streams can play in both all mobile and desktop browsers.

After you download Ant Media Server, extract it and run the start.sh file in your computer.

./start.sh

When you run this command, Ant Media Server starts with printing some logs. At this stage, please learn your computer IP address and save it somewhere. We will use this address later.

Step 2: Broadcast Live Stream from Your Mobile Device

Yeah at this stage needs very specific knowledge luckily, we make it so simple that you do not need to know about encoding and packaging, you just need to call some functions. Nevertheless, I should say some technical issues. Here they are...

H264 Hardware Encoders are used to encode the camera preview. It runs on Android 4.3 and above. Using hardware encoders make the mobile app very small and efficient. RTMP protocol is used to send the live stream to Media Server. We have used librtmp library to handle this issue. FLV format is used to send live stream to Media Server via RTMP protocol. This technical details are enough at this stage. So let's make hands dirty.

Please clone this repository https://github.com/ant-media/LiveVideoBroadcaster

git clone https://github.com/ant-media/LiveVideoBroadcaster.git

After you clone the sample, please open the project with Android Studio and write your own media server IP address to RTMP_BASE_URL field on MainActivity.java file.

Build and Run the app, you need to see below screen

Click Live Video Broadcaster button and you should see this screen.

Write a stream name like "test" to edit text and press the button. You should see below screen.

Right now, you are broadcasting live stream to media server. Any subscriber can now watch your live stream via media server.

Step 3: Play Live Stream On your Mobile Device

Playing a live stream on your android is not a hard thing to accomplish if your media server supports, RTSP or HLS. Fortunately, Ant Media Server supports both of them however, if you want to have low latency in live stream, it would be better to use RTMP so that we have added RTMP play functionality to ExoPlayer, moreover this player is already integrated to our sample. You just need to run LiveVideoBroadcaster app on any other android device.

When you run it, please click the Live Video player at this time. You should see a black screen like below.

Write down the same stream name you have used in Step 2 and press Play button. You should now watch the live stream that your other Android device broadcasts on your device.

Congratulations, that's all. If you have any question or need to get support (private or enterprise) please contact us antmedia.io.

More Repositories

1

Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
Java
4,275
star
2

LibRtmp-Client-for-Android

It is probably the smallest(~60KB, fat version ~300KB) rtmp client for android. It calls librtmp functions over JNI interface
C
633
star
3

StreamApp

Streaming application for Ant Media Server
JavaScript
62
star
4

videojs-webrtc-plugin

Webrtc plug-in for videojs
JavaScript
52
star
5

WebRTC-Flutter-SDK

Ant Media Server WebRTC Flutter SDK
Dart
39
star
6

WebRTC-React-Native-SDK

Ant Media Server WebRTC React Native SDK and Reference Project
TypeScript
26
star
7

Scripts

Auxiliary Shell Scripts
Shell
17
star
8

WebRTC-Android-SDK

Ant Media Server WebRTC Android SDK and Reference Project
Java
13
star
9

conference-call-application

Conference Call Application over Ant Media Server
JavaScript
11
star
10

spaceport-web-player

JavaScript
10
star
11

ConferenceApp

Conference Application For Ant Media Server
JavaScript
9
star
12

Ant-Media-Management-Console

Ant Media Management Console written in Angular to create, publish and play streams
HTML
8
star
13

iOSRTMPReferenceApp

Swift
8
star
14

WebRTC-iOS-SDK

Ant Media Server iOS WebRTC SDK
Objective-C
7
star
15

Plugins

Plugins for Ant Media Server
JavaScript
7
star
16

sora-unity-sdk

C++
4
star
17

sora-unity-sdk-samples

Sora Unity SDK Sample project for Ant Media Server
C#
3
star
18

utilities

Shell
2
star
19

WebRTCEmbeddedSDKReference

Reference project to show how Embedded SDK is used
C++
2
star
20

helm

Shell
2
star
21

ant-media-documentation

Documentation for Ant Media Server.
JavaScript
2
star
22

TunaDesk

TunaDesk is a Remote Desktop Control application running in Ant Media Server
JavaScript
2
star
23

SamplePlugin

This is a sample plugin project for Ant Media Server
Java
1
star
24

WebRTC-Unity-SDK

WebRTC Unity SDK for Ant Media Server
C#
1
star