Search in sources :

Example 1 with DefaultDataSource

use of androidx.media3.datasource.DefaultDataSource in project media by androidx.

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(androidx.media3.datasource.DefaultDataSource) DataSpec(androidx.media3.datasource.DataSpec) Test(org.junit.Test)

Aggregations

DataSpec (androidx.media3.datasource.DataSpec)1 DefaultDataSource (androidx.media3.datasource.DefaultDataSource)1 Test (org.junit.Test)1