1- # StreamPack: RTMP and SRT live streaming SDK for Android
1+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.github.thibaultbee.streampack/streampack-core )] ( https://central.sonatype.com/artifact/io.github.thibaultbee.streampack/streampack-core )
2+ [ ![ License] ( https://img.shields.io/github/license/ThibaultBee/StreamPack )] ( LICENSE.md )
3+ [ ![ API] ( https://img.shields.io/badge/API-21%2B-brightgreen.svg )] ( https://android-arsenal.com/api?level=21 )
4+ [ ![ Stars] ( https://img.shields.io/github/stars/ThibaultBee/StreamPack?style=social )] ( https://github.com/ThibaultBee/StreamPack/stargazers )
25
3- StreamPack is a flexible live streaming library for Android made for both demanding video
4- broadcasters and new video enthusiasts.
6+ # StreamPack — Android Live Streaming SDK (RTMP, SRT, Camera2, Kotlin)
57
6- ## Hop On Board! 🚀
8+ StreamPack is a modular, high-performance Android library designed for low-latency live streaming.
9+ It empowers developers to build professional broadcasting applications with support for SRT, RTMP,
10+ and RTMPS protocols. Leveraging the latest Android Camera2 and MediaCodec APIs, it is fully
11+ extensible, allowing for the integration of custom protocols and custom audio/video sources.
712
8- ⭐ If you like this project, don’t forget to star it!
13+ ## 🏗️ 5-minute Quick Start / Boilerplate
914
10- 💖 Want to support its development? Consider becoming a sponsor.
15+ If you want to create a new application, you should use the
16+ template [ StreamPack boilerplate] ( https://github.com/ThibaultBee/StreamPack-boilerplate ) . In 5
17+ minutes, you will be able to stream live video to your server.
1118
12- 🛠️ Contributions are welcome—feel free to open issues or submit pull requests!
19+ ## Table of Contents
20+
21+ - [ Setup] ( #-setup )
22+ - [ Features] ( #-features )
23+ - [ Quick Start] ( #-quick-start )
24+ - [ Permissions] ( #-permissions )
25+ - [ Documentation] ( #-documentations )
26+ - [ Demos] ( #-demos )
27+ - [ Contributing] ( #-contributing--support )
28+ - [ Tips] ( #-tips )
29+ - [ License] ( #-license )
1330
14- ## Setup
31+ ## 📦 Setup
1532
1633Get StreamPack core latest artifacts on Maven Central:
1734
@@ -31,7 +48,7 @@ dependencies {
3148}
3249```
3350
34- ## Features
51+ ## ✨ Features
3552
3653* Video:
3754 * Source: Cameras, Screen recorder
@@ -61,20 +78,14 @@ dependencies {
6178 * Ultra low-latency based on [ SRT] ( https://github.com/Haivision/srt )
6279 * Network adaptive bitrate mechanism for [ SRT] ( https://github.com/Haivision/srt )
6380
64- ## Quick start
65-
66- If you want to create a new application, you should use the
67- template [ StreamPack boilerplate] ( https://github.com/ThibaultBee/StreamPack-boilerplate ) . In 5
68- minutes, you will be able to stream live video to your server.
69-
70- ## Getting started
81+ ## 🚀 Quick Start
7182
72- ### Getting started for a camera stream
83+ ### 📷 Camera Stream
7384
74851 . Request the required permissions in your Activity/Fragment. See the
7586 [ Permissions] ( #permissions ) section for more information.
7687
77- 2 . Creates a ` View ` to display the preview in your layout
88+ 2 . Create a ` View ` to display the preview in your layout
7889
7990 As a camera preview, you can also use a ` SurfaceView ` , a ` TextureView ` or any
8091 ` View ` where that can provide a ` Surface ` .
@@ -92,7 +103,7 @@ minutes, you will be able to stream live video to your server.
92103
93104 `app:enableZoomOnPinch` is a boolean to enable zoom on pinch gesture.
94105
95- 3. Instantiates the streamer (main live streaming class)
106+ 3. Instantiate the streamer (main live streaming class)
96107
97108 A `Streamer` is a class that represents a whole streaming pipeline from capture to endpoint (
98109 incl. encoding, muxing, sending).
@@ -118,14 +129,20 @@ minutes, you will be able to stream live video to your server.
118129 * }
119130 */
120131 val streamer = cameraSingleStreamer(context = requireContext())
121- // To have multiple independent outputs (like for live and record), use a `cameraDualStreamer` or even the `StreamerPipeline`.
122- // You can also use the `SingleStreamer`or the `DualStreamer` and add later the audio and video source with `setAudioSource`
123- // and `setVideoSource`.
132+ /**
133+ * To have multiple independent outputs (like for live and record), use a `cameraDualStreamer` or even the `StreamerPipeline`.
134+ *
135+ * You can also create the `SingleStreamer`or the `DualStreamer` and add later the audio and video source with `setAudioSource`
136+ * and `setVideoSource`.
137+ * val streamer = SingleStreamer(context = requireContext())
138+ * streamer.setVideoSource(CameraSourceFactory()) // Same as streamer.setCameraId(context.defaultCameraId)
139+ * streamer.setAudioSource(MicrophoneSourceFactory())
140+ */
124141 ```
125142
126143 For more information, check the [Streamers](docs/Streamers.md) documentation.
127144
128- 4. Configures audio and video settings
145+ 4. Configure audio and video settings
129146
130147 ```kotlin
131148 val streamer = cameraSingleStreamer(context = requireContext()) // Already instantiated streamer
@@ -150,7 +167,7 @@ minutes, you will be able to stream live video to your server.
150167 }
151168 ```
152169
153- 5. Inflates the preview with the streamer
170+ 5. Inflate the preview with the streamer
154171
155172 Either `xml` UI
156173
@@ -180,7 +197,7 @@ minutes, you will be able to stream live video to your server.
180197 }
181198 ```
182199
183- 6. Sets the device orientation
200+ 6. Set the device orientation
184201
185202 ```kotlin
186203 // Already instantiated streamer
@@ -228,7 +245,7 @@ minutes, you will be able to stream live video to your server.
228245
229246 You can also create your own `targetRotation` provider.
230247
231- 7. Starts the live streaming
248+ 7. Start the live streaming
232249
233250 ```kotlin
234251 // Already instantiated streamer
@@ -247,7 +264,7 @@ minutes, you will be able to stream live video to your server.
247264 // streamer.startStream("rtmp://serverip:1935/s/streamKey") // For RTMP/RTMPS
248265 ```
249266
250- 8. Stops and releases the streamer
267+ 8. Stop and release the streamer
251268
252269 ```kotlin
253270 // Already instantiated streamer
@@ -263,7 +280,7 @@ the [documentation](#documentations).
263280
264281For a complete example, check out the [demos/camera](demos/camera) directory.
265282
266- ### Getting started for a screen recorder stream
283+ ### 🖥️ Screen recorder stream
267284
2682851. Add the `streampack-services` dependency in your `build.gradle` file:
269286
@@ -273,17 +290,17 @@ For a complete example, check out the [demos/camera](demos/camera) directory.
273290 }
274291 ```
275292
276- 2. Requests the required permissions in your Activity/Fragment. See the
293+ 2. Request the required permissions in your Activity/Fragment. See the
277294 [Permissions](#permissions) section for more information.
278- 3. Creates a `MyService` that extends `MediaProjectionService` (so you can customize
295+ 3. Create a `MyService` that extends `MediaProjectionService` (so you can customize
279296 notifications among other things).
280- 4. Creates a screen record `Intent` and requests the activity result
297+ 4. Create a screen record `Intent` and requests the activity result
281298
282299 ```kotlin
283300 MediaProjectionUtils.createScreenCaptureIntent(context = requireContext())
284301 ```
285302
286- 5. Starts the service
303+ 5. Start the service
287304
288305 ```kotlin
289306 MediaProjectionService.bindService(
@@ -304,7 +321,7 @@ For a complete example, check out the [demos/camera](demos/camera) directory.
304321
305322For a complete example, check out the [demos/screenrecorder](demos/screenrecorder) directory .
306323
307- ## Permissions
324+ ## 🔑 Permissions
308325
309326You need to add the following permissions in your `AndroidManifest.xml`:
310327
@@ -321,7 +338,7 @@ You need to add the following permissions in your `AndroidManifest.xml`:
321338To record locally, you also need to request the following dangerous
322339permission: ` android.permission.WRITE_EXTERNAL_STORAGE ` .
323340
324- ### Permissions for a camera stream
341+ ### Camera stream
325342
326343To use the camera, you need to request the following permission:
327344
@@ -346,7 +363,7 @@ For the PlayStore, your application might declare this in its `AndroidManifest.x
346363</manifest >
347364```
348365
349- ### Permissions for a screen recorder stream
366+ ### Screen recorder stream
350367
351368To use the screen recorder, you need to request the following permission:
352369
@@ -372,15 +389,15 @@ You will also have to declare the `Service`,
372389</application >
373390```
374391
375- ## Documentations
392+ ## 📖 Documentations
376393
377394- [ StreamPack API guide] ( https://thibaultbee.github.io/StreamPack )
378395- Additional documentations are available in the ` docs ` directory:
379396 - [ Live and record simultaneously] ( docs/LiveAndRecordSimultaneously.md )
380397 - [ Streamers] ( docs/Streamers.md )
381398 - [ Streamer elements] ( docs/AdvancedStreamer.md )
382399
383- ## Demos
400+ ## 🎬 Demos
384401
385402### Camera and audio demo
386403
@@ -406,7 +423,7 @@ Tells FFplay to listen on IP `0.0.0.0` and port `1935`.
406423ffplay -listen 1 -i 'rtmp://0.0.0.0:1935/s/streamKey'
407424```
408425
409- On StreamPack sample app settings, set ` Endpoint ` -> ` Type ` to ` Stream to a remove RTMP device ` ,
426+ On StreamPack sample app settings, set ` Endpoint ` -> ` Type ` to ` Stream to a remote RTMP device ` ,
410427then set the server ` URL ` to ` rtmp://serverip:1935/s/streamKey ` . At this point, StreamPack sample
411428app should successfully sends audio and video frames. On FFplay side, you should be able to watch
412429this live stream.
@@ -423,7 +440,15 @@ On StreamPack sample app settings, set the server `IP` to your server IP and ser
423440At this point, StreamPack sample app should successfully sends audio and video frames. On FFplay
424441side, you should be able to watch this live stream.
425442
426- ## Tips
443+ ## 🤝 Contributing & Support
444+
445+ ⭐ If you like this project, don’t forget to star it!
446+
447+ 💖 Want to support its development? Consider becoming a sponsor.
448+
449+ 🛠️ Contributions are welcome—feel free to open issues or submit pull requests!
450+
451+ ## 💡 Tips
427452
428453### RTMP or SRT
429454
@@ -494,7 +519,7 @@ Even if StreamPack sdk supports a `minSdkVersion` 21. I strongly recommend to se
494519` minSdkVersion ` of your application to a higher version (the highest is the best!) for better
495520performance.
496521
497- ## Licence
522+ ## 📄 License
498523
499524 Copyright 2021 Thibault B.
500525
0 commit comments