1# ExoPlayer RTMP extension # 2 3The RTMP extension is a [DataSource][] implementation for playing [RTMP][] 4streams using [LibRtmp Client for Android][]. 5 6[DataSource]: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/DataSource.html 7[RTMP]: https://en.wikipedia.org/wiki/Real-Time_Messaging_Protocol 8[LibRtmp Client for Android]: https://github.com/ant-media/LibRtmp-Client-for-Android 9 10## License note ## 11 12Please note that whilst the code in this repository is licensed under 13[Apache 2.0][], using this extension requires depending on LibRtmp Client for 14Android, which is licensed separately. 15 16[Apache 2.0]: https://github.com/google/ExoPlayer/blob/release-v2/LICENSE 17 18## Getting the extension ## 19 20The easiest way to use the extension is to add it as a gradle dependency: 21 22```gradle 23implementation 'com.google.android.exoplayer:extension-rtmp:2.X.X' 24``` 25 26where `2.X.X` is the version, which must match the version of the ExoPlayer 27library being used. 28 29Alternatively, you can clone the ExoPlayer repository and depend on the module 30locally. Instructions for doing this can be found in ExoPlayer's 31[top level README][]. 32 33[top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md 34 35## Using the extension ## 36 37ExoPlayer requests data through `DataSource` instances. These instances are 38either instantiated and injected from application code, or obtained from 39instances of `DataSource.Factory` that are instantiated and injected from 40application code. 41 42`DefaultDataSource` will automatically use the RTMP extension whenever it's 43available. Hence if your application is using `DefaultDataSource` or 44`DefaultDataSourceFactory`, adding support for RTMP streams is as simple as 45adding a dependency to the RTMP extension as described above. No changes to your 46application code are required. Alternatively, if you know that your application 47doesn't need to handle any other protocols, you can update any `DataSource`s and 48`DataSource.Factory` instantiations in your application code to use 49`RtmpDataSource` and `RtmpDataSourceFactory` directly. 50 51## Links ## 52 53* [Javadoc][]: Classes matching `com.google.android.exoplayer2.ext.rtmp.*` 54 belong to this module. 55 56[Javadoc]: https://exoplayer.dev/doc/reference/index.html 57