├── screens └── charts.jpg ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── demo ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_banner.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ ├── list_divider.xml │ │ │ ├── track_selection_dialog.xml │ │ │ ├── sample_chooser_activity.xml │ │ │ ├── include_player_stats.xml │ │ │ └── player_activity.xml │ │ └── values │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── android │ │ │ └── exoplayer2 │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── DemoUtil.java │ │ │ ├── CustomLoadControl.java │ │ │ ├── TrackSelectionHelper.java │ │ │ ├── SampleChooserActivity.java │ │ │ ├── EventLogger.java │ │ │ └── PlayerActivity.java │ │ ├── AndroidManifest.xml │ │ └── assets │ │ └── media.exolist.json └── build.gradle ├── .gitignore ├── settings.gradle ├── publish.gradle ├── LICENSE ├── README.md ├── gradlew.bat └── gradlew /screens/charts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/screens/charts.jpg -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | android.useDeprecatedNdk=true 3 | buildDir=buildout 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/drawable-xhdpi/ic_banner.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sriharia/ExoPlayer-StatsForNerds/HEAD/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Mar 13 11:17:14 GMT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Android generated 2 | bin 3 | gen 4 | libs 5 | obj 6 | lint.xml 7 | 8 | # IntelliJ IDEA 9 | .idea 10 | *.iml 11 | *.ipr 12 | *.iws 13 | classes 14 | gen-external-apklibs 15 | 16 | # Eclipse 17 | .project 18 | .classpath 19 | .settings 20 | .checkstyle 21 | .cproject 22 | 23 | # Gradle 24 | .gradle 25 | build 26 | buildout 27 | out 28 | 29 | # Maven 30 | target 31 | release.properties 32 | pom.xml.* 33 | 34 | # Ant 35 | ant.properties 36 | local.properties 37 | proguard.cfg 38 | proguard-project.txt 39 | 40 | # Other 41 | .DS_Store 42 | dist 43 | tmp 44 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Android Open Source Project 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | include ':demo' 15 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/list_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | -------------------------------------------------------------------------------- /publish.gradle: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Android Open Source Project 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | apply plugin: 'bintray-release' 15 | 16 | publish { 17 | artifactId = releaseArtifact 18 | description = releaseDescription 19 | repoName = releaseRepoName 20 | userOrg = releaseUserOrg 21 | groupId = releaseGroupId 22 | version = releaseVersion 23 | website = releaseWebsite 24 | } 25 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/track_selection_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2017] [Srihari Yachamaneni] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /demo/src/main/res/layout/sample_chooser_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Demo app to showcase Google ExoPlayer customisations like player stats extractions, Improved buffering. 2 | 3 | More information on ExoPlayer documentation can be found [here][] 4 | 5 | [here]: http://google.github.io/ExoPlayer/ 6 | 7 | ### Developed by 8 | [Srihari Yachamaneni](https://github.com/Sriharia) ([@srihari_y](https://twitter.com/srihari_y)) 9 | 10 | # Features # 11 | ## Stats for Nerds ## 12 | This demo app depicts ExoPlayer internal stats in dynamic charts using [MPAndroidChart][] library. 13 | These stats include: 14 | 20 | 21 | ![Sample](screens/charts.jpg?raw=true "Demo app stats") 22 | 23 | This is achieved by injecting a listener to a [Customised][] version of [LoadControl][] component of ExoPlayer 24 | 25 | [MPAndroidChart]: https://github.com/PhilJay/MPAndroidChart 26 | [Customised]: 27 | https://github.com/Sriharia/ExoPlayer-StatsForNerds/blob/master/demo/src/main/java/com/google/android/exoplayer2/demo/CustomLoadControl.java 28 | [LoadControl]: https://github.com/google/ExoPlayer/blob/d979469659861f7fe1d39d153b90bdff1ab479cc/library/core/src/main/java/com/google/android/exoplayer2/DefaultLoadControl.java 29 | 30 | ## Improved Buffering ## 31 | This demo also helps you to find a way to change max buffer time by applying "drip-feeding" method. 32 | This is achieved by changing certain parameters in custom LoadControl component of ExoPlayer 33 | 34 | Check [CustomLoadControl][] class for more info on how buffer improvements are handled. 35 | 36 | [CustomLoadControl]: https://github.com/Sriharia/ExoPlayer-StatsForNerds/blob/master/demo/src/main/java/com/google/android/exoplayer2/demo/CustomLoadControl.java 37 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Android Open Source Project 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | apply plugin: 'com.android.application' 15 | 16 | android { 17 | compileSdkVersion project.ext.compileSdkVersion 18 | buildToolsVersion project.ext.buildToolsVersion 19 | 20 | defaultConfig { 21 | minSdkVersion 16 22 | targetSdkVersion project.ext.targetSdkVersion 23 | } 24 | 25 | buildTypes { 26 | release { 27 | shrinkResources true 28 | minifyEnabled true 29 | proguardFiles getDefaultProguardFile('proguard-android.txt') 30 | } 31 | debug { 32 | jniDebuggable = true 33 | } 34 | } 35 | 36 | lintOptions { 37 | // The demo app does not have translations. 38 | disable 'MissingTranslation' 39 | } 40 | 41 | productFlavors { 42 | noExtensions 43 | withExtensions 44 | } 45 | } 46 | 47 | dependencies { 48 | compile fileTree(dir: 'libs', include: ['*.jar']) 49 | compile 'com.google.android.exoplayer:exoplayer:r2.4.0' 50 | // withExtensionsCompile project(path: ':extension-ffmpeg') 51 | // withExtensionsCompile project(path: ':extension-flac') 52 | // withExtensionsCompile project(path: ':extension-opus') 53 | // withExtensionsCompile project(path: ':extension-vp9') 54 | } 55 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/android/exoplayer2/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.android.exoplayer2.demo; 17 | 18 | import android.app.Application; 19 | import com.google.android.exoplayer2.upstream.DataSource; 20 | import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; 21 | import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; 22 | import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; 23 | import com.google.android.exoplayer2.upstream.HttpDataSource; 24 | import com.google.android.exoplayer2.util.Util; 25 | 26 | /** 27 | * Placeholder application to facilitate overriding Application methods for debugging and testing. 28 | */ 29 | public class DemoApplication extends Application { 30 | 31 | protected String userAgent; 32 | 33 | @Override 34 | public void onCreate() { 35 | super.onCreate(); 36 | userAgent = Util.getUserAgent(this, "ExoPlayerDemo"); 37 | } 38 | 39 | public DataSource.Factory buildDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { 40 | return new DefaultDataSourceFactory(this, bandwidthMeter, 41 | buildHttpDataSourceFactory(bandwidthMeter)); 42 | } 43 | 44 | public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { 45 | return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); 46 | } 47 | 48 | public boolean useExtensionRenderers() { 49 | return BuildConfig.FLAVOR.equals("withExtensions"); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/include_player_stats.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 22 | 23 | 24 | 28 | 29 | 33 | 34 | 35 | 43 | 44 | 51 | 52 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | ExoPlayer 20 | 21 | Video 22 | 23 | Audio 24 | 25 | Text 26 | 27 | Retry 28 | 29 | Disabled 30 | 31 | Default 32 | 33 | Default (none) 34 | 35 | Unexpected intent action: %1$s 36 | 37 | Enable random adaptation 38 | 39 | Protected content not supported on API levels below 18 40 | 41 | This device does not support the required DRM scheme 42 | 43 | An unknown DRM error occurred 44 | 45 | This device does not provide a decoder for %1$s 46 | 47 | This device does not provide a secure decoder for %1$s 48 | 49 | Unable to query device decoders 50 | 51 | Unable to instantiate decoder %1$s 52 | 53 | Media includes video tracks, but none are playable by this device 54 | 55 | Media includes audio tracks, but none are playable by this device 56 | 57 | Permission to access storage was denied 58 | 59 | One or more sample lists failed to load 60 | 61 | 62 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/player_activity.xml: -------------------------------------------------------------------------------- 1 | 15 | 21 | 22 | 26 | 27 | 31 | 32 | 41 | 42 | 48 | 49 | 57 | 58 |