Update package.json(build/dev start commands); Added README

This commit is contained in:
Sergiu Toma 2022-08-09 18:58:17 +03:00
parent 9cc00c05fd
commit c8a774a903
5 changed files with 3378 additions and 75 deletions

View File

@ -1,2 +1,29 @@
Generate keys command:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
# Video server
### Development
##### To start in development mode you must:
1. Install the dependencies `npm install`.
2. Run the `npm start:dev` command to start the server in dev mode.
(Any change will trigger a refresh of the server)
### Production
##### To start in production mode you must:
1. Install the dependencies `npm install`.
2. Run the `npm start:prod` command to start the server in production mode.
(To connect to the terminal, use `pm2 log video-server`)
---
- The server will start by default on port 3000, and the ssl certificates will have to be configured
- The web client can be accessed using the /sfu path
ex: http://localhost:3000/sfu/?assetId=1&&accountId=1&producer=true&assetName=Adi&assetType=linx
assetId = asset id of the unit on which you are doing the test
accountId = account id of the unit on which you are doing the test
producer = it will always be true because you are the producer
(it's possible to put false, but then you have to have another client with producer true)
assetName = asset name of the unit on which you are doing the test
assetType = asset type of the unit on which you are doing the test

3342
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,8 @@
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon app.js",
"start:dev": "nodemon app.js",
"start:prod": "pm2 start ./app.js -n video-server",
"watch": "watchify public/index.js -o public/bundle.js -v"
},
"keywords": [],
@ -19,12 +20,11 @@
"mediasoup": "^3.10.4",
"mediasoup-client": "^3.6.54",
"socket.io": "^2.0.3",
"socket.io-client": "^2.0.3",
"nodemon": "^2.0.19",
"watchify": "^4.0.0"
"socket.io-client": "^2.0.3"
},
"devDependencies": {
"nodemon": "^2.0.19",
"pm2": "^5.2.0",
"watchify": "^4.0.0"
}
}

View File

@ -20723,7 +20723,6 @@ if (IS_PRODUCER === true) {
if (parsedData.type === 'notify-end') {
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
socket.emit('transportclose')
resetCallSettings()
}
})
@ -21010,6 +21009,7 @@ const createRecvTransport = async () => {
}
const resetCallSettings = () => {
socket.emit('transportclose')
localVideo.srcObject = null
remoteVideo.srcObject = null
consumer = null
@ -21058,38 +21058,6 @@ const connectRecvTransport = async () => {
const closeCall = () => {
console.log('closeCall');
// hub.emit(
// 'ars',
// JSON.stringify({
// ars: true,
// asset_id: ASSET_ID,
// account_id: ACCOUNT_ID,
// })
// );
// hub.emit(
// 'video',
// JSON.stringify(answer)
// );
// {
// origin_asset_id: client41.AppData.getUser().asset.id,
// dest_asset_id: answerJsonResponse.origin_asset_id,
// type: 'notify-end',
// video_call_id: answerJsonResponse.video_call_id
// }
// 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: originAssetTypeName,
// origin_asset_name: originAssetName,
// video_call_id: callId,
// answer: 'accepted', // answer: 'rejected'
// };
// Emit 'notify-end' to Hub so the consumer will know to close the video
const notifyEnd = {
origin_asset_id: ASSET_ID,
@ -21103,6 +21071,8 @@ const closeCall = () => {
// Disable Close call button
const closeCallBtn = document.getElementById('btnCloseCall')
closeCallBtn.setAttribute('disabled', '')
// Reset settings and send closeTransport to video server
resetCallSettings()
}

View File

@ -64,7 +64,6 @@ if (IS_PRODUCER === true) {
if (parsedData.type === 'notify-end') {
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
socket.emit('transportclose')
resetCallSettings()
}
})
@ -351,6 +350,7 @@ const createRecvTransport = async () => {
}
const resetCallSettings = () => {
socket.emit('transportclose')
localVideo.srcObject = null
remoteVideo.srcObject = null
consumer = null
@ -399,38 +399,6 @@ const connectRecvTransport = async () => {
const closeCall = () => {
console.log('closeCall');
// hub.emit(
// 'ars',
// JSON.stringify({
// ars: true,
// asset_id: ASSET_ID,
// account_id: ACCOUNT_ID,
// })
// );
// hub.emit(
// 'video',
// JSON.stringify(answer)
// );
// {
// origin_asset_id: client41.AppData.getUser().asset.id,
// dest_asset_id: answerJsonResponse.origin_asset_id,
// type: 'notify-end',
// video_call_id: answerJsonResponse.video_call_id
// }
// 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: originAssetTypeName,
// origin_asset_name: originAssetName,
// video_call_id: callId,
// answer: 'accepted', // answer: 'rejected'
// };
// Emit 'notify-end' to Hub so the consumer will know to close the video
const notifyEnd = {
origin_asset_id: ASSET_ID,
@ -444,6 +412,8 @@ const closeCall = () => {
// Disable Close call button
const closeCallBtn = document.getElementById('btnCloseCall')
closeCallBtn.setAttribute('disabled', '')
// Reset settings and send closeTransport to video server
resetCallSettings()
}