ossrs / srs-unity

WebRTC Samples with SRS SFU server for Unity.
https://ossrs.io
MIT License
64 stars 9 forks source link

RTCErrorException with Unity using SrsPlayer #7

Closed christophheich closed 1 year ago

christophheich commented 1 year ago

Hey, unfortunately i am getting an RTC Exception using the SrsPlayer using the following url:

http://localhost:1985/rtc/v1/whep-play/?app=live&stream=livestream

WebRTC: Exchange SDP ok, answer is {"code":0,"server":"vid-3i79c04","service":"6207a0g0","pid":"1","urls":{"api":"the api root","rtc":{"v1":{"play":"Play stream","publish":"Publish stream","nack":"Simulate the NACK"}}}}

RTCErrorException: Expect line: v=

I am using Unity 2021.3.19f1 and SRS 5.

Streaming a RTMP Stream with OBS to SRS and watching it at http://localhost:8080/players/rtc_player.html?schema=http with the following URL (webrtc://localhost/live/livestream) does work fine.

Is there anything else that needs to be done?

Using the following docker run command:

docker run --rm --env CANDIDATE="192.168.178.83" -p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp ossrs/srs:5 objs/srs -c conf/rtmp2rtc.conf
winlinvip commented 1 year ago

Hi, the url /rtc/v1/whep-play is not supported yet, it should be:

http://localhost:1985/rtc/v1/whip-play/?app=live&stream=livestream

Because the PR for WHEP has not been merged yet, see #6

Please follow https://github.com/ossrs/srs-unity#usage-player

christophheich commented 1 year ago

Thank you @winlinvip but when i am using whip-play i am gettin the following error:

[2023-03-05 10:00:39.469][INFO][1][2w88578m] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2023-03-05 10:00:39.469][INFO][1][z769uc36] TCP: disposing #0 resource(HttpConn)(0x60700001dad0), conns=1, disposing=1, zombies=0
[2023-03-05 10:00:41.774][INFO][1][8cz6a82z] HTTP #0 172.17.0.1:36270 GET http://localhost:1985/rtc/v1/whip-play/?app=live&stream=livestream, content-length=-1
[2023-03-05 10:00:41.774][INFO][1][8cz6a82z] RTC whip play /live/livestream, clientip=172.17.0.1, app=live, stream=livestream, offer=0B, eip=, codec=
[2023-03-05 10:00:41.774][INFO][1][8cz6a82z] TCP: before dispose resource(HttpConn)(0x60700001e160), conns=1, zombies=0, ign=0, inz=0, ind=0
[2023-03-05 10:00:41.774][ERROR][1][8cz6a82z][11] serve error code=5018(RtcSdpNegotiate)(RTC do SDP negotiate failed) : process request=0 : mux serve : serve http : serve : remote sdp check failed : now only support BUNDLE, group policy=
thread [1][8cz6a82z]: process_requests() [./src/app/srs_app_http_conn.cpp:206][errno=11]
thread [1][8cz6a82z]: process_request() [./src/app/srs_app_http_conn.cpp:233][errno=11]
thread [1][8cz6a82z]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:765][errno=11]
thread [1][8cz6a82z]: serve_http() [./src/app/srs_app_rtc_api.cpp:666][errno=11]
thread [1][8cz6a82z]: serve_http() [./src/app/srs_app_rtc_api.cpp:188][errno=11]
thread [1][8cz6a82z]: check_remote_sdp() [./src/app/srs_app_rtc_api.cpp:260][errno=11](Resource temporarily unavailable)

image

winlinvip commented 1 year ago

Please note that the offer=0B which means no SDP, so please check your client code, maybe you could try to get the example run first.

christophheich commented 1 year ago

Hey, thank you - i tried it again with the example and still get an issue this time the SDP offer has a value.

