I've been following this tutorial : https://antmedia.io/webrtc-streaming-in-unity/ in order to try and receive a WebRTC stream into unity.
I've downloaded the https://github.com/ant-media/WebRTC-Unity-SDK WebRTC unity SDK.
I created a Ant Server on Linode and broadcast into it using OBS.
The unity sample does not look like the one in the tutorial/
I opened the AMSStreaming scene In Unity, and modified the url in the AMSStreaming script to point to my server : "ws://my_server_ip:5080/WebRTCApp/websocket"
and provided the WebRTCClient with the correct stream id and url.
I left the stun server to the default stun server address : stun:stun.l.google.com:19302
Running the sample, I set the comboBox to "Play" and click "Start".
The connection works fine and
else if(mode == MODE_PLAY) {
webRTClient.Play();
gets executed.
However nothing else happens, no RTCTrackEvent are received.
I have also placed a breakpoint in the CreatePeerConnection() Method :
localPC.OnIceConnectionChange = state => {
switch (state)
{
case RTCIceConnectionState.Connected:
//PeerConnected();
//break;
case RTCIceConnectionState.New:
case RTCIceConnectionState.Checking:
case RTCIceConnectionState.Closed:
case RTCIceConnectionState.Completed:
case RTCIceConnectionState.Disconnected:
case RTCIceConnectionState.Failed:
case RTCIceConnectionState.Max:
Debug.Log("IceConnectionState: "+state);
break;
default:
throw new ArgumentOutOfRangeException(nameof(state), state, null);
};
};
That never gets hit, so the ICEConnectionChange never changes.
Could that be the problem ?
How can I move forward debugging this ?
Thanks
The Unity SDK told in the document you shared is obsolute and has a different repository than you shaerd.
The repository you shared is new Unity SDK, you can download and use it without following the document you sent.
For the issue you sent, I have just tried to publish an RTMP stream and I could play with Unity.
Can you try with the latest master branch.