Update
This commit is contained in:
parent
449724537e
commit
c174e92e3c
2
app.js
2
app.js
@ -225,7 +225,7 @@ peers.on('connection', async socket => {
|
|||||||
*/
|
*/
|
||||||
socket.on('createWebRtcTransport', async ({ sender }, callback) => {
|
socket.on('createWebRtcTransport', async ({ sender }, callback) => {
|
||||||
try {
|
try {
|
||||||
console.log('🟥', JSON.stringify(sender), socket.id);
|
console.log('🟥', socket.id, JSON.stringify(sender));
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
|
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
|
||||||
if (sender) {
|
if (sender) {
|
||||||
|
@ -20811,8 +20811,31 @@ const closeCall = () => {
|
|||||||
resetCallSettings()
|
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)
|
btnLocalVideo.addEventListener('click', getLocalStream)
|
||||||
btnRecvSendTransport.addEventListener('click', goConnect)
|
btnRecvSendTransport.addEventListener('click', consume)
|
||||||
btnCloseCall.addEventListener('click', closeCall)
|
btnCloseCall.addEventListener('click', closeCall)
|
||||||
},{"./config":94,"mediasoup-client":66,"socket.io-client":82}]},{},[95]);
|
},{"./config":94,"mediasoup-client":66,"socket.io-client":82}]},{},[95]);
|
||||||
|
@ -453,7 +453,30 @@ const closeCall = () => {
|
|||||||
resetCallSettings()
|
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)
|
btnLocalVideo.addEventListener('click', getLocalStream)
|
||||||
btnRecvSendTransport.addEventListener('click', goConnect)
|
btnRecvSendTransport.addEventListener('click', consume)
|
||||||
btnCloseCall.addEventListener('click', closeCall)
|
btnCloseCall.addEventListener('click', closeCall)
|
Loading…
Reference in New Issue
Block a user