Update package.json(build/dev start commands); Added README
This commit is contained in:
parent
9cc00c05fd
commit
c8a774a903
31
README.md
31
README.md
@ -1,2 +1,29 @@
|
|||||||
Generate keys command:
|
# Video server
|
||||||
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
|
|
||||||
|
|
||||||
|
### 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
3342
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,8 @@
|
|||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"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"
|
"watch": "watchify public/index.js -o public/bundle.js -v"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@ -19,12 +20,11 @@
|
|||||||
"mediasoup": "^3.10.4",
|
"mediasoup": "^3.10.4",
|
||||||
"mediasoup-client": "^3.6.54",
|
"mediasoup-client": "^3.6.54",
|
||||||
"socket.io": "^2.0.3",
|
"socket.io": "^2.0.3",
|
||||||
"socket.io-client": "^2.0.3",
|
"socket.io-client": "^2.0.3"
|
||||||
"nodemon": "^2.0.19",
|
|
||||||
"watchify": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.19",
|
"nodemon": "^2.0.19",
|
||||||
|
"pm2": "^5.2.0",
|
||||||
"watchify": "^4.0.0"
|
"watchify": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20723,7 +20723,6 @@ if (IS_PRODUCER === true) {
|
|||||||
|
|
||||||
if (parsedData.type === 'notify-end') {
|
if (parsedData.type === 'notify-end') {
|
||||||
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
socket.emit('transportclose')
|
|
||||||
resetCallSettings()
|
resetCallSettings()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -21010,6 +21009,7 @@ const createRecvTransport = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const resetCallSettings = () => {
|
const resetCallSettings = () => {
|
||||||
|
socket.emit('transportclose')
|
||||||
localVideo.srcObject = null
|
localVideo.srcObject = null
|
||||||
remoteVideo.srcObject = null
|
remoteVideo.srcObject = null
|
||||||
consumer = null
|
consumer = null
|
||||||
@ -21058,38 +21058,6 @@ const connectRecvTransport = async () => {
|
|||||||
const closeCall = () => {
|
const closeCall = () => {
|
||||||
console.log('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
|
// Emit 'notify-end' to Hub so the consumer will know to close the video
|
||||||
const notifyEnd = {
|
const notifyEnd = {
|
||||||
origin_asset_id: ASSET_ID,
|
origin_asset_id: ASSET_ID,
|
||||||
@ -21103,6 +21071,8 @@ const closeCall = () => {
|
|||||||
// Disable Close call button
|
// Disable Close call button
|
||||||
const closeCallBtn = document.getElementById('btnCloseCall')
|
const closeCallBtn = document.getElementById('btnCloseCall')
|
||||||
closeCallBtn.setAttribute('disabled', '')
|
closeCallBtn.setAttribute('disabled', '')
|
||||||
|
|
||||||
|
// Reset settings and send closeTransport to video server
|
||||||
resetCallSettings()
|
resetCallSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ if (IS_PRODUCER === true) {
|
|||||||
|
|
||||||
if (parsedData.type === 'notify-end') {
|
if (parsedData.type === 'notify-end') {
|
||||||
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
socket.emit('transportclose')
|
|
||||||
resetCallSettings()
|
resetCallSettings()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -351,6 +350,7 @@ const createRecvTransport = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const resetCallSettings = () => {
|
const resetCallSettings = () => {
|
||||||
|
socket.emit('transportclose')
|
||||||
localVideo.srcObject = null
|
localVideo.srcObject = null
|
||||||
remoteVideo.srcObject = null
|
remoteVideo.srcObject = null
|
||||||
consumer = null
|
consumer = null
|
||||||
@ -399,38 +399,6 @@ const connectRecvTransport = async () => {
|
|||||||
const closeCall = () => {
|
const closeCall = () => {
|
||||||
console.log('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
|
// Emit 'notify-end' to Hub so the consumer will know to close the video
|
||||||
const notifyEnd = {
|
const notifyEnd = {
|
||||||
origin_asset_id: ASSET_ID,
|
origin_asset_id: ASSET_ID,
|
||||||
@ -444,6 +412,8 @@ const closeCall = () => {
|
|||||||
// Disable Close call button
|
// Disable Close call button
|
||||||
const closeCallBtn = document.getElementById('btnCloseCall')
|
const closeCallBtn = document.getElementById('btnCloseCall')
|
||||||
closeCallBtn.setAttribute('disabled', '')
|
closeCallBtn.setAttribute('disabled', '')
|
||||||
|
|
||||||
|
// Reset settings and send closeTransport to video server
|
||||||
resetCallSettings()
|
resetCallSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user