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.72k stars 6.02k forks source link

Problems using RTSP #11160

Closed Darthsandr closed 1 year ago

Darthsandr commented 1 year ago

I'm trying to use the rtsp extension in an android app but I have a problem and I get a black screen without an explicit error. My video url is rtsp://myserver:port/live/test?t=pippo Watching streaming server's logs I see that, during the SETUP phase, the exoplayer client send this url rtsp://myserver:port/live/test/trackID=1?t=pippo while trying the same url with VLC during the same phase the streaming server logs rtsp://myserver:port/live/test/trackID=1 (whitout query parameter of the original url) Is it possible to remove the query parameter in the url sent by exoplayer client for the SETUP session with the streaming server?

I'm using this code

val mediaitem = MediaItem.fromUri(Uri.parse(videoUrl)) val mediaSource = RtspMediaSource.Factory().setForceUseRtpTcp(true).setTimeoutMs(10000) .createMediaSource(mediaItem) mediaSource.addEventListener(mainHandler, mediaSourceEventListener) player?.repeatMode = repatMode player?.setMediaSource(mediaSource ,true) player?.prepare()

Thanks for the response

microkatz commented 1 year ago

Hello @Darthsandr,

Would you be able to provide the responses to the RTSP Describe message that your server is providing?

Also would you be able to provide a bug reports so we can review the logs? You can either attach them to this github issue or send them to dev.exoplayer@gmail.com using a subject in the format "Issue #11160". Please also update this issue to indicate you've done this.

Darthsandr commented 1 year ago

Hello this is the flow between Exoplayer and our streaming servers. We have not an error in the player but the screen remains black.

Exoplayer OPTIONS rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252?t=pippo RTSP/1.0 User-Agent: ExoPlayerLib/2.18.5 CSeq: 0

Streaming Server RTSP/1.0 200 OK CSeq: 0 Server: Wowza Streaming Engine 4.8.20+1 build20220919162035 Cache-Control: no-cache Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD, GET_PARAMETER Supported: play.basic, con.persistent

Exoplayer DESCRIBE rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252?t=pippo RTSP/1.0 User-Agent: ExoPlayerLib/2.18.5 CSeq: 1

Streaming server RTSP/1.0 200 OK CSeq: 1 Server: Wowza Streaming Engine 4.8.20+1 build20220919162035 Cache-Control: no-cache Expires: Thu, 11 May 2023 17:36:55 CEST Content-Length: 640 Content-Base: rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252/ Date: Thu, 11 May 2023 17:36:55 CEST Content-Type: application/sdp Session: 113644209;timeout=60

v=0 o=- 113644209 113644209 IN IP4 127.0.0.1 s=cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252 c=IN IP4 0.0.0.0 t=0 0 a=sdplang:en a=range:npt=now- a=control:* m=audio 0 RTP/AVP 96 a=rtpmap:96 mpeg4-generic/48000/2 a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=119056e500 a=control:trackID=1 m=video 0 RTP/AVP 97 a=rtpmap:97 H264/90000 a=fmtp:97 packetization-mode=1;profile-level-id=42C028;sprop-parameter-sets=Z0LAKNkAeAIn5YQAAAMABAAAAwDAPGDJIA==,aMuDyyA= a=cliprect:0,0,1088,1920 a=framesize:97 1920-1088 a=framerate:24.0 a=control:trackID=2

Exoplayer SETUP rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252/trackID=2?t=pippo RTSP/1.0 User-Agent: ExoPlayerLib/2.18.5 CSeq: 2 Transport: RTP/AVP/TCP;unicast;interleaved=2-3

Streaming server RTSP/1.0 200 OK CSeq: 2 Server: Wowza Streaming Engine 4.8.20+1 build20220919162035 Cache-Control: no-cache Expires: Thu, 11 May 2023 17:36:55 CEST Transport: RTP/AVP/TCP;unicast;interleaved=2-3 Date: Thu, 11 May 2023 17:36:55 CEST Session: 113644209;timeout=60

Exoplayer SETUP rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252/trackID=1?t=pippo RTSP/1.0 User-Agent: ExoPlayerLib/2.18.5 CSeq: 3 Session: 113644209 Transport: RTP/AVP/TCP;unicast;interleaved=0-1

Streaming server RTSP/1.0 200 OK CSeq: 3 Server: Wowza Streaming Engine 4.8.20+1 build20220919162035 Cache-Control: no-cache Expires: Thu, 11 May 2023 17:36:55 CEST Transport: RTP/AVP/TCP;unicast;interleaved=0-1 Date: Thu, 11 May 2023 17:36:55 CEST Session: 113644209;timeout=60

Exoplayer PLAY rtsp://myserver:port/live/test/cfc4257f-523f-4081-b2ac-efee33efe264-af7d354a-9cf2-47c7-a4be-ac794e653252?t=pippo RTSP/1.0 User-Agent: ExoPlayerLib/2.18.5 CSeq: 4 Session: 113644209 Range: npt=0.000-

Streaming server RTSP/1.0 200 OK RTP-Info: url=trackID=1;seq=1;rtptime=119987712,url=trackID=2;seq=1;rtptime=224976960 CSeq: 4 Server: Wowza Streaming Engine 4.8.20+1 build20220919162035 Cache-Control: no-cache Range: npt=now- Session: 113644209;timeout=60

microkatz commented 1 year ago

@Darthsandr

Thank you for reporting your issue! A fix has been submitted to the main branch of androidx/media that should solve your problem. Eventually the fix will be brought into the release branch. Here is a link to the commit. Hopefully this helps!

Darthsandr commented 1 year ago

Hi Thanks for the fix Actually I'm using these implemenmtations:

implementation 'androidx.core:core-ktx:1.9.0' implementation 'com.google.android.exoplayer:exoplayer-rtsp:2.18.5'

need I to update the version of these libraries?

Darthsandr commented 1 year ago

I updated Exoplayer lib but it's still not working; need I the update of android:media lib? Actualy I'm using the androidx.media:media:1.6.0