MrPool
MrPool

Reputation: 401

HLS Exoplayer stream not working on API Level 28

The HLS Stream is unable to play in devices and simulator which are running Android 9.0. The HLS Stream works on other devices and simulators which are running below API Level 28. The app is using the Exoplayer v2 library.

The error in the stack trace is as follows:

E/ExoPlayerImplInternal: Source error.
    com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://streamIP/hls/stream.m3u8
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:194)
        at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:137)
        at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102)
        at com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:65)
        at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:114)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

The current app/build.gradle is as follows:

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 14
        versionName "14.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }...
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0'
    testCompile 'junit:junit:4.12'

    implementation 'com.google.android.exoplayer:exoplayer:r2.5.2'
    implementation 'com.nineoldandroids:library:2.4.0'

    implementation 'com.android.support:multidex:1.0.3'
}

Upvotes: 0

Views: 2472

Answers (1)

Digedag
Digedag

Reputation: 111

Make sure to allow unsecured network connections for Android 9. This is disabled by default.

Checkout this answer.

Upvotes: 3

Related Questions