Cannot find symbol `ResolvingDataSource` from com.google.android.exoplayer2.upstream.ResolvingDataSource

huangapple go评论64阅读模式
英文:

Cannot find symbol `ResolvingDataSource` from com.google.android.exoplayer2.upstream.ResolvingDataSource

问题

Title says it all. ExoPlayer should have this. Just look at this page: link

But when I import:

import com.google.android.exoplayer2.upstream.ResolvingDataSource

at the top of my class, it lights up with a red underline. And when I try to do:

HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(
    new ResolvingDataSource.Factory(
        new DefaultHttpDataSourceFactory(Util.getUserAgent(this, getString(R.string.app_name))),
        // Provide just-in-time URI resolution logic.
        (DataSpec dataSpec) -> dataSpec.withUri(resolveUri(dataSpec.uri))
    )
).createMediaSource(Uri.parse(link));

ReolvingDataSource also lights up with a red underline. I also have this in my app build.gradle:

implementation 'com.google.android.exoplayer:exoplayer:2.9.1'

Can anyone help?

英文:

Title says it all. ExoPlayer should have this. Just look at this page: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/ResolvingDataSource.html

But when I import import com.google.android.exoplayer2.upstream.ResolvingDataSource at the top of my class it lights up with red underline. And when I try to do:

HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(
                new ResolvingDataSource.Factory(
                    new DefaultHttpDataSourceFactory(Util.getUserAgent(this,getString(R.string.app_name))),
                    // Provide just-in-time URI resolution logic.
                    (DataSpec dataSpec) -> dataSpec.withUri(resolveUri(dataSpec.uri))
                )
            ).createMediaSource(Uri.parse(link));

ReolvingDataSource lights up with red underline. I also have this in my app build.gradel:
implementation 'com.google.android.exoplayer:exoplayer:2.9.1'

Can anyone help?

答案1

得分: 1

请将库更新到最新版本2.11.8

implementation 'com.google.android.exoplayer:exoplayer:2.11.8';

第三方库经常发生变化,因此请随时关注其官方网站。

英文:

Please update the library to latest version 2.11.8:

implementation 'com.google.android.exoplayer:exoplayer:2.11.8'

Third party libraries always change, so keep track its official sites.

huangapple
  • 本文由 发表于 2020年8月25日 02:42:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/63566911.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定