Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 03-May-2024 | - | 737 | 417 | ||
README.md | D | 03-May-2024 | 2.1 KiB | 65 | 47 | |
build.gradle | D | 03-May-2024 | 2.1 KiB | 58 | 50 | |
proguard-rules.txt | D | 03-May-2024 | 294 | 9 | 7 |
README.md
1# ExoPlayer OkHttp extension # 2 3The OkHttp extension is an [HttpDataSource][] implementation using Square's 4[OkHttp][]. 5 6[HttpDataSource]: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/HttpDataSource.html 7[OkHttp]: https://square.github.io/okhttp/ 8 9## License note ## 10 11Please note that whilst the code in this repository is licensed under 12[Apache 2.0][], using this extension requires depending on OkHttp, which is 13licensed separately. 14 15[Apache 2.0]: https://github.com/google/ExoPlayer/blob/release-v2/LICENSE 16 17## Getting the extension ## 18 19The easiest way to use the extension is to add it as a gradle dependency: 20 21```gradle 22implementation 'com.google.android.exoplayer:extension-okhttp:2.X.X' 23``` 24 25where `2.X.X` is the version, which must match the version of the ExoPlayer 26library being used. 27 28Alternatively, you can clone the ExoPlayer repository and depend on the module 29locally. Instructions for doing this can be found in ExoPlayer's 30[top level README][]. 31 32[top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md 33 34## Using the extension ## 35 36ExoPlayer requests data through `DataSource` instances. These instances are 37either instantiated and injected from application code, or obtained from 38instances of `DataSource.Factory` that are instantiated and injected from 39application code. 40 41If your application only needs to play http(s) content, using the OkHttp 42extension is as simple as updating any `DataSource`s and `DataSource.Factory` 43instantiations in your application code to use `OkHttpDataSource` and 44`OkHttpDataSourceFactory` respectively. If your application also needs to play 45non-http(s) content such as local files, use 46``` 47new DefaultDataSource( 48 ... 49 new OkHttpDataSource(...) /* baseDataSource argument */); 50``` 51and 52``` 53new DefaultDataSourceFactory( 54 ... 55 new OkHttpDataSourceFactory(...) /* baseDataSourceFactory argument */); 56``` 57respectively. 58 59## Links ## 60 61* [Javadoc][]: Classes matching `com.google.android.exoplayer2.ext.okhttp.*` 62 belong to this module. 63 64[Javadoc]: https://exoplayer.dev/doc/reference/index.html 65