Send answer on createSendTransport

This commit is contained in:
Sergiu Toma 2022-09-05 17:49:24 +03:00
parent b909e7ec58
commit 4e339959b0

View File

@ -155,24 +155,7 @@ const getLocalStream = () => {
const goConnect = () => { const goConnect = () => {
console.log('[goConnect] device:', device); 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() device === undefined ? getRtpCapabilities() : goCreateTransport()
}, 7000);
} }
const goCreateTransport = () => { const goCreateTransport = () => {
@ -224,6 +207,27 @@ const getRtpCapabilities = () => {
} }
const createSendTransport = () => { 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?, ...) // see server's socket.on('createWebRtcTransport', sender?, ...)
// this is a call from Producer, so sender = true // this is a call from Producer, so sender = true
socket.emit('createWebRtcTransport', { sender: true, callId }, ({ params }) => { socket.emit('createWebRtcTransport', { sender: true, callId }, ({ params }) => {
@ -305,17 +309,17 @@ const connectSendTransport = async () => {
// close video track // close video track
}) })
// const answer = { const answer = {
// origin_asset_id: ASSET_ID, origin_asset_id: ASSET_ID,
// dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')),
// type: 'notify-answer', type: 'notify-answer',
// origin_asset_priority: 1, origin_asset_priority: 1,
// origin_asset_type_name: ASSET_TYPE, origin_asset_type_name: ASSET_TYPE,
// origin_asset_name: ASSET_NAME, origin_asset_name: ASSET_NAME,
// video_call_id: callId, video_call_id: callId,
// answer: 'accepted', // answer: 'rejected' answer: 'accepted', // answer: 'rejected'
// }; };
// console.log('SEND answer', answer); console.log('SEND answer', answer);
// setTimeout(() => { // setTimeout(() => {
// hub.emit( // hub.emit(