mediasoup v3.4.6
mediasoup-client v3.3.12
Chrome v79
macOs 10.15.2
I trigger the transport.on(‘connect’) event after using createSendTransport(). After the server side executes webrtctransport.connect (), the client receives the callback and executes the error.
error:
Chrome74.js?d0d4:204 Uncaught (in promise) DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. candidate:undefined 1 undefined NaN undefined NaN typ undefined Invalid value: NaN.
at SendHandler.eval (webpack-internal:///./node_modules/mediasoup-client/lib/handlers/Chrome74.js:204:28)
at Generator.next (<anonymous>)
at fulfilled (webpack-internal:///./node_modules/mediasoup-client/lib/handlers/Chrome74.js:5:5
client code:
const transport = device.createSendTransport(data);
// ==> data is { routerRtpCapabilities }
transport.on('connect', async ({ dtlsParameters }, callback, errback) => {
console.log(dtlsParameters); // ==> { role: 'client', fingerprints: [...] }
new Promise((resolve) => {
socket.emit('connectProducerTransport', {
userid // ==> get server webrtc transport (producer)
dtlsParameters
}, resolve);
}).then(() => {
callback();
console.log(`connect is ok!`); // ==> ok
}).catch(errback);
console.log(`[sendTransport] is connect...`); // ==> ok
});
transport.on('produce', ...); // ==> no use
transport.on('connectionstatechange', ...); // ==> no use
const stream = await getStream();
const videoTrack = stream.getVideoTracks()[0];
await transport.produce({track: videoTrack});
server code:
socket.on('connectProducerTransport', async (data, callback) => {
const { producerMap } = utilMaps;
const transport = producerMap.get(data.userid);
await transport.connect({
dtlsParameters: data.dtlsParameters
});
console.log(`${data.userid} producer connect is ok!`);
// ==> is ok!
callback();
});
I need some help! Thank you very much!