[mirotalksfu] - add webRtcServer
هذا الالتزام موجود في:
@@ -8,6 +8,8 @@ module.exports = class Room {
|
|||||||
constructor(room_id, worker, io) {
|
constructor(room_id, worker, io) {
|
||||||
this.id = room_id;
|
this.id = room_id;
|
||||||
this.worker = worker;
|
this.worker = worker;
|
||||||
|
this.webRtcServer = worker.appData.webRtcServer;
|
||||||
|
this.webRtcServerActive = config.mediasoup.webRtcServerActive;
|
||||||
this.io = io;
|
this.io = io;
|
||||||
this.audioLevelObserver = null;
|
this.audioLevelObserver = null;
|
||||||
this.audioLevelObserverEnabled = true;
|
this.audioLevelObserverEnabled = true;
|
||||||
@@ -248,13 +250,18 @@ module.exports = class Room {
|
|||||||
|
|
||||||
const { maxIncomingBitrate, initialAvailableOutgoingBitrate, listenInfos } = this.webRtcTransport;
|
const { maxIncomingBitrate, initialAvailableOutgoingBitrate, listenInfos } = this.webRtcTransport;
|
||||||
|
|
||||||
const transport = await this.router.createWebRtcTransport({
|
const webRtcTransportOptions = {
|
||||||
listenInfos: listenInfos,
|
listenInfos: listenInfos,
|
||||||
enableUdp: true,
|
enableUdp: true,
|
||||||
enableTcp: true,
|
enableTcp: true,
|
||||||
preferUdp: true,
|
preferUdp: true,
|
||||||
|
iceConsentTimeout: 20,
|
||||||
initialAvailableOutgoingBitrate,
|
initialAvailableOutgoingBitrate,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (this.webRtcServerActive) webRtcTransportOptions.webRtcServer = this.webRtcServer;
|
||||||
|
|
||||||
|
const transport = await this.router.createWebRtcTransport(webRtcTransportOptions);
|
||||||
|
|
||||||
if (!transport) {
|
if (!transport) {
|
||||||
throw new Error('Failed to create WebRTC transport');
|
throw new Error('Failed to create WebRTC transport');
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ dependencies: {
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
||||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.88
|
* @version 1.3.90
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -762,6 +762,26 @@ function startServer() {
|
|||||||
setTimeout(() => process.exit(1), 2000);
|
setTimeout(() => process.exit(1), 2000);
|
||||||
});
|
});
|
||||||
workers.push(worker);
|
workers.push(worker);
|
||||||
|
|
||||||
|
if (config.mediasoup.webRtcServerActive) {
|
||||||
|
//
|
||||||
|
log.debug('Create a WebRtcServer', { worker_pid: worker.pid });
|
||||||
|
const webRtcServerOptions = clone(config.mediasoup.webRtcServerOptions);
|
||||||
|
const portIncrement = numWorkers.length - 1;
|
||||||
|
for (const listenInfo of webRtcServerOptions.listenInfos) {
|
||||||
|
listenInfo.port += portIncrement;
|
||||||
|
}
|
||||||
|
const webRtcServer = await worker.createWebRtcServer(webRtcServerOptions);
|
||||||
|
worker.appData.webRtcServer = webRtcServer;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
setInterval(async () => {
|
||||||
|
const usage = await worker.getResourceUsage();
|
||||||
|
log.info('mediasoup Worker resource usage', { worker_pid: worker.pid, usage: usage });
|
||||||
|
const dump = await worker.dump();
|
||||||
|
log.info('mediasoup Worker dump', { worker_pid: worker.pid, dump: dump });
|
||||||
|
}, 120000);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1691,6 +1711,13 @@ function startServer() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function clone(value) {
|
||||||
|
if (value === undefined) return undefined;
|
||||||
|
if (Number.isNaN(value)) return NaN;
|
||||||
|
if (typeof structuredClone === 'function') return structuredClone(value);
|
||||||
|
return JSON.parse(JSON.stringify(value));
|
||||||
|
}
|
||||||
|
|
||||||
async function isPeerPresenter(room_id, peer_id, peer_name, peer_uuid) {
|
async function isPeerPresenter(room_id, peer_id, peer_name, peer_uuid) {
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -356,18 +356,26 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// WebRtcTransport settings
|
// WebRtcServerOptions
|
||||||
|
webRtcServerActive: false,
|
||||||
|
webRtcServerOptions: {
|
||||||
|
listenInfos: [
|
||||||
|
{ protocol: 'udp', ip: '0.0.0.0', announcedAddress: getLocalIp(), port: 44444 },
|
||||||
|
{ protocol: 'tcp', ip: '0.0.0.0', announcedAddress: getLocalIp(), port: 44444 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// WebRtcTransport
|
||||||
webRtcTransport: {
|
webRtcTransport: {
|
||||||
listenInfos: [
|
listenInfos: [
|
||||||
{ protocol: 'udp', ip: '0.0.0.0', announcedAddress: getLocalIp() },
|
{ protocol: 'udp', ip: '0.0.0.0', announcedAddress: getLocalIp() },
|
||||||
{ protocol: 'tcp', ip: '0.0.0.0', announcedAddress: getLocalIp() },
|
{ protocol: 'tcp', ip: '0.0.0.0', announcedAddress: getLocalIp() },
|
||||||
//announcedAddress: replace by 'public static IPV4 address' https://api.ipify.org (type string --> 'xx.xxx.xxx.xx' not xx.xxx.xxx.xx)
|
|
||||||
//announcedAddress: '' will be auto-detected on server start, for docker localPC set '127.0.0.1' otherwise the 'public static IPV4 address'
|
|
||||||
],
|
],
|
||||||
initialAvailableOutgoingBitrate: 1000000,
|
initialAvailableOutgoingBitrate: 1000000,
|
||||||
minimumAvailableOutgoingBitrate: 600000,
|
minimumAvailableOutgoingBitrate: 600000,
|
||||||
maxSctpMessageSize: 262144,
|
maxSctpMessageSize: 262144,
|
||||||
maxIncomingBitrate: 1500000,
|
maxIncomingBitrate: 1500000,
|
||||||
},
|
},
|
||||||
|
//announcedAddress: replace by 'public static IPV4 address' https://api.ipify.org (type string --> 'xx.xxx.xxx.xx' not xx.xxx.xxx.xx)
|
||||||
|
//announcedAddress: '' will be auto-detected on server start, for docker localPC set '127.0.0.1' otherwise the 'public static IPV4 address'
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mirotalksfu",
|
"name": "mirotalksfu",
|
||||||
"version": "1.3.88",
|
"version": "1.3.90",
|
||||||
"description": "WebRTC SFU browser-based video calls",
|
"description": "WebRTC SFU browser-based video calls",
|
||||||
"main": "Server.js",
|
"main": "Server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
||||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.88
|
* @version 1.3.90
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
||||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.88
|
* @version 1.3.90
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم