Hello!
I’m trying to record a video, and I do this:
const worker = await mediasoup.createWorker(...);
const router = await worker.createRouter(...);
const webrtcTransport = ...;
const producerMap = ...; // audio and video producers by kind
let rtpTransport = await router.createPlainTransport({
rtcpMux: false,
listenInfo: {
protocol: 'udp',
ip: '192.168.0.218', // my local IP address
},
});
console.log('rtp tuple: ', rtpTransport.tuple);
await rtpTransport.connect({
ip: '192.168.0.218', // my local IP address
port: rtpTransport.tuple.localPort,
rtcpPort: rtpTransport.rtcpTuple.localPort
});
for (let [kind, producer] of client.producerMap) {
const codecs = [];
const routerCodec = router.rtpCapabilities.codecs.find(
codec => codec.kind === kind,
);
codecs.push(routerCodec);
console.log('codecs: ', codecs);
await rtpTransport.consume({
producerId: producer.id, // producer id from WebRtcTransport
rtpCapabilities: {
codecs,
rtcpFeedback: [],
},
});
}
I check for a stream through the VLC media player, but nothing shows there. (it doesn’t work in ffmpeg command either.) I read the documentation and various examples. But I can’t figure out why it doesn’t work.
What am I doing wrong?
I thought the consumer work through a transport created by the router, if their codecs are not supported by the router, the transport will also not accept them.
Isn’t it so?
Of course that assuming that your consuming endpoint (VLC media player) supports the exact codecs and codec configurations than the codecs given to the mediasoup Router won’t work. I sent a link above. Please don’t ignore it.
I don’t know what exactly VLC supports but probably you don’t want to have blank lines in the SDP (that’s incorrect) and most probably you want to place the audio section first.
Fix this, please. You are passing the ip and ports of the transport in mediasoup side instead than the ip and port where VLC or ffmpeg are listening. Read the docs of plainTransport.connect().