Update client to consume audio correctly
This commit is contained in:
parent
6b822142d0
commit
33ea44ac02
@ -20453,9 +20453,9 @@ setTimeout(() => {
|
||||
if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() }
|
||||
})
|
||||
|
||||
socket.on('new-producer', ({ callId }) => {
|
||||
console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`);
|
||||
consume()
|
||||
socket.on('new-producer', ({ callId, kind }) => {
|
||||
console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`);
|
||||
connectRecvTransport();
|
||||
})
|
||||
}
|
||||
|
||||
@ -20735,6 +20735,8 @@ const connectSendTransport = async () => {
|
||||
// Enable Close call button
|
||||
const closeCallBtn = document.getElementById('btnCloseCall');
|
||||
closeCallBtn.removeAttribute('disabled');
|
||||
|
||||
createRecvTransport();
|
||||
}
|
||||
|
||||
const createRecvTransport = async () => {
|
||||
@ -20774,7 +20776,8 @@ const createRecvTransport = async () => {
|
||||
errback(error)
|
||||
}
|
||||
})
|
||||
connectRecvTransport()
|
||||
// We call it in new-rpoducer, we don't need it here anymore
|
||||
// connectRecvTransport()
|
||||
})
|
||||
}
|
||||
|
||||
@ -20907,29 +20910,29 @@ 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)
|
||||
}
|
||||
})
|
||||
// const consume = async (kind) => {
|
||||
// console.log(`[consume] kind: ${kind}`)
|
||||
// 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()
|
||||
})
|
||||
}
|
||||
// connectRecvTransport()
|
||||
// })
|
||||
// }
|
||||
|
||||
btnLocalVideo.addEventListener('click', getLocalStream)
|
||||
btnRecvSendTransport.addEventListener('click', consume)
|
||||
|
@ -95,9 +95,9 @@ setTimeout(() => {
|
||||
if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() }
|
||||
})
|
||||
|
||||
socket.on('new-producer', ({ callId }) => {
|
||||
console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`);
|
||||
consume()
|
||||
socket.on('new-producer', ({ callId, kind }) => {
|
||||
console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`);
|
||||
connectRecvTransport();
|
||||
})
|
||||
}
|
||||
|
||||
@ -377,6 +377,8 @@ const connectSendTransport = async () => {
|
||||
// Enable Close call button
|
||||
const closeCallBtn = document.getElementById('btnCloseCall');
|
||||
closeCallBtn.removeAttribute('disabled');
|
||||
|
||||
createRecvTransport();
|
||||
}
|
||||
|
||||
const createRecvTransport = async () => {
|
||||
@ -416,7 +418,8 @@ const createRecvTransport = async () => {
|
||||
errback(error)
|
||||
}
|
||||
})
|
||||
connectRecvTransport()
|
||||
// We call it in new-rpoducer, we don't need it here anymore
|
||||
// connectRecvTransport()
|
||||
})
|
||||
}
|
||||
|
||||
@ -549,29 +552,29 @@ 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)
|
||||
}
|
||||
})
|
||||
// const consume = async (kind) => {
|
||||
// console.log(`[consume] kind: ${kind}`)
|
||||
// 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()
|
||||
})
|
||||
}
|
||||
// connectRecvTransport()
|
||||
// })
|
||||
// }
|
||||
|
||||
btnLocalVideo.addEventListener('click', getLocalStream)
|
||||
btnRecvSendTransport.addEventListener('click', consume)
|
||||
|
Loading…
Reference in New Issue
Block a user