LINXD-2270-p2 #19

Closed
sergiu wants to merge 58 commits from LINXD-2270-p2 into develop
3 changed files with 49 additions and 3 deletions
Showing only changes of commit c174e92e3c - Show all commits

2
app.js
View File

@ -225,7 +225,7 @@ peers.on('connection', async socket => {
*/
socket.on('createWebRtcTransport', async ({ sender }, callback) => {
try {
console.log('🟥', JSON.stringify(sender), socket.id);
console.log('🟥', socket.id, JSON.stringify(sender));
const callId = socketDetails[socket.id];
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
if (sender) {

View File

@ -20811,8 +20811,31 @@ const closeCall = () => {
resetCallSettings()
}
const consume = async () => {
console.log('[consume]')
console.log('createRecvTransport Consumer')
await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => {
if (params.error) {
console.log('createRecvTransport | createWebRtcTransport | Error', params.error)
return
}
consumerTransport = device.createRecvTransport(params)
consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await socket.emit('transport-recv-connect', {
dtlsParameters,
})
callback()
} catch (error) {
errback(error)
}
})
connectRecvTransport()
})
}
btnLocalVideo.addEventListener('click', getLocalStream)
btnRecvSendTransport.addEventListener('click', goConnect)
btnRecvSendTransport.addEventListener('click', consume)
btnCloseCall.addEventListener('click', closeCall)
},{"./config":94,"mediasoup-client":66,"socket.io-client":82}]},{},[95]);

View File

@ -453,7 +453,30 @@ const closeCall = () => {
resetCallSettings()
}
const consume = async () => {
console.log('[consume]')
console.log('createRecvTransport Consumer')
await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => {
if (params.error) {
console.log('createRecvTransport | createWebRtcTransport | Error', params.error)
return
}
consumerTransport = device.createRecvTransport(params)
consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await socket.emit('transport-recv-connect', {
dtlsParameters,
})
callback()
} catch (error) {
errback(error)
}
})
connectRecvTransport()
})
}
btnLocalVideo.addEventListener('click', getLocalStream)
btnRecvSendTransport.addEventListener('click', goConnect)
btnRecvSendTransport.addEventListener('click', consume)
btnCloseCall.addEventListener('click', closeCall)