Hi!
My plan is to develop a radio simulation platform which uses mediasoup as its SFU.
I am quite new in the topic audio streaming and therefore my question is just stupid:
In most cases, both audio and video are transmitted. Because I don’t need the video codec in my project, I have removed all codecs from the documentation that have to do with audio.
Server:
const mediaCodecs = [
{
kind: "audio",
mimeType: 'audio/opus',
payloadType: 111,
clockRate: 48000,
channels: 2,
},
]
On the client side I just request the audio stream:
async function getVideoStream() {
return new Promise((resolve, reject) => {
navigator.getUserMedia({
audio: true,
video: true
}, (stream) => {
const track = stream.getVideoTracks()[0]
resolve({
stream,
track
})
}, error => {
reject(error.message)
})
})
}
Somehow, however, mediasoup crashes when only an audio track arrives at the server, but when I send video and audio, everything works without a hitch.
Where is the log:
mediasoup:WebRtcTransport connect() +9ms mediasoup:Channel request() [method:transport.connect, id:3] +9ms
mediasoup:Channel request succeeded [method:transport.connect, id:3] +0ms
mediasoup:Transport produce() +55ms
mediasoup:Channel request() [method:transport.produce, id:4] +47ms
mediasoup:ERROR:Channel [pid:1130 RTC::Producer::Producer() | throwing MediaSoupTypeError: audio/opus codec not supported for simulcast +0ms
mediasoup:ERROR:Channel [pid:1130 Worker::OnChannelRequest() | throwing MediaSoupTypeError: audio/opus codec not supported for simulcast [method:transport.produce] +37ms
mediasoup:WARN:Channel request failed [method:transport.produce, id:4]: [method:transport.produce] +0ms
/mnt/c/Users/joamb/Documents/GitHub/vHEMS-v2/server/node_modules/mediasoup/node/lib/Channel.js:192
sent.reject(new TypeError(msg.reason));
^
TypeError: [method:transport.produce]
at Channel.processMessage (/mnt/c/Users/joamb/Documents/GitHub/vHEMS-v2/server/node_modules/mediasoup/node/lib/Channel.js:192:37)
at Socket.<anonymous> (/mnt/c/Users/joamb/Documents/GitHub/vHEMS-v2/server/node_modules/mediasoup/node/lib/Channel.js:69:34)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)
Node.js v17.1.0
Obviously things are not as easy as I expected. Maybe someone here has an Idea.
Thanks in advance, Johannes!