Name Date Size #Lines LOC

..--

src/H25-Apr-2025-879527

README.mdH A D25-Apr-20251.8 KiB5738

build.gradleH A D25-Apr-20251.6 KiB4035

proguard-rules.txtH A D25-Apr-2025294 97

README.md

1# OkHttp DataSource module
2
3This module provides an [HttpDataSource][] implementation that uses Square's
4[OkHttp][].
5
6OkHttp is a modern network stack that's widely used by many popular Android
7applications. It supports the HTTP and HTTP/2 protocols.
8
9[HttpDataSource]: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/HttpDataSource.html
10[OkHttp]: https://square.github.io/okhttp/
11
12## License note
13
14Please note that whilst the code in this repository is licensed under
15[Apache 2.0][], using this extension requires depending on OkHttp, which is
16licensed separately.
17
18[Apache 2.0]: https://github.com/google/ExoPlayer/blob/release-v2/LICENSE
19
20## Getting the module
21
22The easiest way to get the module is to add it as a gradle dependency:
23
24```gradle
25implementation 'com.google.android.exoplayer:extension-okhttp:2.X.X'
26```
27
28where `2.X.X` is the version, which must match the version of the other media
29modules being used.
30
31Alternatively, you can clone this GitHub project and depend on the module
32locally. Instructions for doing this can be found in the [top level README][].
33
34[top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md
35
36## Using the module
37
38Media components request data through `DataSource` instances. These instances
39are obtained from instances of `DataSource.Factory`, which are instantiated and
40injected from application code.
41
42If your application only needs to play http(s) content, using the OkHttp
43extension is as simple as updating any `DataSource.Factory` instantiations in
44your application code to use `OkHttpDataSource.Factory`. If your application
45also needs to play non-http(s) content such as local files, use:
46```
47new DefaultDataSourceFactory(
48    ...
49    /* baseDataSourceFactory= */ new OkHttpDataSource.Factory(...));
50```
51
52## Links
53
54* [Javadoc][]
55
56[Javadoc]: https://exoplayer.dev/doc/reference/index.html
57