From ab540b276adf1ebf29205f17007c87464ee1f8dc Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 5 Sep 2022 18:07:35 +0300 Subject: [PATCH] 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 () => {