Set unique user id into MediaStreamTrack

Hi there!

I am trying to add user id to MediaStreamTrack instead of “janus0, janus1, etc.” default names. Is it possible? I see in Janus Video Room Demo (multistream). All streams have guid value

I’ve tried to add descriptions in “joinandconfigure” request with mid 0,1,2 and description with ID, but it didn’t help.

Check the use_msid property in the VideoRoom documentation.

Now I am just getting 0 and 1 in track id and labels. What did I miss?

I have

        "streams": [
            {
                "type": "audio",
                "active": true,
                "mindex": 0,
                "mid": "0",
                "ready": true,
                "send": true,
                "feed_id": "e7e3f0b5-f3e3-4f10-916e-1857c4b967a8",
                "feed_mid": "0",
                "feed_description": "e7e3f0b5-f3e3-4f10-916e-1857c4b967a8",
                "codec": "opus"
            },
            {
                "type": "video",
                "active": true,
                "mindex": 1,
                "mid": "1",
                "ready": true,
                "send": true,
                "feed_id": "e7e3f0b5-f3e3-4f10-916e-1857c4b967a8",
                "feed_mid": "1",
                "feed_description": "e7e3f0b5-f3e3-4f10-916e-1857c4b967a8",
                "codec": "vp8"
            }

That’s the mid and that will always look like that. You should check the msid, which you’ll see reflected in the MediaStreamTrack (what you asked).

Its 0 and 1 here

image

Because that’s the mid. If you check the SDP, you’ll find an msid that reflects other properties. Not sure if you have to query that information somehow else. Context here.

That said, the mid alone is enough when used with subscribers event, as you can use those to correlate. You now know, for instance, that mid 1 is e7e3f0b5-f3e3-4f10-916e-1857c4b967a8’s video.

I think almost got it. Should I parse SDP then to get that correlation?

No. The first snippet you shared was a VideoRoom event, and the mid you get from the MediaStreamTrack itself. You never need the msid thing if not in some cases (I think some older react-native implementation relied on them to be unique).

Okay. Got it. I’ve got onTrack trigger and here I see what I suppose can correlate by.

Here in stream I have user id guid and in transceiver I have mid. It is ok?