Low level API for SRT library on Android. SRT is an open source transport technology that optimizes streaming performance across unpredictable networks. More information on SRT.
srtdroid is a binder/wrapper for Android built on SRT. It is a not a new implementation of SRT protocol.
For a live streaming SDK based on SRT, go to StreamPack.
Get srtdroid latest artifacts on MavenCentral.
dependencies {
implementation 'io.github.thibaultbee.srtdroid:srtdroid-core:1.8.4'
// If you use Kotlin Coroutines, you can use srtdroid-ktx
implementation 'io.github.thibaultbee.srtdroid:srtdroid-ktx:1.8.4'
}
srtdroid comes with an examples application. Examples are the srtdroid counterpart of SRT examples folder.
On the server side, configure local IP to 0.0.0.0
. On the client side, configure remote IP to
server device IP. The port must be the same value for both.
As srtdroid is a simple wrapper, it provides a minimalist API documentation. For an extensive SRT API documentation refers to the official SRT API documentation.
Srt send
, sendMsg
and sendMsg
are called send()
in srtdroid. Alternatively, you can use
the OutputStream
API. Srt recv
, recvdMsg
are called recv()
in srtdroid. Alternatively, you
can use the InputStream
API.
To use, sendFile
and recvFile
, you need to add READ_EXTERNAL_STORAGE
(
or READ_MEDIA_*
if your app targets Android 13 or higher)
and WRITE_EXTERNAL_STORAGE
to your AndroidManifest.xml
:
<manifest>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- If your app targets Android < 13 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- If your app targets Android >= 13, READ_MEDIA_VIDEO and/or READ_MEDIA_IMAGES and/or READ_MEDIA_AUDIO -->
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
</manifest>
Then, you have to request permissions at runtime.
srtdroid downloads and builds SRT and OpenSSL (ssl and crypto) libraries. The first compilation will take a while.
You have to install make
:
sudo apt-get install build-essential
srtdroid does not build on Windows because OpenSSL is really tricky to compile on Windows.
Not tested.
Copyright 2021 Thibault B.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.