Receiving steam but not rendered, when using public ip as announcedIp

in this scenario where when i am using the announcedIp as 127.0.0.1 in this case everything is fine.

But when i am using my public ip as announced ip here the stream is not rendering. i am receiving the track from the server but when i am assigning the track to the video.srcobject then the video just buffers continously.

hi bro
for this black screen that make in some cause
ref…autoplay = true;
ref.muted = true;
ref.play();

i use this after addTrack and solved my problem.

no bro nothing happened
how is this solution is aligned with my problem,
my problem is related to the announced ip

I used public host ip and work correctly
I think 127.0.0.1 for ipv6 . I’m not sure.

if u use find dynamicaly use os like this

this is my mediasoup.config.ts

import * as mediasoup from 'mediasoup';

import os from 'os';
import * as dotenv from 'dotenv';

dotenv.config();

const { MEDIASOUP_LISTEN_IP,
    MEDIASOUP_ANNOUNCED_IP,
    MEDIASOUP_MIN_PORT,
    MEDIASOUP_MAX_PORT, } = process.env;

interface MediasoupConfig {
    numWorkers: number;
    workerSettings: {
        dtlsCertificateFile?: string;
        dtlsPrivateKeyFile?: string;
        logLevel: mediasoup.types.WorkerLogLevel;
        logTags: mediasoup.types.WorkerLogTag[];
    };
    routerOptions: mediasoup.types.RouterOptions;
    webRtcServerOptions: mediasoup.types.WebRtcServerOptions;
    webRtcTransportOptions: mediasoup.types.WebRtcTransportOptions;
    plainTransportOptions: mediasoup.types.PlainTransportOptions;
}

const address: mediasoup.types.TransportListenInfo[] = [];



(async () => {
    const myinterfaces = os.networkInterfaces();

    for (let interfacei in myinterfaces) {
        for (let interfeceinfo of myinterfaces[interfacei]) {
            if (!interfeceinfo.internal) {
                if (interfeceinfo.family === "IPv4") {
                    address.push({
                        protocol: "udp",
                        ip: "0.0.0.0",
                        announcedAddress: interfeceinfo.address,
                        // port: 4000,
                    })
                    address.push({
                        protocol: "tcp",
                        ip: "0.0.0.0",
                        announcedAddress: interfeceinfo.address,
                        // port: 4000,
                    })

                }
                // else  if (interfeceinfo.family === "IPv6") {
                //     address.push({
                //         protocol: "udp",
                //         ip: interfeceinfo.address,
                //         announcedAddress: "142.132.152.236"
                //     })
                // }
            }
            console.log("alllllll inteface addresss");

            console.log(interfeceinfo);
        }
    }

})()
console.log("addredss");
console.log(address);





const mediasoupConfiges: MediasoupConfig = {
    // Number of mediasoup workers to launch on CPU exist.
    numWorkers: Object.keys(os.cpus()).length,
    // mediasoup WorkerSettings.
    // See https://mediasoup.org/documentation/v3/mediasoup/api/#WorkerSettings
    workerSettings: {
        logLevel: "debug",
        logTags: ['info', 'ice', 'dtls', 'rtp', 'srtp', 'rtcp', 'rtx', 'bwe', 'score', 'simulcast', 'svc', 'sctp'],
        dtlsCertificateFile: "",
        dtlsPrivateKeyFile: "",
    },
    // mediasoup Router options.
    // See https://mediasoup.org/documentation/v3/mediasoup/api/#RouterOptions
    routerOptions: {
        mediaCodecs: [
            { kind: 'audio', mimeType: 'audio/opus', clockRate: 48000, channels: 2 },
            { kind: 'video', mimeType: 'video/VP8', clockRate: 90000, parameters: { 'x-google-start-bitrate': 1000 } },
            { kind: 'video', mimeType: 'video/VP9', clockRate: 90000, parameters: { 'profile-id': 2, 'x-google-start-bitrate': 1000 } },
            { kind: 'video', mimeType: 'video/h264', clockRate: 90000, parameters: { 'packetization-mode': 1, 'profile-level-id': '4d0032', 'level-asymmetry-allowed': 1, 'x-google-start-bitrate': 1000 } },
            { kind: 'video', mimeType: 'video/h264', clockRate: 90000, parameters: { 'packetization-mode': 1, 'profile-level-id': '42e01f', 'level-asymmetry-allowed': 1, 'x-google-start-bitrate': 1000 } }
        ]
    },

    webRtcServerOptions: {
        listenInfos: [...address,
        ],
    },
    // mediasoup WebRtcTransport options for WebRTC endpoints (mediasoup-client,
    // libmediasoupclient).
    // See https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions
    webRtcTransportOptions: {
        // listenInfos is not needed since webRtcServer is used.
        // However passing MEDIASOUP_USE_WEBRTC_SERVER=false will change it.
        listenInfos: [
            {
                protocol: 'udp',
                ip: MEDIASOUP_LISTEN_IP || '0.0.0.0',
                announcedAddress: MEDIASOUP_ANNOUNCED_IP,
                portRange: {
                    min: Number(MEDIASOUP_MIN_PORT) || 40000,
                    max: Number(MEDIASOUP_MAX_PORT) || 49999
                }
            },
            {
                protocol: 'tcp',
                ip: MEDIASOUP_LISTEN_IP || '0.0.0.0',
                announcedAddress: MEDIASOUP_ANNOUNCED_IP,
                portRange: {
                    min: Number(MEDIASOUP_MIN_PORT) || 40000,
                    max: Number(MEDIASOUP_MAX_PORT) || 49999
                }
            }
        ],
        initialAvailableOutgoingBitrate: 1000000,
        maxSctpMessageSize: 262144,
        enableUdp: true,
        // enableTcp: true,
        preferUdp: true,

    },

    plainTransportOptions: {
        listenInfo: {
            protocol: 'udp',
            ip: MEDIASOUP_LISTEN_IP || '0.0.0.0',
            announcedAddress: MEDIASOUP_ANNOUNCED_IP,
            portRange: {
                min: Number(MEDIASOUP_MIN_PORT) || 40000,
                max: Number(MEDIASOUP_MAX_PORT) || 49999
            }
        },
        maxSctpMessageSize: 262144
    }
}

Bro can we do 1 to 1 talk on my problem

It’s really frustrating for me now

I’m not pro in mediasoup but if you new in mediasoup I suggest read document with some example in github

I read document this section again .

use announcedAddress

but if reminded this error , may signaling doesn’t complete

do you use chrome://webrtc-internals ?

if signaling complete and data flow in chrome://webrtc-internals . it is sure error on client side but I think error is on signaling.

and bro can share your repo

hi. this is big.
let me send some section in this post to create small example.

bro, You can simply share link of your repo

Bro please send kardo

bro this is private repo :sweat_smile:
let me create simple repo

Bhai send kar de link

hi.
I created it. may has some bug but work. I will complete in future.

thanks bro