com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException
E Source error. com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 301 at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:311) at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:938) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:394) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) 2024-05-11 17:55:35.483 29443-29443 ExoPlayer com.example.exoplayerdemo E ExoPlaybackException: com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 301 2024-05-11 17:55:35.484 29443-29443 ExoPlayer com.example.exoplayerdemo E ExoPlaybackException: 网络异常
http video was not supported anymore? if i put media source with https , that works for me with no exception.
My guess is that your http:// URL is redirecting to an https:// URL (301 is redirect). This 'cross protocol redirect' is not permitted by default by java.net.HttpURLConnection , which is the HTTP implementation used by DefaultHttpDataSource. It can be enabled with DefaultHttpDataSource.Factory.setAllowCrossProtocolRedirects(boolean) - or you could use a different HTTP implementation: https://developer.android.com/media/media3/exoplayer/network-stacks
Closing due to inactivity