HLS Exoplayer流在API级别28上不起作用

时间:2019-03-30 14:25:33

标签: android exoplayer exoplayer2.x

HLS流无法在运行Android 9.0的设备和模拟器中播放。 HLS Stream可在API级别28以下运行的其他设备和模拟器上运行。该应用程序使用Exoplayer v2库。

堆栈跟踪中的错误如下:

switch (pos) {
            case 0:
                // black
                mPaintView.init(paintBitmap, 0x16, 0x16, 0x16);
                break;
            case 1:
                // deep_koamaru
                mPaintView.init(paintBitmap, 35, 54, 104);
                break;
            case 2:
                // pastel_blue
                mPaintView.init(paintBitmap, 160, 195, 210);
                break;
            case 3:
                // lavender_gray
                mPaintView.init(paintBitmap, 190, 190, 209);
                break;
            case 4:
                // queen_pink
                mPaintView.init(paintBitmap, 248, 205, 210);
                break;
            case 5:
                // orange_yellow
                mPaintView.init(paintBitmap, 249, 200, 99);
                break;
            case 6:
                // white
                mPaintView.init(paintBitmap, 255, 255, 255);
                break;
            default:
                return;
}

当前的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) 如下:

app/build.gradle

1 个答案:

答案 0 :(得分:1)

确保为Android 9允许不安全的网络连接。默认情况下,此功能处于禁用状态。

Checkout this answer