Search in sources :

Example 1 with DefaultDataSource

use of com.google.android.exoplayer2.upstream.DefaultDataSource in project ExoPlayer by google.

the class DefaultDataSourceTest method openRtmpDataSpec_instantiatesRtmpDataSourceViaReflection.

@Test
public void openRtmpDataSpec_instantiatesRtmpDataSourceViaReflection() throws IOException {
    DefaultDataSource dataSource = new DefaultDataSource(ApplicationProvider.getApplicationContext(), "userAgent", /* allowCrossProtocolRedirects= */
    false);
    DataSpec dataSpec = new DataSpec(Uri.parse("rtmp://test.com/stream"));
    try {
        dataSource.open(dataSpec);
    } catch (UnsatisfiedLinkError e) {
    // RtmpDataSource was successfully instantiated (test run using Gradle).
    } catch (UnsupportedOperationException e) {
    // RtmpDataSource was successfully instantiated (test run using Blaze).
    }
}
Also used : DefaultDataSource(com.google.android.exoplayer2.upstream.DefaultDataSource) DataSpec(com.google.android.exoplayer2.upstream.DataSpec) Test(org.junit.Test)

Example 2 with DefaultDataSource

use of com.google.android.exoplayer2.upstream.DefaultDataSource in project NewPipe by TeamNewPipe.

the class CacheFactory method createDataSource.

@Override
public DataSource createDataSource() {
    Log.d(TAG, "initExoPlayerCache: cacheDir = " + cacheDir.getAbsolutePath());
    final DefaultDataSource dataSource = dataSourceFactory.createDataSource();
    final FileDataSource fileSource = new FileDataSource();
    final CacheDataSink dataSink = new CacheDataSink(cache, maxFileSize);
    return new CacheDataSource(cache, dataSource, fileSource, dataSink, CACHE_FLAGS, null);
}
Also used : CacheDataSink(com.google.android.exoplayer2.upstream.cache.CacheDataSink) DefaultDataSource(com.google.android.exoplayer2.upstream.DefaultDataSource) CacheDataSource(com.google.android.exoplayer2.upstream.cache.CacheDataSource) FileDataSource(com.google.android.exoplayer2.upstream.FileDataSource)

Aggregations

DefaultDataSource (com.google.android.exoplayer2.upstream.DefaultDataSource)2 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)1 FileDataSource (com.google.android.exoplayer2.upstream.FileDataSource)1 CacheDataSink (com.google.android.exoplayer2.upstream.cache.CacheDataSink)1 CacheDataSource (com.google.android.exoplayer2.upstream.cache.CacheDataSource)1 Test (org.junit.Test)1