olly 2a8eb5a2a1 Make it easier to use ExoPlayer modules in other projects
It's currently difficult to use ExoPlayer modules in other gradle
projects because they rely on constants and dependencies defined
in our own top level gradle file. This change moves the constants
into a separate file referenced directly from each module. It also
removes the need for the top level gradle file to declare a
dependency on com.novoda:bintray-release. This is now only needed
if "exoplayerPublishEnabled = true" is specified.

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160272072
2017-06-28 22:26:05 +01:00
..
2017-06-06 16:38:45 +01:00
2017-01-13 17:27:25 +00:00
2016-07-15 18:00:32 +01:00

ExoPlayer Opus Extension

Description

The Opus Extension is a Renderer implementation that helps you bundle libopus (the Opus decoding library) into your app and use it along with ExoPlayer to play Opus audio on Android devices.

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)"
OPUS_EXT_PATH="${EXOPLAYER_ROOT}/extensions/opus/src/main"
  • Download the Android NDK and set its location in an environment variable:
NDK_PATH="<path to Android NDK>"
  • Fetch libopus:
cd "${OPUS_EXT_PATH}/jni" && \
git clone https://git.xiph.org/opus.git libopus
  • Run the script to convert arm assembly to NDK compatible format:
cd ${OPUS_EXT_PATH}/jni && ./convert_android_asm.sh
  • Build the JNI native libraries from the command line:
cd "${OPUS_EXT_PATH}"/jni && \
${NDK_PATH}/ndk-build APP_ABI=all -j4
  • In your project, you can add a dependency to the Opus Extension by using a rule like this:
// in settings.gradle
include ':..:ExoPlayer:library'
include ':..:ExoPlayer:extension-opus'

// in build.gradle
dependencies {
    compile project(':..:ExoPlayer:library')
    compile project(':..:ExoPlayer:extension-opus')
}
  • Now, when you build your app, the Opus extension will be built and the native libraries will be packaged along with the APK.

Notes

  • Every time there is a change to the libopus checkout:
    • Arm assembly should be converted by running convert_android_asm.sh
    • Clean and re-build the project.
  • If you want to use your own version of libopus, place it in ${OPUS_EXT_PATH}/jni/libopus.