Hi, I have a problem where my router.canConsume(data)
is returning false. I read the two threads UnsupportedError: cannot consume this Producer and the other one but they did not help me at all to find the cause of the problem.
async function createConsumer(socket, transport, producer, rtpCapabilities) {
const router = getRoom(socket).router;
console.log("Room router:", router);
console.log("Create Consumer Producer:", producer);
console.log("Create Consumer RTP Capabilities:", rtpCapabilities);
const data = { producerId: producer.id, rtpCapabilities };
if (!router.canConsume(data)) {
console.error('can not consume');
return;
}
// ...
I am following the code of this example project mkhahani/ mediasoup-sample-app but my app is written in Vue.js. I keep double checking and cross checking my own code with his and I can’t seem to figure out why my router cannot consume but his can (I ran the project in my own machine and it works).
I also compared our producer
and rtpCapabilities
objects and they are almost exactly the same (the producers are slightly different but the rtpCapabilities
are exactly the same).
Here is my rtpCapabilities
object:
{ codecs:
[ { mimeType: 'audio/opus',
kind: 'audio',
preferredPayloadType: 100,
clockRate: 48000,
channels: 2,
parameters: [Object],
rtcpFeedback: [Array] },
{ mimeType: 'video/VP8',
kind: 'video',
preferredPayloadType: 101,
clockRate: 90000,
parameters: {},
rtcpFeedback: [Array] },
{ mimeType: 'video/rtx',
kind: 'video',
preferredPayloadType: 102,
clockRate: 90000,
parameters: [Object],
rtcpFeedback: [] } ],
headerExtensions:
[ { kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'audio',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri:
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
preferredId: 5,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri:
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
preferredId: 6,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level',
preferredId: 10,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri: 'urn:3gpp:video-orientation',
preferredId: 11,
preferredEncrypt: false,
direction: 'sendrecv' },
{ kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:toffset',
preferredId: 12,
preferredEncrypt: false,
direction: 'sendrecv' } ] }
{
"codecs": [
{
"mimeType": "audio/opus",
"payloadType": 111,
"clockRate": 48000,
"channels": 2,
"parameters": {
"minptime": 10,
"useinbandfec": 1
},
"rtcpFeedback": [
{
"type": "transport-cc",
"parameter": ""
}
]
}
],
"headerExtensions": [
{
"uri": "urn:ietf:params:rtp-hdrext:sdes:mid",
"id": 4,
"encrypt": false,
"parameters": {}
},
{
"uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
"id": 2,
"encrypt": false,
"parameters": {}
},
{
"uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
"id": 3,
"encrypt": false,
"parameters": {}
},
{
"uri": "urn:ietf:params:rtp-hdrext:ssrc-audio-level",
"id": 1,
"encrypt": false,
"parameters": {}
}
],
"encodings": [
{
"ssrc": 12338707,
"dtx": false
}
],
"rtcp": {
"cname": "rezabl/mISmZX+wr",
"reducedSize": true
},
"mid": "1"
}