Compare commits

..

No commits in common. "3f3048e54f512425eb9e624f7a846e406cf098b3" and "65b5b563fffb6153f36a2f5cf3cbe7d51677cb66" have entirely different histories.

2 changed files with 33 additions and 20 deletions

17
app.js
View File

@ -156,9 +156,14 @@ peers.on('connection', async socket => {
console.log(`[transport-produce] Producer ID: ${producer.id} | kind: ${producer.kind}`) console.log(`[transport-produce] Producer ID: ${producer.id} | kind: ${producer.kind}`)
producer.on('transportclose', ({ callId }) => {
console.log('transport for this producer closed', callId)
closeRoom(callId);
})
producer.on('transportclose', () => { producer.on('transportclose', () => {
console.log('transport for this producer closed ') console.log('transport2 for this producer closed', callId)
producer.close() closeRoom(callId);
}) })
// Send back to the client the Producer's id // Send back to the client the Producer's id
@ -187,8 +192,14 @@ peers.on('connection', async socket => {
paused: true, paused: true,
}) })
consumer.on('transportclose', ({ callId }) => {
console.log('transport close from consumer', callId)
closeRoom(callId);
})
consumer.on('transportclose', () => { consumer.on('transportclose', () => {
console.log('transport close from consumer') console.log('transport2 close from consumer', callId)
closeRoom(callId);
}) })
consumer.on('producerclose', () => { consumer.on('producerclose', () => {

View File

@ -350,6 +350,8 @@ const createRecvTransport = async () => {
} }
const resetCallSettings = () => { const resetCallSettings = () => {
console.log('resetCallSettings', callId, 'socket |', socket);
socket.emit('transportclose')
localVideo.srcObject = null localVideo.srcObject = null
remoteVideo.srcObject = null remoteVideo.srcObject = null
consumer = null consumer = null
@ -396,24 +398,24 @@ const connectRecvTransport = async () => {
} }
const closeCall = () => { const closeCall = () => {
console.log('closeCall'); console.log('closeCall', callId);
// socket.emit('transportclose')
// Emit 'notify-end' to Hub so the consumer will know to close the video // Reset settings and send closeTransport to video server
const notifyEnd = {
origin_asset_id: ASSET_ID,
dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')),
type: 'notify-end',
video_call_id: callId
}
console.log('notifyEnd', notifyEnd)
hub.emit('video', JSON.stringify(notifyEnd))
// Disable Close call button
const closeCallBtn = document.getElementById('btnCloseCall')
closeCallBtn.setAttribute('disabled', '')
// Reset settings
resetCallSettings() resetCallSettings()
// // Emit 'notify-end' to Hub so the consumer will know to close the video
// const notifyEnd = {
// origin_asset_id: ASSET_ID,
// dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')),
// type: 'notify-end',
// video_call_id: callId
// }
// console.log('notifyEnd', notifyEnd)
// hub.emit('video', JSON.stringify(notifyEnd))
// // Disable Close call button
// const closeCallBtn = document.getElementById('btnCloseCall')
// closeCallBtn.setAttribute('disabled', '')
} }
btnLocalVideo.addEventListener('click', getLocalStream) btnLocalVideo.addEventListener('click', getLocalStream)