google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.75k stars 6.03k forks source link

rtsp redirect error #9603

Open blantian opened 3 years ago

blantian commented 3 years ago

The document says that exoplayer supports redirection. Why does it report the following error?

This is my rtsp source: rtsp://10.255.27.28/PLTV/88888909/224/3221225773/10000100000000060000000000006032_0.smil?rrsip=10.255.27.25&icpid=&accounttype=1&limitflux=-1&limitdur=-1&tenantId=8601&accountinfo=%2C28252%2C172.25.116.120%2C20211021153443%2C04710001000000050000000000000227%2Caff1a051696a99f9cf19a66579021027387546%2C-1%2C0%2C1%2C%2C%2C7%2C9764%2C%2C%2C4%2C%2CEND&GuardEncType=2&it=H4sIAAAAAAAAAE2OwQ6CMBBE_6bHhmIxcOgJY2Ji0ET0aga6VEKh2KKJfy8YDh72MJv3JjN51HTYKZFWWZpRpsVWyDimtEGzEVJGkEkqkLFAz8KpmNWwth1M4fSi3S75XUQ8TpL5uIgkK5fCvYVR0Y8tXn1Ffg2zeCH_bmtSOjT8jcBhjCeDqXUDP1t8rt6uCKNyHTe8rGXTEkqEbn6wB0Lu-hGe9NGZH6ca2EBsRN3BUIGe_ryT1_OIL9uVm3DtAAAA

My Androidstudio logcat: E/ExoPlayerImplInternal: Playback error com.google.android.exoplayer2.ExoPlaybackException: Source error at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) Caused by: java.io.IOException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspMediaPeriod$InternalListener.onSessionTimelineRequestFailed(RtspMediaPeriod.java:562) at com.google.android.exoplayer2.source.rtsp.RtspClient.dispatchRtspError(RtspClient.java:261) at com.google.android.exoplayer2.source.rtsp.RtspClient.access$500(RtspClient.java:66) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:459) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136)  at android.os.HandlerThread.run(HandlerThread.java:61)  Caused by: com.google.android.exoplayer2.source.rtsp.RtspMediaSource$RtspPlaybackException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:461) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420)  at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.os.HandlerThread.run(HandlerThread.java:61) 

claincly commented 3 years ago

Please confirm the ExoPlayer version you are using.

Please also provide a log of RTSP messages.

The easiest way is to use the RtspMediaSource.Factory method setDebugLoggingEnabled()

That is, set the media source factory when building the ExoPlayer instance, like this:

     SimpleExoPlayer player =
          new ExoPlayer.Builder(/* context= */ this)
              .set... // all other customization
              .setMediaSourceFactory(new RtspMediaSource.Factory().setDebugLoggingEnabled(true))
              .build()
blantian commented 3 years ago

ExoPlayer version is 2.15.1.

Android: `android { compileSdk 29

defaultConfig {
    applicationId "com.lt.exoplayer"
    minSdk 18
    targetSdk 29
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}`

I used it like this: player = new SimpleExoPlayer.Builder(context).build(); player.setMediaSource(CreateMediaSource.getSource(rtspMongol)); player.addAnalyticsListener(new EventLogger(null)); playerControlView.setPlayer(player); // Prepare the player with the dash media source. player.prepare();

Then encountered an error: Add the log after addAnalyticsListener(new EventLogger(null))

