我从Google DAI网址中随机收到403错误。有时整天没问题。有时在开始播放时发生,有时在播放几分钟后发生。这发生在实时流媒体和全屏实时流媒体上。 这是日志:
onLoadError() called with: eventTime = [com.google.android.exoplayer2.analytics.AnalyticsListener$EventTime@c2e375b], loadEventInfo = [com.google.android.exoplayer2.source.MediaSourceEventListener$LoadEventInfo@fed7bf8], mediaLoadData = [com.google.android.exoplayer2.source.MediaSourceEventListener$MediaLoadData@db388d1], error = [com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403], wasCanceled = [false]
ExoAnalyticsLogger: onLoadStarted() called with: eventTime = [com.google.android.exoplayer2.analytics.AnalyticsListener$EventTime@bc71f36], loadEventInfo = [com.google.android.exoplayer2.source.MediaSourceEventListener$LoadEventInfo@90eee37], mediaLoadData = [com.google.android.exoplayer2.source.MediaSourceEventListener$MediaLoadData@d7a5fa4]
ExoPlayerImplInternal: Source error.
com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211)
at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147)
at com.google.android.exoplayer2.source.hls.HlsMediaChunk.loadMedia(HlsMediaChunk.java:267)
at com.google.android.exoplayer2.source.hls.HlsMediaChunk.load(HlsMediaChunk.java:214)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
ExoAnalyticsLogger: onLoadError() called with: eventTime = [com.google.android.exoplayer2.analytics.AnalyticsListener$EventTime@65df8c2], loadEventInfo = [com.google.android.exoplayer2.source.MediaSourceEventListener$LoadEventInfo@fda36d3], mediaLoadData = [com.google.android.exoplayer2.source.MediaSourceEventListener$MediaLoadData@6cfd210], error = [com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403], wasCanceled = [false]
Encountered error
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:349)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211)
at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147)
at com.google.android.exoplayer2.source.hls.HlsMediaChunk.loadMedia(HlsMediaChunk.java:267)
at com.google.android.exoplayer2.source.hls.HlsMediaChunk.load(HlsMediaChunk.java:214)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
答案 0 :(得分:1)
签出this线程来存储cookie。假设您正在使用Akamai网址进行流式传输,则该解决方案为我解决了403问题。
请注意,您需要实施
com.squareup.okhttp3:okhttp-urlconnection:4.6.0
com.google.android.exoplayer:extension-okhttp:2.11.4
获取JavaNetCookieJar和OkHttpDataSourceFactory。
答案 1 :(得分:0)