Compare commits
7 Commits
e9ff060544
...
fix-branch
Author | SHA1 | Date | |
---|---|---|---|
2e336a429e | |||
b14e82fd87 | |||
c4f72eddd5 | |||
6e4ceb9977 | |||
2c00de1dd0 | |||
f96fd24e03 | |||
fce2f30648 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/dist
|
|
||||||
|
49
app.js
49
app.js
@ -5,12 +5,7 @@ const app = express();
|
|||||||
const Server = require('socket.io');
|
const Server = require('socket.io');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
let https;
|
const https = require('https');
|
||||||
try {
|
|
||||||
https = require('node:https');
|
|
||||||
} catch (err) {
|
|
||||||
console.log('https support is disabled!');
|
|
||||||
}
|
|
||||||
const mediasoup = require('mediasoup');
|
const mediasoup = require('mediasoup');
|
||||||
|
|
||||||
let worker
|
let worker
|
||||||
@ -42,8 +37,8 @@ app.use('/sfu', express.static(path.join(__dirname, 'public')))
|
|||||||
|
|
||||||
// SSL cert for HTTPS access
|
// SSL cert for HTTPS access
|
||||||
const options = {
|
const options = {
|
||||||
key: fs.readFileSync(process.env.SERVER_KEY, 'utf-8'),
|
key: fs.readFileSync('./server/ssl/key.pem', 'utf-8'),
|
||||||
cert: fs.readFileSync(process.env.SERVER_CERT, 'utf-8'),
|
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8'),
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpsServer = https.createServer(options, app);
|
const httpsServer = https.createServer(options, app);
|
||||||
@ -63,12 +58,13 @@ httpsServer.listen(process.env.PORT, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const peers = io.of('/');
|
const peers = io.of('/');
|
||||||
|
console.log('process.env.RTC_MIN_PORT', process.env.RTC_MIN_PORT);
|
||||||
|
console.log('process.env.RTC_MAX_PORT', process.env.RTC_MAX_PORT, process.env.RTC_MAX_PORT.length);
|
||||||
const createWorker = async () => {
|
const createWorker = async () => {
|
||||||
try {
|
try {
|
||||||
worker = await mediasoup.createWorker({
|
worker = await mediasoup.createWorker({
|
||||||
rtcMinPort: parseInt(process.env.RTC_MIN_PORT),
|
rtcMinPort: process.env.RTC_MIN_PORT,
|
||||||
rtcMaxPort: parseInt(process.env.RTC_MAX_PORT),
|
rtcMaxPort: process.env.RTC_MAX_PORT,
|
||||||
})
|
})
|
||||||
console.log(`[createWorker] worker pid ${worker.pid}`);
|
console.log(`[createWorker] worker pid ${worker.pid}`);
|
||||||
|
|
||||||
@ -124,6 +120,16 @@ const closeCall = (callId) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRtpCapabilities = (callId, callback) => {
|
||||||
|
try {
|
||||||
|
console.log('[getRtpCapabilities] callId', callId);
|
||||||
|
const rtpCapabilities = videoCalls[callId].router.rtpCapabilities;
|
||||||
|
callback({ rtpCapabilities });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`ERROR | getRtpCapabilities | callId ${callId} | ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- Handlers for WS events
|
- Handlers for WS events
|
||||||
- These are created only when we have a connection with a peer
|
- These are created only when we have a connection with a peer
|
||||||
@ -150,9 +156,7 @@ peers.on('connection', async socket => {
|
|||||||
- If the room already exists, it will not create it, but will only return rtpCapabilities
|
- If the room already exists, it will not create it, but will only return rtpCapabilities
|
||||||
*/
|
*/
|
||||||
socket.on('createRoom', async ({ callId }, callback) => {
|
socket.on('createRoom', async ({ callId }, callback) => {
|
||||||
let callbackResponse = null;
|
|
||||||
try {
|
try {
|
||||||
// We can continue with the room creation process only if we have a callId
|
|
||||||
if (callId) {
|
if (callId) {
|
||||||
console.log(`[createRoom] socket.id ${socket.id} callId ${callId}`);
|
console.log(`[createRoom] socket.id ${socket.id} callId ${callId}`);
|
||||||
if (!videoCalls[callId]) {
|
if (!videoCalls[callId]) {
|
||||||
@ -161,19 +165,12 @@ peers.on('connection', async socket => {
|
|||||||
console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`);
|
console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`);
|
||||||
}
|
}
|
||||||
socketDetails[socket.id] = callId;
|
socketDetails[socket.id] = callId;
|
||||||
|
getRtpCapabilities(callId, callback);
|
||||||
// rtpCapabilities is set for callback
|
|
||||||
console.log('[getRtpCapabilities] callId', callId);
|
|
||||||
callbackResponse = {
|
|
||||||
rtpCapabilities :videoCalls[callId].router.rtpCapabilities
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
console.log(`[createRoom] missing callId ${callId}`);
|
console.log(`[createRoom] missing callId ${callId}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ERROR | createRoom | callId ${callId} | ${error.message}`);
|
console.log(`ERROR | createRoom | callId ${callId} | ${error.message}`);
|
||||||
} finally {
|
|
||||||
callback(callbackResponse);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -194,19 +191,16 @@ peers.on('connection', async socket => {
|
|||||||
videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].producerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
} else {
|
} else {
|
||||||
console.log(`producerTransport has already been defined | callId ${callId}`);
|
console.log(`producerTransport has already been defined | callId ${callId}`);
|
||||||
callback(null);
|
|
||||||
}
|
}
|
||||||
} else if (!sender) {
|
} else if (!sender) {
|
||||||
if (!videoCalls[callId].consumerTransport) {
|
if (!videoCalls[callId].consumerTransport) {
|
||||||
videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].consumerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
} else {
|
} else {
|
||||||
console.log(`consumerTransport has already been defined | callId ${callId}`);
|
console.log(`consumerTransport has already been defined | callId ${callId}`);
|
||||||
callback(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ERROR | createWebRtcTransport | callId ${socketDetails[socket.id]} | sender ${sender} | ${error.message}`);
|
console.log(`ERROR | createWebRtcTransport | callId ${socketDetails[socket.id]} | sender ${sender} | ${error.message}`);
|
||||||
callback(error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -250,9 +244,9 @@ peers.on('connection', async socket => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
callback && callback({
|
// callback({
|
||||||
id: videoCalls[callId].producer.id
|
// id: videoCalls[callId].producer.id
|
||||||
});
|
// });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
|
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||||
}
|
}
|
||||||
@ -323,7 +317,6 @@ peers.on('connection', async socket => {
|
|||||||
callback({ params });
|
callback({ params });
|
||||||
} else {
|
} else {
|
||||||
console.log(`[canConsume] Can't consume | callId ${callId}`);
|
console.log(`[canConsume] Can't consume | callId ${callId}`);
|
||||||
callback(null);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ERROR | consume | callId ${socketDetails[socket.id]} | ${error.message}`)
|
console.log(`ERROR | consume | callId ${socketDetails[socket.id]} | ${error.message}`)
|
||||||
|
48
build.sh
48
build.sh
@ -1,48 +0,0 @@
|
|||||||
#/!bin/bash
|
|
||||||
## PREBUILD PROCESS
|
|
||||||
# check dist dir to be present and empty
|
|
||||||
if [ ! -d "dist" ]; then
|
|
||||||
## MAKE DIR
|
|
||||||
mkdir "dist"
|
|
||||||
echo "Directory dist created."
|
|
||||||
else
|
|
||||||
## CLEANUP
|
|
||||||
rm -fr dist/*
|
|
||||||
fi
|
|
||||||
# Install dependencies
|
|
||||||
#npm install
|
|
||||||
|
|
||||||
## PROJECT NEEDS
|
|
||||||
echo "Building app... from $(git rev-parse --abbrev-ref HEAD)"
|
|
||||||
#npm run-script build
|
|
||||||
cp -r {.env,app.js,package.json,server,public} dist/
|
|
||||||
|
|
||||||
#Add version control for pm2
|
|
||||||
cd dist
|
|
||||||
#Add version control for pm2
|
|
||||||
version=$(git describe)
|
|
||||||
file_pkg="package.json"
|
|
||||||
key=" \"version\": \""
|
|
||||||
|
|
||||||
count=$(echo ${version%%-*} | grep -o "\." | wc -l)
|
|
||||||
if (( $count > 1 )); then
|
|
||||||
version=${version%%-*}
|
|
||||||
else
|
|
||||||
version="${version%%-*}.0"
|
|
||||||
fi
|
|
||||||
if [ -f "$file_pkg" ] && [ ! -z "$version" ]; then
|
|
||||||
version=" \"version\": \"$version\","
|
|
||||||
sed -i "s|^.*$key.*|${version//\//\\/}|g" $file_pkg
|
|
||||||
text=$(cat $file_pkg | grep -c "$version")
|
|
||||||
if [ $text -eq 0 ]; then
|
|
||||||
echo "Version couldn't be set"
|
|
||||||
else
|
|
||||||
echo "Version $version successfully applied to App"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## POST BUILD
|
|
||||||
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
|
1276
public/bundle.js
1276
public/bundle.js
File diff suppressed because it is too large
Load Diff
@ -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',
|
mediasoupAddress: 'https://video.safemobile.org/mediasoup',
|
||||||
|
// mediasoupAddress: 'http://localhost:3000/mediasoup',
|
||||||
}
|
}
|
202
public/index.js
202
public/index.js
@ -12,91 +12,83 @@ let callId = parseInt(urlParams.get('callId')) || null;
|
|||||||
const IS_PRODUCER = urlParams.get('producer') === 'true' ? true : false
|
const IS_PRODUCER = urlParams.get('producer') === 'true' ? true : false
|
||||||
console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', callId, ' | IS_PRODUCER', IS_PRODUCER)
|
console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', callId, ' | IS_PRODUCER', IS_PRODUCER)
|
||||||
|
|
||||||
console.log('🟩 config', config)
|
let socket
|
||||||
|
hub = io(config.hubAddress)
|
||||||
|
|
||||||
let socket, hub
|
const connectToMediasoup = () => {
|
||||||
|
|
||||||
setTimeout(() => {
|
socket = io(config.mediasoupAddress, {
|
||||||
hub = io(config.hubAddress)
|
reconnection: true,
|
||||||
|
reconnectionDelay: 1000,
|
||||||
const connectToMediasoup = () => {
|
reconnectionDelayMax : 5000,
|
||||||
|
reconnectionAttempts: Infinity
|
||||||
socket = io(config.mediasoupAddress, {
|
})
|
||||||
reconnection: true,
|
|
||||||
reconnectionDelay: 1000,
|
socket.on('connection-success', ({ _socketId, existsProducer }) => {
|
||||||
reconnectionDelayMax : 5000,
|
console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`)
|
||||||
reconnectionAttempts: Infinity
|
if (!IS_PRODUCER && existsProducer && consumer === undefined) {
|
||||||
})
|
goConnect()
|
||||||
|
// document.getElementById('btnRecvSendTransport').click();
|
||||||
socket.on('connection-success', ({ _socketId, existsProducer }) => {
|
}
|
||||||
console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`)
|
if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() }
|
||||||
if (!IS_PRODUCER && existsProducer && consumer === undefined) {
|
})
|
||||||
goConnect()
|
}
|
||||||
// document.getElementById('btnRecvSendTransport').click();
|
|
||||||
}
|
if (IS_PRODUCER === true) {
|
||||||
if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() }
|
hub.on('connect', async () => {
|
||||||
})
|
console.log(`[HUB] ${config.hubAddress} | connected: ${hub.connected}`)
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_PRODUCER === true) {
|
|
||||||
hub.on('connect', async () => {
|
|
||||||
console.log(`[HUB]! ${config.hubAddress} | connected: ${hub.connected}`)
|
|
||||||
connectToMediasoup()
|
|
||||||
|
|
||||||
hub.emit(
|
|
||||||
'ars',
|
|
||||||
JSON.stringify({
|
|
||||||
ars: true,
|
|
||||||
asset_id: ASSET_ID,
|
|
||||||
account_id: ACCOUNT_ID,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
hub.on('video', (data) => {
|
|
||||||
const parsedData = JSON.parse(data);
|
|
||||||
|
|
||||||
if (parsedData.type === 'notify-request') {
|
|
||||||
console.log('video', parsedData)
|
|
||||||
originAssetId = parsedData.origin_asset_id;
|
|
||||||
// originAssetName = parsedData.origin_asset_name;
|
|
||||||
// originAssetTypeName = parsedData.origin_asset_type_name;
|
|
||||||
callId = parsedData.video_call_id;
|
|
||||||
|
|
||||||
console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
|
||||||
getLocalStream()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parsedData.type === 'notify-end') {
|
|
||||||
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
|
||||||
resetCallSettings()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
hub.on('connect_error', (error) => {
|
|
||||||
console.log('connect_error', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
hub.on('connection', () => {
|
|
||||||
console.log('connection')
|
|
||||||
})
|
|
||||||
|
|
||||||
hub.on('disconnect', () => {
|
|
||||||
console.log('disconnect')
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
connectToMediasoup()
|
connectToMediasoup()
|
||||||
}
|
|
||||||
|
|
||||||
}, 2000);
|
hub.emit(
|
||||||
|
'ars',
|
||||||
|
JSON.stringify({
|
||||||
|
ars: true,
|
||||||
|
asset_id: ASSET_ID,
|
||||||
|
account_id: ACCOUNT_ID,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
hub.on('video', (data) => {
|
||||||
|
const parsedData = JSON.parse(data);
|
||||||
|
|
||||||
|
if (parsedData.type === 'notify-request') {
|
||||||
|
console.log('video', parsedData)
|
||||||
|
originAssetId = parsedData.origin_asset_id;
|
||||||
|
// originAssetName = parsedData.origin_asset_name;
|
||||||
|
// originAssetTypeName = parsedData.origin_asset_type_name;
|
||||||
|
callId = parsedData.video_call_id;
|
||||||
|
|
||||||
|
console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
|
getLocalStream()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsedData.type === 'notify-end') {
|
||||||
|
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
|
resetCallSettings()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
hub.on('connect_error', (error) => {
|
||||||
|
console.log('connect_error', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
hub.on('connection', () => {
|
||||||
|
console.log('connection')
|
||||||
|
})
|
||||||
|
|
||||||
|
hub.on('disconnect', () => {
|
||||||
|
console.log('disconnect')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
connectToMediasoup()
|
||||||
|
}
|
||||||
|
|
||||||
let device
|
let device
|
||||||
let rtpCapabilities
|
let rtpCapabilities
|
||||||
let producerTransport
|
let producerTransport
|
||||||
let consumerTransport
|
let consumerTransport
|
||||||
let producerVideo
|
let producer
|
||||||
let producerAudio
|
|
||||||
let consumer
|
let consumer
|
||||||
let originAssetId
|
let originAssetId
|
||||||
// let originAssetName = 'Adi'
|
// let originAssetName = 'Adi'
|
||||||
@ -104,18 +96,21 @@ let originAssetId
|
|||||||
|
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
||||||
let videoParams = {
|
let params = {
|
||||||
// mediasoup params
|
// mediasoup params
|
||||||
encodings: [
|
encodings: [
|
||||||
{
|
{
|
||||||
|
rid: 'r0',
|
||||||
maxBitrate: 100000,
|
maxBitrate: 100000,
|
||||||
scalabilityMode: 'S1T3',
|
scalabilityMode: 'S1T3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
rid: 'r1',
|
||||||
maxBitrate: 300000,
|
maxBitrate: 300000,
|
||||||
scalabilityMode: 'S1T3',
|
scalabilityMode: 'S1T3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
rid: 'r2',
|
||||||
maxBitrate: 900000,
|
maxBitrate: 900000,
|
||||||
scalabilityMode: 'S1T3',
|
scalabilityMode: 'S1T3',
|
||||||
},
|
},
|
||||||
@ -126,51 +121,21 @@ let videoParams = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let audioParams = {
|
|
||||||
// mediasoup params
|
|
||||||
encodings: [
|
|
||||||
{
|
|
||||||
maxBitrate: 100000,
|
|
||||||
scalabilityMode: 'S1T3',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
maxBitrate: 300000,
|
|
||||||
scalabilityMode: 'S1T3',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
maxBitrate: 900000,
|
|
||||||
scalabilityMode: 'S1T3',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
codecOptions: {
|
|
||||||
opusStereo: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const streamSuccess = (stream) => {
|
const streamSuccess = (stream) => {
|
||||||
|
console.log('[streamSuccess]');
|
||||||
localVideo.srcObject = stream
|
localVideo.srcObject = stream
|
||||||
console.log('stream', stream);
|
const track = stream.getVideoTracks()[0]
|
||||||
const videoTrack = stream.getVideoTracks()[0]
|
params = {
|
||||||
const audioTrack = stream.getAudioTracks()[0]
|
track,
|
||||||
|
...params
|
||||||
videoParams = {
|
|
||||||
track: videoTrack,
|
|
||||||
...videoParams
|
|
||||||
}
|
}
|
||||||
|
|
||||||
audioParams = {
|
|
||||||
track: audioTrack,
|
|
||||||
...audioParams
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('[streamSuccess] videoParams', videoParams, ' | audioParams', audioParams);
|
|
||||||
goConnect()
|
goConnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLocalStream = () => {
|
const getLocalStream = () => {
|
||||||
console.log('[getLocalStream]');
|
console.log('[getLocalStream]');
|
||||||
navigator.mediaDevices.getUserMedia({
|
navigator.mediaDevices.getUserMedia({
|
||||||
audio: true,
|
audio: false,
|
||||||
video: {
|
video: {
|
||||||
width: {
|
width: {
|
||||||
min: 640,
|
min: 640,
|
||||||
@ -279,7 +244,7 @@ const createSendTransport = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
producerTransport.on('produce', async (parameters, callback, errback) => {
|
producerTransport.on('produce', async (parameters, callback, errback) => {
|
||||||
console.log('[produce] parameters', parameters)
|
console.log(parameters)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// tell the server to create a Producer
|
// tell the server to create a Producer
|
||||||
@ -305,21 +270,18 @@ const createSendTransport = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const connectSendTransport = async () => {
|
const connectSendTransport = async () => {
|
||||||
|
|
||||||
console.log('[connectSendTransport] producerTransport', params);
|
|
||||||
|
|
||||||
// we now call produce() to instruct the producer transport
|
// we now call produce() to instruct the producer transport
|
||||||
// to send media to the Router
|
// to send media to the Router
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
|
||||||
// this action will trigger the 'connect' and 'produce' events above
|
// this action will trigger the 'connect' and 'produce' events above
|
||||||
producerVideo = await producerTransport.produce(videoParams)
|
producer = await producerTransport.produce(params)
|
||||||
|
|
||||||
producerVideo.on('trackended', () => {
|
producer.on('trackended', () => {
|
||||||
console.log('track ended')
|
console.log('track ended')
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
|
||||||
producerVideo.on('transportclose', () => {
|
producer.on('transportclose', () => {
|
||||||
console.log('transport ended')
|
console.log('transport ended')
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
@ -391,7 +353,7 @@ const resetCallSettings = () => {
|
|||||||
localVideo.srcObject = null
|
localVideo.srcObject = null
|
||||||
remoteVideo.srcObject = null
|
remoteVideo.srcObject = null
|
||||||
consumer = null
|
consumer = null
|
||||||
producerVideo = null
|
producer = null
|
||||||
producerTransport = null
|
producerTransport = null
|
||||||
consumerTransport = null
|
consumerTransport = null
|
||||||
device = undefined
|
device = undefined
|
||||||
|
Reference in New Issue
Block a user