Custom UI on exoplayer sample

Customizing the ExoPlayer’s UI is pretty simple. If you look at the ExoPlayer source, the layout res directory contains the file exo_player_control_view.xml that points to (includes) another layout – exo_playback_control_view. Copy the contents of the layout resource – exo_playback_control_view.xml Create a Layout Resource file with any name of your choice – eg: custom_exo_playback_control_view.xml. Paste the … Read more

Quality selector for ExoPlayer 2

Everything you’d like to achieve is viewable in the ExoPlayer2 demo app. More specifically the PlayerActivity class. You can also check out this good article on the topic. The core points you’ll want to look into are around track selection (via the TrackSelector) as well as the TrackSelectionHelper. I’ll include the important code samples below … Read more

Using cache in ExoPlayer

Here is the solution for ExoPlayer 2.+ Create a custom cache data source factory public class CacheDataSourceFactory implements DataSource.Factory { private final Context context; private final DefaultDataSourceFactory defaultDatasourceFactory; private final long maxFileSize, maxCacheSize; public CacheDataSourceFactory(Context context, long maxCacheSize, long maxFileSize) { super(); this.context = context; this.maxCacheSize = maxCacheSize; this.maxFileSize = maxFileSize; String userAgent = Util.getUserAgent(context, … Read more