英文:
I am using ExoPlayer 2.16.1 and I cannot import DefaultHttpDataSource
问题
我在我的项目中遇到了一个错误,错误信息是"java.lang.IllegalArgumentException: no TLS versions for cleartext connections",我需要使用"DefaultHttpDataSourceFactory"来修复它,但我无法导入它。
我的ExoPlayer版本:
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-core:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.16.1'
我在哪里使用"DefaultHttpDataSourceFactory":
DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(
Util.getUserAgent(context, "your-application-name"),
null /* listener */,
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
true /* allowCrossProtocolRedirects */
);
权限:
<uses-permission tools:node="merge" android:name="android.permission.INTERNET" />
应用程序标签:
<application
.
.
.
android:usesCleartextTraffic="true"
.
.
.
>
英文:
I'm getting an error like "java.lang.IllegalArgumentException: no TLS versions for cleartext connections" in my project and I need to use "DefaultHttpDataSourceFactory" to fix it, but I can't import it.
My ExoPlayer version:
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-core:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.16.1'
Where I use "DefaultHttpDataSourceFactory":
DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(
Util.getUserAgent(context, "your-application-name"),
null /* listener */,
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
true /* allowCrossProtocolRedirects */
);
Permissions:
<uses-permission tools:node="merge" android:name="android.permission.INTERNET" />
Application tag:
<application
.
.
.
android:usesCleartextTraffic="true"
.
.
.>
答案1
得分: 1
已删除在 2.16.0
版本中。
请使用 DefaultHttpDataSource.Factory
替代。
英文:
It was removed in 2.16.0
.
Use DefaultHttpDataSource.Factory
instead.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论