I been implementing mediasoup for my live stream website and I got in confused on how exactly I can make transport listens on connection state changes,
on the client side it stays only connection is changed into connecting
on the producer side
transport.on('connectionstatechange', (state) => {
switch (state) {
case 'connecting':
$txtPublish.innerHTML = 'publishing...';
$fsPublish.disabled = true;
$fsSubscribe.disabled = true;
break;
case 'connected':
document.querySelector('#local_video').srcObject = stream;
$txtPublish.innerHTML = 'published';
$fsPublish.disabled = true;
$fsSubscribe.disabled = false;
break;
case 'failed':
transport.close();
$txtPublish.innerHTML = 'failed';
$fsPublish.disabled = false;
$fsSubscribe.disabled = true;
break;
default: break;
}
});