How to add media stream to a producer

For why media stream is not showing in video element, there can be many reason like not consuming correctly or may be not setting stream to video element correctly or may be autoplay issue.

To find you whether track is being received you need to go to chrome://webrtc-internals and see in the stats.

Also try logging track to console and see if it is paused or ended,

Make sure you are producing, consuming correctly. Also check producer, consumer scores on server side to verify the track input, output.

As IP can i do 0.0.0.0 ?
I had protocol to udp to test to test both already, i make so new tests still.
When i console log i have the media but it’s not showing.

“Also check producer, consumer scores on server side to verify the track input, output.”
Do you have some idea how to debug and log it ?

On server I use public ip of server as annoucedIp, but for local I set 127.0.0.1 or my local ip as ‘ip’ and use 0.0.0.0 as ‘annoucedIp’ to make it work.

Before checking scores on server, do check incoming/outgoing tracks from chrome://webrtc-internals it is lot simpler.

Kindly show the track from console log with object expanded.

I have a connectionstatechange to failed in consumer side when i check on chrome://webrtc-internals

It’s maybe my coturn docker who cause the issue ?
I have a icecandidateerror who bring me this error:

url: turn:coturn:3478?transport=udp
address: 192.168.1.x
port: 65309
host_candidate: 192.168.1.x:65309
error_text: TURN host lookup received error.
error_code: 701

icegateheringstatechange return complete
connectionstatechange retrun failed

Why would you need a TURN server?

I didn’t at the beginning, but i added one because it can maybe help.
I have this running on docker container running on the same network.
But i still can’t play the media stream in the consumer side.
So for now i don’t know i to fix my issue.
Why media stream is not playing on consumer side ?

I have an error when i use udp protocol i have a connection failed and an error who said i have a turn error on firefox for exemple:
WebRTC: ICE failed, your TURN server appears to be broken, see about:webrtc for more details .

In new versions of browsers it is not allowed to use query parameters in stun turn urls.

Don’t use turn server without any reason. Find the main issue which is causing problem for you most probably the docker this you have.

yes i guess, but i already make sure that my front end and back ends are on the same network, so everything should work, but it doesn’t i don’t know why

If transport or getting connected then all the configurations seem ok, you need to debug how you are producing, consuming

wich log do you want to see exactly ?

This is just an ICE error. Firefox adds a note about TURN server whether there is a TURN server or not.

I have a connectionstatechange as connecting then as connected, but i don’t have media stream showing in consumer side.

on client side, but on server side the connectionstatechange log connected too

show me the track object you console logged. Also make a video for me of your chrome://webrtc-internals. If possible upload it somewhere to have a look. It is difficult to judge just from conversations.

There is no ‘connectionstatechange’ on server side.

yes i mean icestatechange, on back end side, like this:

const transport = await router.createWebRtcTransport(
            {
                webRtcServer : server,
                enableUdp    : true,
                enableTcp    : true,
                preferUdp    : true,
                initialAvailableOutgoingBitrate: 1000000,
            }
        );

        transport.on("icestatechange", (iceState) => {
            console.log(`ICE state changed to ${iceState}`);
        });

for the media track i send you this soon, in few minutes.

You want to monitor DTLS state server-sided.