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.74k stars 6.03k forks source link

Cannot play rtsp stream #9544

Open LupuFlaviu opened 3 years ago

LupuFlaviu commented 3 years ago

I've integrated the library in a simple test app where I just want to play a rtsp stream. When I try to play this public rtsp stream (rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast) that uses DIGEST authentication I get a "DESCRIBE 503" error. I've posted some logs below, maybe they are more helpful. Sometimes the stream is played, but most of the times I get the error above. It's very strange. Using rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov works fine. Can someone have a look and point out the problem and possible solutions to fix it? Thank you rtsp-fail.txt

andrewlewis commented 3 years ago

@claincly Please could you take a look?

claincly commented 3 years ago

In general a 5xx error signals some sort of server error.

But in order to investigate on our end,please provide a log of RTSP messages.

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

LupuFlaviu commented 3 years ago

I'm keen to think the same, that the server is the problem but I wanted to double check, maybe something is missing/done wrong in the ExoPlayer. Or does someone have other rtsp streams to share? Preferably with authentication.

I cannot find the setDebugLoggingEnabled() method if I get the dependency from the Google Maven repository. Should I add it as a module of my app? In that case, what branch should I use?

Also I think for best debugging you can simply try to add "rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast" url to your ExoPlayer sample app and try to play the stream. It should give you the same error. Try a few times as it may be the case it works sometimes :)

claincly commented 3 years ago

I'll try the link thanks!

For future reference, this is how to build exoplayer using that factory method:

     SimpleExoPlayer player =
          new ExoPlayer.Builder(/* context= */ this)
              .setMediaSourceFactory(new RtspMediaSource.Factory().setDebugLoggingEnabled(true))
              .build()
LupuFlaviu commented 3 years ago

Got you the logs that you asked for. rtsp-logs-enabled.txt

LupuFlaviu commented 3 years ago

@claincly I also found another possible problem. When using Basic authentication, the header is constructed as "Authorization: QWxhZGRpbjpvcGVuIHNlc2FtZQ==" Shouldn't it be "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" as stated here https://en.wikipedia.org/wiki/Basic_access_authentication ?

NicolasGodfather commented 2 years ago

Should it be: "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", why missing word "Basic" ?