|
|
||
|---|---|---|
| .. | ||
| jniLibs | ||
| libs | ||
| src | ||
| build.gradle | ||
| README.md | ||
ExoPlayer Cronet extension
The Cronet extension is an HttpDataSource implementation using Cronet.
Build instructions
To use this extension you need to clone the ExoPlayer repository and depend on its modules locally. Instructions for doing this can be found in ExoPlayer's top level README. In addition, it's necessary to get the Cronet libraries and enable the extension:
- Find the latest Cronet release here and navigate to its
Release/cronetdirectory - Download
cronet_api.jar,cronet_impl_common_java.jar,cronet_impl_native_java.jarand thelibsdirectory - Copy the three jar files into the
libsdirectory of this extension - Copy the content of the downloaded
libsdirectory into thejniLibsdirectory of this extension
- In your
settings.gradlefile, addgradle.ext.exoplayerIncludeCronetExtension = truebefore the line that appliescore_settings.gradle.
Using the extension
ExoPlayer requests data through DataSource instances. These instances are
either instantiated and injected from application code, or obtained from
instances of DataSource.Factory that are instantiated and injected from
application code.
If your application only needs to play http(s) content, using the Cronet
extension is as simple as updating any DataSources and DataSource.Factory
instantiations in your application code to use CronetDataSource and
CronetDataSourceFactory respectively. If your application also needs to play
non-http(s) content such as local files, use
new DefaultDataSource(
...
new CronetDataSource(...) /* baseDataSource argument */);
and
new DefaultDataSourceFactory(
...
new CronetDataSourceFactory(...) /* baseDataSourceFactory argument */);
respectively.
Links
- Javadoc: Classes matching
com.google.android.exoplayer2.ext.cronet.*belong to this module.