Close producer when dispatcher close the window
This commit is contained in:
parent
809e343d67
commit
ea8d4268ec
@ -2,4 +2,3 @@ module.exports = {
|
|||||||
hubAddress: 'https://hub.dev.linx.safemobile.com/',
|
hubAddress: 'https://hub.dev.linx.safemobile.com/',
|
||||||
mediasoupAddress: 'https://video.safemobile.org/mediasoup',
|
mediasoupAddress: 'https://video.safemobile.org/mediasoup',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,17 +43,24 @@ if (IS_PRODUCER === true) {
|
|||||||
|
|
||||||
hub.on('video', (data) => {
|
hub.on('video', (data) => {
|
||||||
const parsedData = JSON.parse(data);
|
const parsedData = JSON.parse(data);
|
||||||
|
|
||||||
|
if (parsedData.type === 'notify-request') {
|
||||||
console.log('video', parsedData)
|
console.log('video', parsedData)
|
||||||
originAssetId = parsedData.origin_asset_id;
|
originAssetId = parsedData.origin_asset_id;
|
||||||
originAssetName = parsedData.origin_asset_name;
|
originAssetName = parsedData.origin_asset_name;
|
||||||
originAssetTypeName = parsedData.origin_asset_type_name;
|
originAssetTypeName = parsedData.origin_asset_type_name;
|
||||||
callId = parsedData.video_call_id;
|
callId = parsedData.video_call_id;
|
||||||
|
|
||||||
console.log('IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
|
|
||||||
if (parsedData.type === 'notify-request' && IS_PRODUCER) {
|
|
||||||
getLocalStream()
|
getLocalStream()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parsedData.type === 'notify-end') {
|
||||||
|
remoteVideo.srcObject = null;
|
||||||
|
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
|
// socket.emit('transportclose')
|
||||||
|
socket.emit('transportclose')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -261,7 +268,6 @@ const connectSendTransport = async () => {
|
|||||||
|
|
||||||
producer.on('trackended', () => {
|
producer.on('trackended', () => {
|
||||||
console.log('track ended')
|
console.log('track ended')
|
||||||
|
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user