From eb6dd7fdbd5f13ec0c2c4f8613fb4abb310ec30b Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Thu, 1 Sep 2022 13:13:00 +0300 Subject: [PATCH 01/13] Let router to close connections --- app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 860dae3..abd804e 100644 --- a/app.js +++ b/app.js @@ -196,8 +196,8 @@ peers.on('connection', async socket => { // https://mediasoup.org/documentation/v3/mediasoup/api/#router-close router[callId].close() delete router[callId] - producer.close() - consumer.close() + // producer.close() + // consumer.close() }) consumer.on('producerclose', () => { @@ -206,8 +206,8 @@ peers.on('connection', async socket => { // https://mediasoup.org/documentation/v3/mediasoup/api/#router-close router[callId].close() delete router[callId] - producer.close() - consumer.close() + // producer.close() + // consumer.close() }) // from the consumer extract the following params -- 2.37.1 From 1e8f8b6d9b565d8fc68656e9c64064b3e3ba8a94 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 3 Sep 2022 09:04:35 +0300 Subject: [PATCH 02/13] Added log when connect to send transport(as producer) --- public/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/index.js b/public/index.js index affb71b..ce85a24 100644 --- a/public/index.js +++ b/public/index.js @@ -270,6 +270,7 @@ const createSendTransport = () => { } const connectSendTransport = async () => { + console.log('[connectSendTransport]'); // we now call produce() to instruct the producer transport // to send media to the Router // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce -- 2.37.1 From f479aaa96fa49398456725a53b622da0c1711341 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 3 Sep 2022 09:13:10 +0300 Subject: [PATCH 03/13] Added try/catch and the callback back in transport-produce --- app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app.js b/app.js index abd804e..ea1b705 100644 --- a/app.js +++ b/app.js @@ -167,6 +167,15 @@ peers.on('connection', async socket => { router[callId].close() delete router[callId] }) + + try { + // Send back to the client the Producer's id + callback({ + id: producer.id + }) + } catch (error) { + console.log(`ERROR | transport-produce | ${error}`) + } }) // see client's socket.emit('transport-recv-connect', ...) -- 2.37.1 From fdd0c438c4064bded38f3414d63e5b668b614f67 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 3 Sep 2022 09:22:43 +0300 Subject: [PATCH 04/13] Added callback in transport-producer server --- app.js | 6 +++++- public/index.js | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index ea1b705..520ae55 100644 --- a/app.js +++ b/app.js @@ -149,7 +149,7 @@ peers.on('connection', async socket => { }) // see client's socket.emit('transport-produce', ...) - socket.on('transport-produce', async ({ kind, rtpParameters, appData }) => { + socket.on('transport-produce', async ({ kind, rtpParameters, appData }, callback) => { // call produce based on the prameters from the client producer = await producerTransport.produce({ kind, @@ -157,6 +157,10 @@ peers.on('connection', async socket => { }) console.log(`[transport-produce] Producer ID: ${producer.id} | kind: ${producer.kind}`) + // If we have multiple producers/consumers on the same room + // We need to notify all the consumers of the room + // --- code --- + producer.on('transportclose', () => { console.log('transport for this producer closed', callId) diff --git a/public/index.js b/public/index.js index ce85a24..1524bb6 100644 --- a/public/index.js +++ b/public/index.js @@ -217,7 +217,7 @@ const createSendTransport = () => { return } - console.log(params) + console.log('params', params) // creates a new WebRTC Transport to send media // based on the server's producer transport params @@ -264,7 +264,6 @@ const createSendTransport = () => { errback(error) } }) - connectSendTransport() }) } -- 2.37.1 From 6682dd9482cf75a27b15dcd95bd0c076d4291fb7 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 3 Sep 2022 09:35:27 +0300 Subject: [PATCH 05/13] Added logs on producer produce --- public/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/index.js b/public/index.js index 1524bb6..f96ae84 100644 --- a/public/index.js +++ b/public/index.js @@ -244,7 +244,7 @@ const createSendTransport = () => { }) producerTransport.on('produce', async (parameters, callback, errback) => { - console.log(parameters) + console.log('produce', parameters) try { // tell the server to create a Producer @@ -256,11 +256,13 @@ const createSendTransport = () => { rtpParameters: parameters.rtpParameters, appData: parameters.appData, }, ({ id }) => { + console.log('[transport-produce] callback | id', id); // Tell the transport that parameters were transmitted and provide it with the // server side producer's id. callback({ id }) }) } catch (error) { + console.log('ERROR | produce |', error); errback(error) } }) -- 2.37.1 From e65845ce9b24ac1887f06fbc0d6bca38777b8096 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 14:15:33 +0300 Subject: [PATCH 06/13] Added 7000 delay after setup is done(before sendinng notify-answer to HUB --- public/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/index.js b/public/index.js index f96ae84..ebe77cd 100644 --- a/public/index.js +++ b/public/index.js @@ -300,10 +300,12 @@ const connectSendTransport = async () => { }; console.log('SEND answer', answer); - hub.emit( - 'video', - JSON.stringify(answer) - ); + setTimeout(() => { + hub.emit( + 'video', + JSON.stringify(answer) + ); + }, 7000); // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); -- 2.37.1 From 6d13805ac60769da5b06e62bf2c1473835db999f Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 17:39:33 +0300 Subject: [PATCH 07/13] On goConnect send accept call and start setup --- public/index.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/public/index.js b/public/index.js index ebe77cd..f91b787 100644 --- a/public/index.js +++ b/public/index.js @@ -155,7 +155,13 @@ const getLocalStream = () => { const goConnect = () => { console.log('[goConnect] device:', device); - device === undefined ? getRtpCapabilities() : goCreateTransport() + setTimeout(() => { + hub.emit( + 'video', + JSON.stringify(answer) + ); + device === undefined ? getRtpCapabilities() : goCreateTransport() + }, 7000); } const goCreateTransport = () => { @@ -300,12 +306,12 @@ const connectSendTransport = async () => { }; console.log('SEND answer', answer); - setTimeout(() => { - hub.emit( - 'video', - JSON.stringify(answer) - ); - }, 7000); + // setTimeout(() => { + // hub.emit( + // 'video', + // JSON.stringify(answer) + // ); + // }, 7000); // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); -- 2.37.1 From b909e7ec58bc1b69df0598d062a88ce0500c58b2 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 17:41:09 +0300 Subject: [PATCH 08/13] On goConnect send accept call and start setup --- public/index.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/public/index.js b/public/index.js index f91b787..d0acfe1 100644 --- a/public/index.js +++ b/public/index.js @@ -156,6 +156,17 @@ const getLocalStream = () => { const goConnect = () => { console.log('[goConnect] device:', device); setTimeout(() => { + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; + console.log('SEND answer', answer); hub.emit( 'video', JSON.stringify(answer) @@ -294,17 +305,17 @@ const connectSendTransport = async () => { // close video track }) - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); + // const answer = { + // origin_asset_id: ASSET_ID, + // dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + // type: 'notify-answer', + // origin_asset_priority: 1, + // origin_asset_type_name: ASSET_TYPE, + // origin_asset_name: ASSET_NAME, + // video_call_id: callId, + // answer: 'accepted', // answer: 'rejected' + // }; + // console.log('SEND answer', answer); // setTimeout(() => { // hub.emit( -- 2.37.1 From 4e339959b01841f751f6ace015f5041923b31808 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 17:49:24 +0300 Subject: [PATCH 09/13] Send answer on createSendTransport --- public/index.js | 62 ++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/public/index.js b/public/index.js index d0acfe1..ef096c3 100644 --- a/public/index.js +++ b/public/index.js @@ -155,24 +155,7 @@ const getLocalStream = () => { const goConnect = () => { console.log('[goConnect] device:', device); - setTimeout(() => { - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); - hub.emit( - 'video', - JSON.stringify(answer) - ); - device === undefined ? getRtpCapabilities() : goCreateTransport() - }, 7000); + device === undefined ? getRtpCapabilities() : goCreateTransport() } const goCreateTransport = () => { @@ -224,6 +207,27 @@ const getRtpCapabilities = () => { } const createSendTransport = () => { + + + // setTimeout(() => { + // const answer = { + // origin_asset_id: ASSET_ID, + // dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + // type: 'notify-answer', + // origin_asset_priority: 1, + // origin_asset_type_name: ASSET_TYPE, + // origin_asset_name: ASSET_NAME, + // video_call_id: callId, + // answer: 'accepted', // answer: 'rejected' + // }; + console.log('SEND answer', answer); + hub.emit( + 'video', + JSON.stringify(answer) + ); + // device === undefined ? getRtpCapabilities() : goCreateTransport() + // }, 7000); + // see server's socket.on('createWebRtcTransport', sender?, ...) // this is a call from Producer, so sender = true socket.emit('createWebRtcTransport', { sender: true, callId }, ({ params }) => { @@ -305,17 +309,17 @@ const connectSendTransport = async () => { // close video track }) - // const answer = { - // origin_asset_id: ASSET_ID, - // dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - // type: 'notify-answer', - // origin_asset_priority: 1, - // origin_asset_type_name: ASSET_TYPE, - // origin_asset_name: ASSET_NAME, - // video_call_id: callId, - // answer: 'accepted', // answer: 'rejected' - // }; - // console.log('SEND answer', answer); + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; + console.log('SEND answer', answer); // setTimeout(() => { // hub.emit( -- 2.37.1 From 5373b58e99f1cc963be50e67ef920de2e2bde9f6 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 17:50:35 +0300 Subject: [PATCH 10/13] Send answer on createSendTransport --- public/index.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/public/index.js b/public/index.js index ef096c3..456486c 100644 --- a/public/index.js +++ b/public/index.js @@ -209,24 +209,21 @@ const getRtpCapabilities = () => { const createSendTransport = () => { - // setTimeout(() => { - // const answer = { - // origin_asset_id: ASSET_ID, - // dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - // type: 'notify-answer', - // origin_asset_priority: 1, - // origin_asset_type_name: ASSET_TYPE, - // origin_asset_name: ASSET_NAME, - // video_call_id: callId, - // answer: 'accepted', // answer: 'rejected' - // }; + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; console.log('SEND answer', answer); hub.emit( 'video', JSON.stringify(answer) ); - // device === undefined ? getRtpCapabilities() : goCreateTransport() - // }, 7000); // see server's socket.on('createWebRtcTransport', sender?, ...) // this is a call from Producer, so sender = true -- 2.37.1 From ab540b276adf1ebf29205f17007c87464ee1f8dc Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 18:07:35 +0300 Subject: [PATCH 11/13] Send answer on createSendTransport with 7s delay --- public/index.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/public/index.js b/public/index.js index 456486c..d2bb032 100644 --- a/public/index.js +++ b/public/index.js @@ -208,22 +208,23 @@ const getRtpCapabilities = () => { const createSendTransport = () => { - - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); - hub.emit( - 'video', - JSON.stringify(answer) - ); + setTimeout(() => { + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; + console.log('SEND answer', answer); + hub.emit( + 'video', + JSON.stringify(answer) + ); + // see server's socket.on('createWebRtcTransport', sender?, ...) // this is a call from Producer, so sender = true @@ -286,6 +287,10 @@ const createSendTransport = () => { }) connectSendTransport() }) + + + + }, 7000); } const connectSendTransport = async () => { -- 2.37.1 From 42dffe1cbb019ff434d9aafb6ae35f8cdb521253 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 18:11:13 +0300 Subject: [PATCH 12/13] Send answer and connect to transport layer created with 7s delay --- public/index.js | 97 +++++++++++++++++++------------------------------ 1 file changed, 37 insertions(+), 60 deletions(-) diff --git a/public/index.js b/public/index.js index d2bb032..055d5aa 100644 --- a/public/index.js +++ b/public/index.js @@ -208,24 +208,6 @@ const getRtpCapabilities = () => { const createSendTransport = () => { - setTimeout(() => { - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); - hub.emit( - 'video', - JSON.stringify(answer) - ); - - // see server's socket.on('createWebRtcTransport', sender?, ...) // this is a call from Producer, so sender = true socket.emit('createWebRtcTransport', { sender: true, callId }, ({ params }) => { @@ -287,52 +269,47 @@ const createSendTransport = () => { }) connectSendTransport() }) - - - - }, 7000); } const connectSendTransport = async () => { - console.log('[connectSendTransport]'); - // we now call produce() to instruct the producer transport - // to send media to the Router - // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce - // this action will trigger the 'connect' and 'produce' events above - producer = await producerTransport.produce(params) + setTimeout(() => { + console.log('[connectSendTransport]'); + // we now call produce() to instruct the producer transport + // to send media to the Router + // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce + // this action will trigger the 'connect' and 'produce' events above + producer = await producerTransport.produce(params) + + producer.on('trackended', () => { + console.log('track ended') + // close video track + }) + + producer.on('transportclose', () => { + console.log('transport ended') + // close video track + }) + + // Enable Close call button + const closeCallBtn = document.getElementById('btnCloseCall'); + closeCallBtn.removeAttribute('disabled'); - producer.on('trackended', () => { - console.log('track ended') - // close video track - }) - - producer.on('transportclose', () => { - console.log('transport ended') - // close video track - }) - - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); - - // setTimeout(() => { - // hub.emit( - // 'video', - // JSON.stringify(answer) - // ); - // }, 7000); - - // Enable Close call button - const closeCallBtn = document.getElementById('btnCloseCall'); - closeCallBtn.removeAttribute('disabled'); + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; + console.log('SEND answer', answer); + hub.emit( + 'video', + JSON.stringify(answer) + ); + }, 7000); } const createRecvTransport = async () => { -- 2.37.1 From dbd4202d3e56d5a21fdcf7637c92fab5450385e3 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 18:23:43 +0300 Subject: [PATCH 13/13] Send answer and connect to transport layer created with 7s delay --- public/bundle.js | 85 +++++++++++++++++++++++++----------------------- public/index.js | 14 ++++---- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 0b0166f..60078b4 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20653,8 +20653,8 @@ module.exports = yeast; },{}],95:[function(require,module,exports){ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', - // mediasoupAddress: 'https://video.safemobile.org/mediasoup', - mediasoupAddress: 'http://localhost:3000/mediasoup', + mediasoupAddress: 'https://video.safemobile.org/mediasoup', + // mediasoupAddress: 'http://localhost:3000/mediasoup', } },{}],96:[function(require,module,exports){ const io = require('socket.io-client') @@ -20866,6 +20866,7 @@ const getRtpCapabilities = () => { } const createSendTransport = () => { + // see server's socket.on('createWebRtcTransport', sender?, ...) // this is a call from Producer, so sender = true socket.emit('createWebRtcTransport', { sender: true, callId }, ({ params }) => { @@ -20876,7 +20877,7 @@ const createSendTransport = () => { return } - console.log(params) + console.log('params', params) // creates a new WebRTC Transport to send media // based on the server's producer transport params @@ -20903,7 +20904,7 @@ const createSendTransport = () => { }) producerTransport.on('produce', async (parameters, callback, errback) => { - console.log(parameters) + console.log('produce', parameters) try { // tell the server to create a Producer @@ -20915,56 +20916,59 @@ const createSendTransport = () => { rtpParameters: parameters.rtpParameters, appData: parameters.appData, }, ({ id }) => { + console.log('[transport-produce] callback | id', id); // Tell the transport that parameters were transmitted and provide it with the // server side producer's id. callback({ id }) }) } catch (error) { + console.log('ERROR | produce |', error); errback(error) } }) - connectSendTransport() }) } const connectSendTransport = async () => { + console.log('[connectSendTransport]'); // we now call produce() to instruct the producer transport // to send media to the Router // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce // this action will trigger the 'connect' and 'produce' events above producer = await producerTransport.produce(params) + + setTimeout(() => { + producer.on('trackended', () => { + console.log('track ended') + // close video track + }) + + producer.on('transportclose', () => { + console.log('transport ended') + // close video track + }) + + // Enable Close call button + const closeCallBtn = document.getElementById('btnCloseCall'); + closeCallBtn.removeAttribute('disabled'); - producer.on('trackended', () => { - console.log('track ended') - // close video track - }) - - producer.on('transportclose', () => { - console.log('transport ended') - // close video track - }) - - const answer = { - origin_asset_id: ASSET_ID, - dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - type: 'notify-answer', - origin_asset_priority: 1, - origin_asset_type_name: ASSET_TYPE, - origin_asset_name: ASSET_NAME, - video_call_id: callId, - answer: 'accepted', // answer: 'rejected' - }; - console.log('SEND answer', answer); - - hub.emit( - 'video', - JSON.stringify(answer) - ); - - // Enable Close call button - const closeCallBtn = document.getElementById('btnCloseCall'); - closeCallBtn.removeAttribute('disabled'); + const answer = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-answer', + origin_asset_priority: 1, + origin_asset_type_name: ASSET_TYPE, + origin_asset_name: ASSET_NAME, + video_call_id: callId, + answer: 'accepted', // answer: 'rejected' + }; + console.log('SEND answer', answer); + hub.emit( + 'video', + JSON.stringify(answer) + ); + }, 7000); } const createRecvTransport = async () => { @@ -21009,7 +21013,6 @@ const createRecvTransport = async () => { } const resetCallSettings = () => { - socket.emit('transportclose', { callId }) localVideo.srcObject = null remoteVideo.srcObject = null consumer = null @@ -21057,12 +21060,12 @@ const connectRecvTransport = async () => { const closeCall = () => { console.log('closeCall'); - + // 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', + 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) @@ -21072,7 +21075,7 @@ const closeCall = () => { const closeCallBtn = document.getElementById('btnCloseCall') closeCallBtn.setAttribute('disabled', '') - // Reset settings and send closeTransport to video server + // Reset settings resetCallSettings() } diff --git a/public/index.js b/public/index.js index 055d5aa..b2028e0 100644 --- a/public/index.js +++ b/public/index.js @@ -272,14 +272,14 @@ const createSendTransport = () => { } const connectSendTransport = async () => { - setTimeout(() => { - console.log('[connectSendTransport]'); - // we now call produce() to instruct the producer transport - // to send media to the Router - // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce - // this action will trigger the 'connect' and 'produce' events above - producer = await producerTransport.produce(params) + console.log('[connectSendTransport]'); + // we now call produce() to instruct the producer transport + // to send media to the Router + // https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce + // this action will trigger the 'connect' and 'produce' events above + producer = await producerTransport.produce(params) + setTimeout(() => { producer.on('trackended', () => { console.log('track ended') // close video track -- 2.37.1