mediasoup-client: Is Producer.id a object (not a string)

Ahoy,

I refer to producers using their IDs and don’t know if I found something strange.
So I create the producer:

const producer = await someTransport.produce({...});

Then the producer.id is not the ID string (as it should be according to the docs, mediasoup :: API), but an object containing an “id” property.

Am I referring to something wrong? Have I misread the docs?

Cheers,
Cornelius

This means that arguments in {} are likely incorrect, chck what those are

Stringify the whole returned object: what is it?

Thanks for your reply.
Here some code:

this.device = new mediasoup.Device();

// ...

this.sendTransport = this.device.createSendTransport({
		id,
		iceParameters,
		iceCandidates,
		dtlsParameters,
		sctpParameters
});
//parameters from server response

// ...

this.audioProducer = await this.sendTransport.produce({
		track,
		codecOptions : {
			opusStereo : 1,
			opusDtx    : 1
		}
});
console.log(this.audioProducer.id)
// >> Object { id: "32c95f16-4116-4285-9bf1-6ccff421208d" }

I can just use this.audioProducer.id[“id”], but I’m confused that it doesn’t fit the docs (or at least what I read in them).

Check what you are passing to the callback in transport.on('produce', ...) message handler. You probably receive the id in an object from the signaling, and then envelop it in yet another object for the callback.

1 Like

Genius!
That was the reason.
Thank you very much.