Unknown method "consumer.setPreferredLayers"


After calling this method with {spatialLayer: 2}, the promise gets rejected with an “unknown method” error.

mediasoup:ERROR:worker[pid:30269] RTC::Consumer::HandleRequest() | throwing MediaSoupError: unknown method 'consumer.setPreferredLayers' +11s
  mediasoup:WARN:Channel[pid:30269] request failed [method:consumer.setPreferredLayers, id:23]: unknown method 'consumer.setPreferredLayers' +11s
(node:30256) UnhandledPromiseRejectionWarning: Error: unknown method 'consumer.setPreferredLayers'
    at Channel._processMessage (/home/mitv/v3mediasoup/node_modules/mediasoup/lib/Channel.js:220:37)
    at Socket.Channel._consumerSocket.on (/home/mitv/v3mediasoup/node_modules/mediasoup/lib/Channel.js:80:34)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:601:20)
(node:30256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

As far as I can tell my input parameters are correct and the error seems to suggest the method doesn’t exist at all, even though it passes through the JS portion of the library first. Any suggestions for what might be causing this? Could it be a bug in Mediasoup?

You are calling setPreferredLayers() on a type=simple or type=pipe consumer, which do not support it.

However, I’ve “fixed” it in “devel” branch so calling that method on those Consumers will be a NOOP that just resolves.

1 Like