84 lines
2.1 KiB
Markdown
84 lines
2.1 KiB
Markdown
# ExoPlayer VP9 Extension #
|
|
|
|
## Description ##
|
|
|
|
The VP9 Extension is a [Renderer][] implementation that helps you bundle libvpx
|
|
(the VP9 decoding library) into your app and use it along with ExoPlayer to play
|
|
VP9 video on Android devices.
|
|
|
|
[Renderer]: https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/Renderer.html
|
|
|
|
## Build Instructions ##
|
|
|
|
* Checkout ExoPlayer along with Extensions:
|
|
|
|
```
|
|
git clone https://github.com/google/ExoPlayer.git
|
|
```
|
|
|
|
* Set the following environment variables:
|
|
|
|
```
|
|
cd "<path to exoplayer checkout>"
|
|
EXOPLAYER_ROOT="$(pwd)"
|
|
VP9_EXT_PATH="${EXOPLAYER_ROOT}/extensions/vp9/src/main"
|
|
```
|
|
|
|
* Download the [Android NDK][] and set its location in an environment variable:
|
|
|
|
[Android NDK]: https://developer.android.com/tools/sdk/ndk/index.html
|
|
|
|
```
|
|
NDK_PATH="<path to Android NDK>"
|
|
```
|
|
|
|
* Fetch libvpx and libyuv:
|
|
|
|
```
|
|
cd "${VP9_EXT_PATH}/jni" && \
|
|
git clone https://chromium.googlesource.com/webm/libvpx libvpx && \
|
|
git clone https://chromium.googlesource.com/libyuv/libyuv libyuv
|
|
```
|
|
|
|
* Run a script that generates necessary configuration files for libvpx:
|
|
|
|
```
|
|
cd ${VP9_EXT_PATH}/jni && \
|
|
./generate_libvpx_android_configs.sh "${NDK_PATH}"
|
|
```
|
|
|
|
* Build the JNI native libraries from the command line:
|
|
|
|
```
|
|
cd "${VP9_EXT_PATH}"/jni && \
|
|
${NDK_PATH}/ndk-build APP_ABI=all -j4
|
|
```
|
|
|
|
* In your project, you can add a dependency to the VP9 Extension by using a the
|
|
following rule:
|
|
|
|
```
|
|
// in settings.gradle
|
|
include ':..:ExoPlayer:library'
|
|
include ':..:ExoPlayer:extension-vp9'
|
|
|
|
// in build.gradle
|
|
dependencies {
|
|
compile project(':..:ExoPlayer:library')
|
|
compile project(':..:ExoPlayer:extension-vp9')
|
|
}
|
|
```
|
|
|
|
* Now, when you build your app, the VP9 extension will be built and the native
|
|
libraries will be packaged along with the APK.
|
|
|
|
## Notes ##
|
|
|
|
* Every time there is a change to the libvpx checkout:
|
|
* Android config scripts should be re-generated by running
|
|
`generate_libvpx_android_configs.sh`
|
|
* Clean and re-build the project.
|
|
* If you want to use your own version of libvpx or libyuv, place it in
|
|
`${VP9_EXT_PATH}/jni/libvpx` or `${VP9_EXT_PATH}/jni/libyuv` respectively.
|
|
|