[2023-03-06 10:10:07.437][INFO][1][42nvcwup] HTTP #0 172.17.0.1:42702 POST http://localhost:1985/rtc/v1/whip-play/?app=live&stream=livestream, content-length=4638
[2023-03-06 10:10:07.450][INFO][1][42nvcwup] RTC whip play /live/livestream, clientip=172.17.0.1, app=live, stream=livestream, offer=4638B, eip=, codec=
[2023-03-06 10:10:07.450][INFO][1][42nvcwup] ignore attribute=, value=
[2023-03-06 10:10:07.452][INFO][1][42nvcwup] TCP: before dispose resource(HttpConn)(0x607000036f80), conns=2, zombies=0, ign=0, inz=0, ind=0
[2023-03-06 10:10:07.453][ERROR][1][42nvcwup][11] serve error code=5018(RtcSdpNegotiate)(RTC do SDP negotiate failed) : process request=0 : mux serve : serve http : serve : create session, dtls=1, srtp=1, eip= : create session : add player :  : no valid found h264 payload type
thread [1][42nvcwup]: process_requests() [./src/app/srs_app_http_conn.cpp:206][errno=11]
thread [1][42nvcwup]: process_request() [./src/app/srs_app_http_conn.cpp:233][errno=11]
thread [1][42nvcwup]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:765][errno=11]
thread [1][42nvcwup]: serve_http() [./src/app/srs_app_rtc_api.cpp:666][errno=11]
thread [1][42nvcwup]: serve_http() [./src/app/srs_app_rtc_api.cpp:227][errno=11]
thread [1][42nvcwup]: create_session() [./src/app/srs_app_rtc_server.cpp:513][errno=11]
thread [1][42nvcwup]: do_create_session() [./src/app/srs_app_rtc_server.cpp:534][errno=11]
thread [1][42nvcwup]: add_player() [./src/app/srs_app_rtc_conn.cpp:1938][errno=11]
thread [1][42nvcwup]: negotiate_play_capability() [./src/app/srs_app_rtc_conn.cpp:3027][errno=11](Resource temporarily unavailable)

E.g. no valid found h264 payload type i am using OBS to produce the stream which can be viewed in the SRS Player but not using whip.

Any idea why this happens?

Skodeva commented 1 month ago

I have also encountered an issue with H264. Here is my link: https://github.com/ossrs/srs-unity/issues/15

TRANS_BY_GPT4

Skodeva commented 1 month ago

Hey, thank you - i tried it again with the example and still get an issue this time the SDP offer has a value.

[2023-03-06 10:10:07.437][INFO][1][42nvcwup] HTTP #0 172.17.0.1:42702 POST http://localhost:1985/rtc/v1/whip-play/?app=live&stream=livestream, content-length=4638
[2023-03-06 10:10:07.450][INFO][1][42nvcwup] RTC whip play /live/livestream, clientip=172.17.0.1, app=live, stream=livestream, offer=4638B, eip=, codec=
[2023-03-06 10:10:07.450][INFO][1][42nvcwup] ignore attribute=, value=
[2023-03-06 10:10:07.452][INFO][1][42nvcwup] TCP: before dispose resource(HttpConn)(0x607000036f80), conns=2, zombies=0, ign=0, inz=0, ind=0
[2023-03-06 10:10:07.453][ERROR][1][42nvcwup][11] serve error code=5018(RtcSdpNegotiate)(RTC do SDP negotiate failed) : process request=0 : mux serve : serve http : serve : create session, dtls=1, srtp=1, eip= : create session : add player :  : no valid found h264 payload type
thread [1][42nvcwup]: process_requests() [./src/app/srs_app_http_conn.cpp:206][errno=11]
thread [1][42nvcwup]: process_request() [./src/app/srs_app_http_conn.cpp:233][errno=11]
thread [1][42nvcwup]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:765][errno=11]
thread [1][42nvcwup]: serve_http() [./src/app/srs_app_rtc_api.cpp:666][errno=11]
thread [1][42nvcwup]: serve_http() [./src/app/srs_app_rtc_api.cpp:227][errno=11]
thread [1][42nvcwup]: create_session() [./src/app/srs_app_rtc_server.cpp:513][errno=11]
thread [1][42nvcwup]: do_create_session() [./src/app/srs_app_rtc_server.cpp:534][errno=11]
thread [1][42nvcwup]: add_player() [./src/app/srs_app_rtc_conn.cpp:1938][errno=11]
thread [1][42nvcwup]: negotiate_play_capability() [./src/app/srs_app_rtc_conn.cpp:3027][errno=11](Resource temporarily unavailable)

E.g. no valid found h264 payload type i am using OBS to produce the stream which can be viewed in the SRS Player but not using whip.

Any idea why this happens?

Have you solved the problem? Thank you