Added logs

This commit is contained in:
Sergiu Toma 2022-08-05 11:32:40 +03:00
parent 222ff46655
commit d07df95652
3 changed files with 33 additions and 8 deletions

View File

@ -20654,9 +20654,8 @@ module.exports = yeast;
module.exports = { 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',
// mediasoupAddress: 'http://localhost:3000/mediasoup',
} }
},{}],96:[function(require,module,exports){ },{}],96:[function(require,module,exports){
const io = require('socket.io-client') const io = require('socket.io-client')
const mediasoupClient = require('mediasoup-client') const mediasoupClient = require('mediasoup-client')
@ -20675,7 +20674,12 @@ hub = io(config.hubAddress)
const connectToMediasoup = () => { const connectToMediasoup = () => {
socket = io(config.mediasoupAddress) socket = io(config.mediasoupAddress, {
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax : 5000,
reconnectionAttempts: Infinity
})
socket.on('connection-success', ({ _socketId, existsProducer }) => { socket.on('connection-success', ({ _socketId, existsProducer }) => {
console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`)
@ -20703,17 +20707,32 @@ 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') {
// NOT WORKING
localVideo.srcObject = null
remoteVideo.srcObject = null
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
// socket.emit('transportclose')
socket.emit('transportclose')
consumer = null
producer = null
producerTransport = null
consumerTransport = null
device = null
socket.destroy()
}
}) })
}) })
@ -20770,6 +20789,7 @@ let params = {
} }
const streamSuccess = (stream) => { const streamSuccess = (stream) => {
console.log('[streamSuccess]');
localVideo.srcObject = stream localVideo.srcObject = stream
const track = stream.getVideoTracks()[0] const track = stream.getVideoTracks()[0]
params = { params = {
@ -20812,6 +20832,7 @@ const goCreateTransport = () => {
// server side to send/recive media // server side to send/recive media
const createDevice = async () => { const createDevice = async () => {
try { try {
console.log('[createDevice]');
device = new mediasoupClient.Device() device = new mediasoupClient.Device()
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#device-load // https://mediasoup.org/documentation/v3/mediasoup-client/api/#device-load
@ -20834,6 +20855,7 @@ const createDevice = async () => {
} }
const getRtpCapabilities = () => { const getRtpCapabilities = () => {
console.log('[getRtpCapabilities]');
// make a request to the server for Router RTP Capabilities // make a request to the server for Router RTP Capabilities
// see server's socket.on('getRtpCapabilities', ...) // see server's socket.on('getRtpCapabilities', ...)
// the server sends back data object which contains rtpCapabilities // the server sends back data object which contains rtpCapabilities
@ -20921,7 +20943,6 @@ const connectSendTransport = async () => {
producer.on('trackended', () => { producer.on('trackended', () => {
console.log('track ended') console.log('track ended')
// close video track // close video track
}) })

View File

@ -1,4 +1,5 @@
module.exports = { 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',
// mediasoupAddress: 'http://localhost:3000/mediasoup',
} }

View File

@ -130,6 +130,7 @@ let params = {
} }
const streamSuccess = (stream) => { const streamSuccess = (stream) => {
console.log('[streamSuccess]');
localVideo.srcObject = stream localVideo.srcObject = stream
const track = stream.getVideoTracks()[0] const track = stream.getVideoTracks()[0]
params = { params = {
@ -172,6 +173,7 @@ const goCreateTransport = () => {
// server side to send/recive media // server side to send/recive media
const createDevice = async () => { const createDevice = async () => {
try { try {
console.log('[createDevice]');
device = new mediasoupClient.Device() device = new mediasoupClient.Device()
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#device-load // https://mediasoup.org/documentation/v3/mediasoup-client/api/#device-load
@ -194,6 +196,7 @@ const createDevice = async () => {
} }
const getRtpCapabilities = () => { const getRtpCapabilities = () => {
console.log('[getRtpCapabilities]');
// make a request to the server for Router RTP Capabilities // make a request to the server for Router RTP Capabilities
// see server's socket.on('getRtpCapabilities', ...) // see server's socket.on('getRtpCapabilities', ...)
// the server sends back data object which contains rtpCapabilities // the server sends back data object which contains rtpCapabilities