mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 18:32:29 +01:00
Add webrtc to bundle
This commit is contained in:
parent
690faeb52c
commit
2453c2e73d
@ -1,4 +1,3 @@
|
||||
export * from "./Server";
|
||||
export * from "./middlewares/";
|
||||
export * from "./util/";
|
||||
export * from "./voice_schema_hack";
|
||||
export * from "./util/";
|
@ -66,6 +66,7 @@
|
||||
"@fosscord/api": "file:../api",
|
||||
"@fosscord/cdn": "file:../cdn",
|
||||
"@fosscord/gateway": "file:../gateway",
|
||||
"@fosscord/webrtc": "file:../webrtc",
|
||||
"@sentry/node": "^6.16.1",
|
||||
"@sentry/tracing": "^6.16.1",
|
||||
"@yukikaze-bot/erlpack": "^1.0.1",
|
||||
|
@ -7,7 +7,7 @@ const { argv } = require("process");
|
||||
var steps = 2, i = 0;
|
||||
if (argv.includes("clean")) steps++;
|
||||
if (argv.includes("copyonly")) steps--;
|
||||
const dirs = ["api", "util", "cdn", "gateway", "bundle"];
|
||||
const dirs = ["api", "util", "cdn", "gateway", "bundle", "webrtc"];
|
||||
|
||||
const verbose = argv.includes("verbose") || argv.includes("v");
|
||||
|
||||
|
@ -4,6 +4,7 @@ process.on("uncaughtException", console.error);
|
||||
import http from "http";
|
||||
import * as Api from "@fosscord/api";
|
||||
import * as Gateway from "@fosscord/gateway";
|
||||
import * as WebRTC from "@fosscord/webrtc";
|
||||
import { CDNServer } from "@fosscord/cdn";
|
||||
import express from "express";
|
||||
import { green, bold, yellow } from "picocolors";
|
||||
@ -17,12 +18,10 @@ const port = Number(process.env.PORT) || 3001;
|
||||
const production = process.env.NODE_ENV == "development" ? false : true;
|
||||
server.on("request", app);
|
||||
|
||||
// @ts-ignore
|
||||
const api = new Api.FosscordServer({ server, port, production, app });
|
||||
// @ts-ignore
|
||||
const cdn = new CDNServer({ server, port, production, app });
|
||||
// @ts-ignore
|
||||
const gateway = new Gateway.Server({ server, port, production });
|
||||
const webrtc = new WebRTC.Server({ server, port, production });
|
||||
|
||||
//this is what has been added for the /stop API route
|
||||
process.on('SIGTERM', () => {
|
||||
@ -93,7 +92,7 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
await Promise.all([api.start(), cdn.start(), gateway.start()]);
|
||||
await Promise.all([api.start(), cdn.start(), gateway.start(), webrtc.start()]);
|
||||
console.log(`[Server] ${green(`listening on port ${bold(port)}`)}`);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,8 @@
|
||||
"@fosscord/api": ["api/src/index"],
|
||||
"@fosscord/gateway": ["gateway/src/index"],
|
||||
"@fosscord/cdn": ["cdn/src/index"],
|
||||
"@fosscord/util": ["util/src/index"]
|
||||
"@fosscord/util": ["util/src/index"],
|
||||
"@fosscord/webrtc": ["webrtc/src/index"]
|
||||
},
|
||||
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
|
||||
"noEmitHelpers": true,
|
||||
|
@ -3,7 +3,7 @@ import addFormats from "ajv-formats";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const SchemaPath = path.join(__dirname, "..", "..", "..", "assets", "schemas.json");
|
||||
const SchemaPath = path.join(__dirname, "..", "..", "..", "api", "assets", "schemas.json");
|
||||
const schemas = JSON.parse(fs.readFileSync(SchemaPath, { encoding: "utf8" }));
|
||||
|
||||
export const ajv = new Ajv({
|
||||
|
@ -2,7 +2,7 @@ import { CLOSECODES, Payload, Send, WebSocket } from "@fosscord/gateway";
|
||||
import { validateSchema, VoiceIdentifySchema, VoiceState } from "@fosscord/util";
|
||||
import { endpoint, getClients, VoiceOPCodes } from "@fosscord/webrtc";
|
||||
import SemanticSDP from "semantic-sdp";
|
||||
const defaultSDP = require("../../../assets/sdp.json");
|
||||
const defaultSDP = require("./sdp.json");
|
||||
|
||||
export async function onIdentify(this: WebSocket, data: Payload) {
|
||||
clearTimeout(this.readyTimeout);
|
||||
|
420
webrtc/src/opcodes/sdp.json
Normal file
420
webrtc/src/opcodes/sdp.json
Normal file
@ -0,0 +1,420 @@
|
||||
{
|
||||
"version": 0,
|
||||
"streams": [],
|
||||
"medias": [
|
||||
{
|
||||
"id": "0",
|
||||
"type": "audio",
|
||||
"direction": "sendrecv",
|
||||
"codecs": [
|
||||
{
|
||||
"codec": "opus",
|
||||
"type": 111,
|
||||
"channels": 2,
|
||||
"params": {
|
||||
"minptime": "10",
|
||||
"useinbandfec": "1"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "transport-cc"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensions": {
|
||||
"1": "urn:ietf:params:rtp-hdrext:ssrc-audio-level",
|
||||
"2": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||
"3": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||
"4": "urn:ietf:params:rtp-hdrext:sdes:mid"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"type": "video",
|
||||
"direction": "sendrecv",
|
||||
"codecs": [
|
||||
{
|
||||
"codec": "VP8",
|
||||
"type": 96,
|
||||
"rtx": 97,
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "VP9",
|
||||
"type": 98,
|
||||
"rtx": 99,
|
||||
"params": {
|
||||
"profile-id": "0"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "VP9",
|
||||
"type": 100,
|
||||
"rtx": 101,
|
||||
"params": {
|
||||
"profile-id": "2"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "VP9",
|
||||
"type": 102,
|
||||
"rtx": 122,
|
||||
"params": {
|
||||
"profile-id": "1"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 127,
|
||||
"rtx": 121,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "1",
|
||||
"profile-level-id": "42001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 125,
|
||||
"rtx": 107,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "0",
|
||||
"profile-level-id": "42001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 108,
|
||||
"rtx": 109,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "1",
|
||||
"profile-level-id": "42e01f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 124,
|
||||
"rtx": 120,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "0",
|
||||
"profile-level-id": "42e01f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 123,
|
||||
"rtx": 119,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "1",
|
||||
"profile-level-id": "4d001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 35,
|
||||
"rtx": 36,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "0",
|
||||
"profile-level-id": "4d001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 37,
|
||||
"rtx": 38,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "1",
|
||||
"profile-level-id": "f4001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 39,
|
||||
"rtx": 40,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "0",
|
||||
"profile-level-id": "f4001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codec": "H264",
|
||||
"type": 114,
|
||||
"rtx": 115,
|
||||
"params": {
|
||||
"level-asymmetry-allowed": "1",
|
||||
"packetization-mode": "1",
|
||||
"profile-level-id": "64001f"
|
||||
},
|
||||
"rtcpfbs": [
|
||||
{
|
||||
"id": "goog-remb"
|
||||
},
|
||||
{
|
||||
"id": "transport-cc"
|
||||
},
|
||||
{
|
||||
"id": "ccm",
|
||||
"params": ["fir"]
|
||||
},
|
||||
{
|
||||
"id": "nack"
|
||||
},
|
||||
{
|
||||
"id": "nack",
|
||||
"params": ["pli"]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensions": {
|
||||
"2": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||
"3": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||
"4": "urn:ietf:params:rtp-hdrext:sdes:mid",
|
||||
"5": "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay",
|
||||
"6": "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type",
|
||||
"7": "http://www.webrtc.org/experiments/rtp-hdrext/video-timing",
|
||||
"8": "http://www.webrtc.org/experiments/rtp-hdrext/color-space",
|
||||
"10": "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",
|
||||
"11": "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id",
|
||||
"13": "urn:3gpp:video-orientation",
|
||||
"14": "urn:ietf:params:rtp-hdrext:toffset"
|
||||
}
|
||||
}
|
||||
],
|
||||
"candidates": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user