title: Android Google Exoplayer 2.2 HLS and DASH streaming cache
body: <p>I'm trying to caching HLS and DASH streaming video,
  I have tried many solution but not working with Exoplayer v2.2
  many issue redirect to below links but not getting any proper solution.
  <a href="https://github.com/google/ExoPlayer/issues/420" rel="nofollow noreferrer">https://github.com/google/ExoPlayer/issues/420</a> and <a href="https://stackoverflow.com/questions/28700391/using-cache-in-exoplayer">Using cache in ExoPlayer</a>.</p>
  
  <p>In the one solution 'ExtractorSampleSource' class is not found in Google Exoplayer 2.2</p>
  
  <pre><code>OkHttpClient okHttpClient = new OkHttpClient.Builder().cache(new okhttp3.Cache(context.getCacheDir(), 1024000)).build();
  OkHttpDataSource okHttpDataSource = new OkHttpDataSource(okHttpClient, "android", null);
  OkHttpDataSource ok2 = new OkHttpDataSource(okHttpClient, "android", null);
  HttpDataSource dataSource = new CacheDataSource(context, okHttpDataSource, ok2);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(
                  uri,
                  dataSource,
                  allocator,
                  buffer_segment_count * buffer_segment_size,
                  new Mp4Extractor(), new Mp3Extractor());
  </code></pre>
  
  <p>In other solution got same error 'DefaultUriDataSource' class not found in v2.2 </p>
  
  <pre><code>DataSource dataSource = new DefaultUriDataSource(context, null, new OkHttpDataSource(getClient(context), userAgent, null, null/*, CacheControl.FORCE_CACHE*/));
  </code></pre>
  
  <p>all the solutions are 1 to 2 year older and it's not supported latest version of Google Exoplayer v2.2.  </p>
  
  <p>any one have idea or any sample or any solution to do caching with HLS and DASH stream?</p>