Update server
This commit is contained in:
parent
3bc15fdef1
commit
e085d22e89
37
app.js
37
app.js
@ -397,29 +397,30 @@ peers.on('connection', async socket => {
|
|||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoCalls[callId].consumerAudio = await videoCalls[callId].consumerTransport.consume({
|
|
||||||
producerId: videoCalls[callId].producerAudio.id,
|
|
||||||
rtpCapabilities,
|
|
||||||
paused: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
|
// videoCalls[callId].consumerAudio = await videoCalls[callId].consumerTransport.consume({
|
||||||
videoCalls[callId].consumerAudio.on('transportclose', () => {
|
// producerId: videoCalls[callId].producerAudio.id,
|
||||||
const callId = socketDetails[socket.id];
|
// rtpCapabilities,
|
||||||
console.log('transport close from consumer', callId);
|
// paused: true,
|
||||||
closeCall(callId);
|
// });
|
||||||
});
|
|
||||||
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose
|
// // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
|
||||||
videoCalls[callId].consumerAudio.on('producerclose', () => {
|
// videoCalls[callId].consumerAudio.on('transportclose', () => {
|
||||||
const callId = socketDetails[socket.id];
|
// const callId = socketDetails[socket.id];
|
||||||
console.log('producer of consumer closed', callId);
|
// console.log('transport close from consumer', callId);
|
||||||
closeCall(callId);
|
// closeCall(callId);
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
// // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose
|
||||||
|
// videoCalls[callId].consumerAudio.on('producerclose', () => {
|
||||||
|
// const callId = socketDetails[socket.id];
|
||||||
|
// console.log('producer of consumer closed', callId);
|
||||||
|
// closeCall(callId);
|
||||||
|
// });
|
||||||
|
|
||||||
console.log('🟠 videoCalls[callId].consumerVideo', videoCalls[callId].consumerVideo);
|
|
||||||
console.log('🟠 videoCalls[callId].consumerAudio', videoCalls[callId].consumerAudio);
|
console.log('🟠 videoCalls[callId].consumerAudio', videoCalls[callId].consumerAudio);
|
||||||
|
|
||||||
|
|
||||||
// From the consumer extract the following params to send back to the Client
|
// From the consumer extract the following params to send back to the Client
|
||||||
const videoParams = {
|
const videoParams = {
|
||||||
id: videoCalls[callId].consumerVideo.id,
|
id: videoCalls[callId].consumerVideo.id,
|
||||||
|
@ -20372,8 +20372,38 @@ console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId',
|
|||||||
|
|
||||||
console.log('🟩 config', config)
|
console.log('🟩 config', config)
|
||||||
|
|
||||||
let socket, hub, having
|
let socket, hub
|
||||||
let doIHaveAudio = false
|
let doIHaveAudio = false
|
||||||
|
let device
|
||||||
|
let rtpCapabilities
|
||||||
|
let producerTransport
|
||||||
|
let consumerTransport
|
||||||
|
let producerVideo
|
||||||
|
let producerAudio
|
||||||
|
let consumer
|
||||||
|
let originAssetId
|
||||||
|
|
||||||
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
||||||
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
||||||
|
let videoParams = {
|
||||||
|
encodings: [
|
||||||
|
{ scaleResolutionDownBy: 4, maxBitrate: 500000 },
|
||||||
|
{ scaleResolutionDownBy: 2, maxBitrate: 1000000 },
|
||||||
|
{ scaleResolutionDownBy: 1, maxBitrate: 5000000 },
|
||||||
|
{ scalabilityMode: 'S3T3_KEY' }
|
||||||
|
],
|
||||||
|
codecOptions: {
|
||||||
|
videoGoogleStartBitrate: 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let audioParams = {
|
||||||
|
codecOptions :
|
||||||
|
{
|
||||||
|
opusStereo : true,
|
||||||
|
opusDtx : true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hub = io(config.hubAddress)
|
hub = io(config.hubAddress)
|
||||||
@ -20449,60 +20479,6 @@ setTimeout(() => {
|
|||||||
|
|
||||||
}, 1600);
|
}, 1600);
|
||||||
|
|
||||||
|
|
||||||
let device
|
|
||||||
let rtpCapabilities
|
|
||||||
let producerTransport
|
|
||||||
let consumerTransport
|
|
||||||
let producerVideo
|
|
||||||
let producerAudio
|
|
||||||
let consumer
|
|
||||||
let originAssetId
|
|
||||||
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
|
||||||
let videoParams = {
|
|
||||||
encodings: [
|
|
||||||
{ scaleResolutionDownBy: 4, maxBitrate: 500000 },
|
|
||||||
{ scaleResolutionDownBy: 2, maxBitrate: 1000000 },
|
|
||||||
{ scaleResolutionDownBy: 1, maxBitrate: 5000000 },
|
|
||||||
{ scalabilityMode: 'S3T3_KEY' }
|
|
||||||
],
|
|
||||||
codecOptions: {
|
|
||||||
videoGoogleStartBitrate: 1000
|
|
||||||
}
|
|
||||||
// encodings: [
|
|
||||||
// {
|
|
||||||
// rid: 'r0',
|
|
||||||
// maxBitrate: 100000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// rid: 'r1',
|
|
||||||
// maxBitrate: 300000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// rid: 'r2',
|
|
||||||
// maxBitrate: 900000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// // https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerCodecOptions
|
|
||||||
// codecOptions: {
|
|
||||||
// videoGoogleStartBitrate: 1000
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
let audioParams = {
|
|
||||||
codecOptions :
|
|
||||||
{
|
|
||||||
opusStereo : true,
|
|
||||||
opusDtx : true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const streamSuccess = (stream) => {
|
const streamSuccess = (stream) => {
|
||||||
console.log('[streamSuccess] device', device);
|
console.log('[streamSuccess] device', device);
|
||||||
localVideo.srcObject = stream
|
localVideo.srcObject = stream
|
||||||
@ -20713,6 +20689,8 @@ const connectSendTransport = async () => {
|
|||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Video is mandatory, but audio may not be included
|
||||||
|
if (doIHaveAudio) {
|
||||||
console.log('audioParams', audioParams);
|
console.log('audioParams', audioParams);
|
||||||
producerAudio = await producerTransport.produce(audioParams)
|
producerAudio = await producerTransport.produce(audioParams)
|
||||||
console.log('producerAudio', producerAudio);
|
console.log('producerAudio', producerAudio);
|
||||||
@ -20723,14 +20701,9 @@ const connectSendTransport = async () => {
|
|||||||
|
|
||||||
producerAudio.on('transportclose', () => {
|
producerAudio.on('transportclose', () => {
|
||||||
console.log('transport ended')
|
console.log('transport ended')
|
||||||
|
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const answer = {
|
const answer = {
|
||||||
origin_asset_id: ASSET_ID,
|
origin_asset_id: ASSET_ID,
|
||||||
|
@ -14,8 +14,38 @@ console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId',
|
|||||||
|
|
||||||
console.log('🟩 config', config)
|
console.log('🟩 config', config)
|
||||||
|
|
||||||
let socket, hub, having
|
let socket, hub
|
||||||
let doIHaveAudio = false
|
let doIHaveAudio = false
|
||||||
|
let device
|
||||||
|
let rtpCapabilities
|
||||||
|
let producerTransport
|
||||||
|
let consumerTransport
|
||||||
|
let producerVideo
|
||||||
|
let producerAudio
|
||||||
|
let consumer
|
||||||
|
let originAssetId
|
||||||
|
|
||||||
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
||||||
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
||||||
|
let videoParams = {
|
||||||
|
encodings: [
|
||||||
|
{ scaleResolutionDownBy: 4, maxBitrate: 500000 },
|
||||||
|
{ scaleResolutionDownBy: 2, maxBitrate: 1000000 },
|
||||||
|
{ scaleResolutionDownBy: 1, maxBitrate: 5000000 },
|
||||||
|
{ scalabilityMode: 'S3T3_KEY' }
|
||||||
|
],
|
||||||
|
codecOptions: {
|
||||||
|
videoGoogleStartBitrate: 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let audioParams = {
|
||||||
|
codecOptions :
|
||||||
|
{
|
||||||
|
opusStereo : true,
|
||||||
|
opusDtx : true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hub = io(config.hubAddress)
|
hub = io(config.hubAddress)
|
||||||
@ -91,60 +121,6 @@ setTimeout(() => {
|
|||||||
|
|
||||||
}, 1600);
|
}, 1600);
|
||||||
|
|
||||||
|
|
||||||
let device
|
|
||||||
let rtpCapabilities
|
|
||||||
let producerTransport
|
|
||||||
let consumerTransport
|
|
||||||
let producerVideo
|
|
||||||
let producerAudio
|
|
||||||
let consumer
|
|
||||||
let originAssetId
|
|
||||||
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
|
||||||
let videoParams = {
|
|
||||||
encodings: [
|
|
||||||
{ scaleResolutionDownBy: 4, maxBitrate: 500000 },
|
|
||||||
{ scaleResolutionDownBy: 2, maxBitrate: 1000000 },
|
|
||||||
{ scaleResolutionDownBy: 1, maxBitrate: 5000000 },
|
|
||||||
{ scalabilityMode: 'S3T3_KEY' }
|
|
||||||
],
|
|
||||||
codecOptions: {
|
|
||||||
videoGoogleStartBitrate: 1000
|
|
||||||
}
|
|
||||||
// encodings: [
|
|
||||||
// {
|
|
||||||
// rid: 'r0',
|
|
||||||
// maxBitrate: 100000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// rid: 'r1',
|
|
||||||
// maxBitrate: 300000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// rid: 'r2',
|
|
||||||
// maxBitrate: 900000,
|
|
||||||
// scalabilityMode: 'S1T3',
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// // https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerCodecOptions
|
|
||||||
// codecOptions: {
|
|
||||||
// videoGoogleStartBitrate: 1000
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
let audioParams = {
|
|
||||||
codecOptions :
|
|
||||||
{
|
|
||||||
opusStereo : true,
|
|
||||||
opusDtx : true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const streamSuccess = (stream) => {
|
const streamSuccess = (stream) => {
|
||||||
console.log('[streamSuccess] device', device);
|
console.log('[streamSuccess] device', device);
|
||||||
localVideo.srcObject = stream
|
localVideo.srcObject = stream
|
||||||
@ -355,6 +331,8 @@ const connectSendTransport = async () => {
|
|||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Video is mandatory, but audio may not be included
|
||||||
|
if (doIHaveAudio) {
|
||||||
console.log('audioParams', audioParams);
|
console.log('audioParams', audioParams);
|
||||||
producerAudio = await producerTransport.produce(audioParams)
|
producerAudio = await producerTransport.produce(audioParams)
|
||||||
console.log('producerAudio', producerAudio);
|
console.log('producerAudio', producerAudio);
|
||||||
@ -365,14 +343,9 @@ const connectSendTransport = async () => {
|
|||||||
|
|
||||||
producerAudio.on('transportclose', () => {
|
producerAudio.on('transportclose', () => {
|
||||||
console.log('transport ended')
|
console.log('transport ended')
|
||||||
|
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const answer = {
|
const answer = {
|
||||||
origin_asset_id: ASSET_ID,
|
origin_asset_id: ASSET_ID,
|
||||||
|
Loading…
Reference in New Issue
Block a user