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) => {
|
||||
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) {
|
||||
|
@ -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]);
|
||||
|
@ -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)
|
Loading…
Reference in New Issue
Block a user