2021-10-26 10:20:01.584 31639-31639/com.lt.exoplayer I/oplus.android.OplusFrameworkFactoryImpl: get feature:IOplusScreenModeFeature 2021-10-26 10:20:01.584 31639-31639/com.lt.exoplayer I/oplus.android.OplusFrameworkFactoryImpl: getOplusScreenModeFeature 2021-10-26 10:20:01.594 31639-31639/com.lt.exoplayer E/libc: Access denied finding property "ro.odm.prev.product.name" 2021-10-26 10:20:01.597 31639-31639/com.lt.exoplayer D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar 2021-10-26 10:20:01.731 31639-31639/com.lt.exoplayer I/Perf: Connecting to perf service. 2021-10-26 10:20:01.737 31639-31639/com.lt.exoplayer D/NetworkSecurityConfig: No Network Security Config specified, using platform default 2021-10-26 10:20:01.737 31639-31639/com.lt.exoplayer D/NetworkSecurityConfig: No Network Security Config specified, using platform default 2021-10-26 10:20:01.738 31639-31639/com.lt.exoplayer I/MultiDex: VM with version 2.1.0 has multidex support 2021-10-26 10:20:01.738 31639-31639/com.lt.exoplayer I/MultiDex: Installing application 2021-10-26 10:20:01.738 31639-31639/com.lt.exoplayer I/MultiDex: VM has multidex support, MultiDex support library is disabled. 2021-10-26 10:20:01.772 31639-31639/com.lt.exoplayer I/oplus.android.OplusFrameworkFactoryImpl: getOplusRedPacketManager 2021-10-26 10:20:01.818 31639-31639/com.lt.exoplayer W/om.lt.exoplaye: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) 2021-10-26 10:20:01.818 31639-31639/com.lt.exoplayer W/om.lt.exoplaye: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) 2021-10-26 10:20:01.819 31639-31639/com.lt.exoplayer E/OplusCustomizeRestrictionManager: sInstance is null, start a new sInstance 2021-10-26 10:20:01.910 31639-31639/com.lt.exoplayer W/om.lt.exoplaye: Accessing hidden method Landroid/media/AudioTrack;->getLatency()I (greylist, reflection, allowed) 2021-10-26 10:20:01.918 31639-31639/com.lt.exoplayer I/ExoPlayerImpl: Init f815a4c [ExoPlayerLib/2.15.1] [OnePlus9R, LE2100, OnePlus, 30] 2021-10-26 10:20:01.925 31639-31639/com.lt.exoplayer D/AudioManager: getStreamVolume packageName=com.lt.exoplayer, index=12, streamType=3 2021-10-26 10:20:01.938 31639-31639/com.lt.exoplayer D/EventLogger: state [eventTime=0.00, mediaPos=0.00, window=0, BUFFERING] 2021-10-26 10:20:01.944 31639-31639/com.lt.exoplayer D/OplusInputMethodUtil: init DEBUG to false, update DEBUG_IME to false 2021-10-26 10:20:01.947 31639-31639/com.lt.exoplayer I/OplusSlideAnimOptHelper: checkListMode: is blacklist mode = false 2021-10-26 10:20:01.953 31639-31639/com.lt.exoplayer I/OplusFeatureCache: Milliseconds spent on init(): 6 2021-10-26 10:20:01.954 31639-31639/com.lt.exoplayer D/OplusSlideAnimOptHelper: com.lt.exoplayer scrollEffectOpt enable = false 2021-10-26 10:20:01.955 31639-31639/com.lt.exoplayer D/OplusViewRootUtil: initSwipState, isDisplayCompatApp false 2021-10-26 10:20:01.955 31639-31639/com.lt.exoplayer D/OplusViewRootUtil: mScreenHeight 2400, mScreenWidth 1080 2021-10-26 10:20:01.956 31639-31639/com.lt.exoplayer D/WindowManager: Add to mViews: DecorView@9d4d58b[MainActivity],pkg= com.lt.exoplayer 2021-10-26 10:20:01.970 31639-31639/com.lt.exoplayer I/TetheringManager: registerTetheringEventCallback:com.lt.exoplayer 2021-10-26 10:20:01.993 31639-31676/com.lt.exoplayer I/AdrenoGLES-0: QUALCOMM build : 191610ae03, Ic907de5ed0 Build Date : 09/17/20 OpenGL ES Shader Compiler Version: EV031.32.02.01 Local Branch : Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.9.12.10.00.00.582.274 Remote Branch : NONE Reconstruct Branch : NOTHING 2021-10-26 10:20:01.993 31639-31676/com.lt.exoplayer I/AdrenoGLES-0: Build Config : S P 10.0.5 AArch64 2021-10-26 10:20:01.993 31639-31676/com.lt.exoplayer I/AdrenoGLES-0: Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so 2021-10-26 10:20:01.996 31639-31676/com.lt.exoplayer I/AdrenoGLES-0: PFP: 0x016dd091, ME: 0x00000000 2021-10-26 10:20:01.998 31639-31639/com.lt.exoplayer D/EventLogger: surfaceSize [eventTime=0.06, mediaPos=0.00, window=0, period=0, 1080, 2129] 2021-10-26 10:20:02.038 31639-31639/com.lt.exoplayer D/EventLogger: loading [eventTime=0.10, mediaPos=0.00, window=0, period=0, true] 2021-10-26 10:20:02.039 31639-31639/com.lt.exoplayer D/EventLogger: timeline [eventTime=0.10, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE 2021-10-26 10:20:02.039 31639-31639/com.lt.exoplayer D/EventLogger: period [?] 2021-10-26 10:20:02.039 31639-31639/com.lt.exoplayer D/EventLogger: window [?, seekable=false, dynamic=false] 2021-10-26 10:20:02.039 31639-31639/com.lt.exoplayer D/EventLogger: ] 2021-10-26 10:20:02.040 31639-31685/com.lt.exoplayer E/ExoPlayerImplInternal: Playback error com.google.android.exoplayer2.ExoPlaybackException: Source error at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:263) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.io.IOException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspMediaPeriod$InternalListener.onSessionTimelineRequestFailed(RtspMediaPeriod.java:562) at com.google.android.exoplayer2.source.rtsp.RtspClient.dispatchRtspError(RtspClient.java:261) at com.google.android.exoplayer2.source.rtsp.RtspClient.access$500(RtspClient.java:66) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:459) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:263)  at android.os.HandlerThread.run(HandlerThread.java:67)  Caused by: com.google.android.exoplayer2.source.rtsp.RtspMediaSource$RtspPlaybackException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:461) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420)  at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source:4)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:263)  at android.os.HandlerThread.run(HandlerThread.java:67)  2021-10-26 10:20:02.051 31639-31639/com.lt.exoplayer E/EventLogger: playerFailed [eventTime=0.12, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_IO_UNSPECIFIED com.google.android.exoplayer2.ExoPlaybackException: Source error at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:263) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.io.IOException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspMediaPeriod$InternalListener.onSessionTimelineRequestFailed(RtspMediaPeriod.java:562) at com.google.android.exoplayer2.source.rtsp.RtspClient.dispatchRtspError(RtspClient.java:261) at com.google.android.exoplayer2.source.rtsp.RtspClient.access$500(RtspClient.java:66) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:459) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:263)  at android.os.HandlerThread.run(HandlerThread.java:67)  Caused by: com.google.android.exoplayer2.source.rtsp.RtspMediaSource$RtspPlaybackException: DESCRIBE 302 at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:461) at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$com-google-android-exoplayer2-source-rtsp-RtspClient$MessageListener(RtspClient.java:420)  at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(Unknown Source:4)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:263)  at android.os.HandlerThread.run(HandlerThread.java:67)  ] 2021-10-26 10:20:02.051 31639-31639/com.lt.exoplayer D/EventLogger: loading [eventTime=0.12, mediaPos=0.00, window=0, period=0, false] 2021-10-26 10:20:02.051 31639-31639/com.lt.exoplayer D/EventLogger: state [eventTime=0.12, mediaPos=0.00, window=0, period=0, IDLE] 2021-10-26 10:20:03.504 31639-31656/com.lt.exoplayer W/System: A resource failed to call close.

claincly commented 3 years ago

Please provide RTSP messages.

You need to change this line player.setMediaSource(CreateMediaSource.getSource(rtspMongol)); so that the RTSP media source is created with the flag debug logging turned on.

blantian commented 3 years ago

Sorry, I took out that part

public class CreateMediaSource { @Nullable public static RtspMediaSource getSource(String uri){ return new RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri(uri)); } }

Take a look, where do I add the logging, the complete code looks like this:

player = new SimpleExoPlayer.Builder(context).build(); player.setMediaSource(new RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri(rtspMongol))); player.addAnalyticsListener(new EventLogger(null)); playerControlView.setPlayer(player); // Prepare the player with the dash media source. player.prepare();