From 08426970b290e2a56b62d68cbde75ad94ca8ad92 Mon Sep 17 00:00:00 2001 From: Benoit Date: Thu, 21 May 2026 14:13:19 +0200 Subject: [PATCH] feat: setup project infrastructure - Create folder structure (server, client, install) - Add server package.json with LiveKit SDK, Express, Opus - Add client package.json with React, Vite, livekit-client - Add macOS installation script with LiveKit binary download - Add basic YAML config (1 group, 2 channels, audio quality settings) - Add .gitignore for dependencies and binaries --- .gitignore | 45 +++++++++++++ client/package.json | 31 +++++++++ install/macos.sh | 129 ++++++++++++++++++++++++++++++++++++++ server/config/config.yaml | 54 ++++++++++++++++ server/package.json | 28 +++++++++ 5 files changed, 287 insertions(+) create mode 100644 .gitignore create mode 100644 client/package.json create mode 100755 install/macos.sh create mode 100644 server/config/config.yaml create mode 100644 server/package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba8b1c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Dependencies +node_modules/ +package-lock.json +yarn.lock +pnpm-lock.yaml + +# Environment variables +.env +.env.local +.env.*.local + +# Build outputs +dist/ +build/ +*.log + +# OS files +.DS_Store +Thumbs.db + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Binaries +server/bin/livekit-server +*.tar.gz + +# Test coverage +coverage/ + +# Temporary files +tmp/ +temp/ +*.tmp + +# Debug logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..e4459f2 --- /dev/null +++ b/client/package.json @@ -0,0 +1,31 @@ +{ + "name": "ptt-live-client", + "version": "0.1.0", + "description": "PTT Live - Professional WebRTC Intercom Client PWA", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1", + "livekit-client": "^2.5.0" + }, + "devDependencies": { + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.0", + "vite": "^5.2.11", + "vite-plugin-pwa": "^0.20.0", + "eslint": "^8.57.0", + "eslint-plugin-react": "^7.34.1", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.6" + }, + "engines": { + "node": ">=20.0.0" + } +} diff --git a/install/macos.sh b/install/macos.sh new file mode 100755 index 0000000..2f9fe98 --- /dev/null +++ b/install/macos.sh @@ -0,0 +1,129 @@ +#!/bin/bash + +set -e + +echo "🚀 PTT Live - Installation macOS" +echo "==================================" +echo "" + +# Couleurs pour le terminal +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Vérifier Node.js +echo "📦 Vérification Node.js..." +if ! command -v node &> /dev/null; then + echo -e "${RED}❌ Node.js n'est pas installé${NC}" + echo " Installez Node.js 20+ depuis https://nodejs.org" + exit 1 +fi + +NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) +if [ "$NODE_VERSION" -lt 20 ]; then + echo -e "${RED}❌ Node.js version trop ancienne ($NODE_VERSION)${NC}" + echo " Node.js 20+ requis" + exit 1 +fi + +echo -e "${GREEN}✅ Node.js $(node -v)${NC}" + +# Vérifier npm +if ! command -v npm &> /dev/null; then + echo -e "${RED}❌ npm n'est pas installé${NC}" + exit 1 +fi + +echo -e "${GREEN}✅ npm $(npm -v)${NC}" +echo "" + +# Télécharger LiveKit Server +LIVEKIT_VERSION="v1.7.2" +LIVEKIT_URL="https://github.com/livekit/livekit/releases/download/${LIVEKIT_VERSION}/livekit_${LIVEKIT_VERSION}_darwin_amd64.tar.gz" +LIVEKIT_ARM_URL="https://github.com/livekit/livekit/releases/download/${LIVEKIT_VERSION}/livekit_${LIVEKIT_VERSION}_darwin_arm64.tar.gz" + +echo "📥 Téléchargement LiveKit Server ${LIVEKIT_VERSION}..." + +# Détecter architecture (Intel vs Apple Silicon) +ARCH=$(uname -m) +if [ "$ARCH" = "arm64" ]; then + echo " Architecture: Apple Silicon (ARM64)" + DOWNLOAD_URL=$LIVEKIT_ARM_URL +else + echo " Architecture: Intel (AMD64)" + DOWNLOAD_URL=$LIVEKIT_URL +fi + +cd server/bin + +if [ -f "livekit-server" ]; then + echo -e "${YELLOW}⚠️ LiveKit Server déjà présent, suppression...${NC}" + rm -f livekit-server +fi + +# Télécharger et extraire +curl -L -o livekit.tar.gz "$DOWNLOAD_URL" +tar -xzf livekit.tar.gz +rm livekit.tar.gz + +# Rendre exécutable +chmod +x livekit-server + +echo -e "${GREEN}✅ LiveKit Server installé${NC}" +echo "" + +cd ../.. + +# Installer dépendances serveur +echo "📦 Installation dépendances serveur..." +cd server +npm install +echo -e "${GREEN}✅ Dépendances serveur installées${NC}" +echo "" + +# Installer dépendances client +echo "📦 Installation dépendances client..." +cd ../client +npm install +echo -e "${GREEN}✅ Dépendances client installées${NC}" +echo "" + +cd .. + +# Générer clés API LiveKit +echo "🔑 Génération clés API LiveKit..." +API_KEY="APIkey$(openssl rand -hex 16)" +API_SECRET=$(openssl rand -base64 32) + +# Créer fichier .env +cat > server/.env << EOF +# LiveKit Configuration +LIVEKIT_URL=ws://localhost:7880 +LIVEKIT_API_KEY=$API_KEY +LIVEKIT_API_SECRET=$API_SECRET + +# Server Configuration +PORT=3000 +NODE_ENV=development +EOF + +echo -e "${GREEN}✅ Clés API générées (server/.env)${NC}" +echo "" + +# Message final +echo "==================================" +echo -e "${GREEN}✅ Installation terminée !${NC}" +echo "" +echo "📝 Prochaines étapes :" +echo "" +echo " 1. Démarrer le serveur :" +echo " cd server && npm run dev" +echo "" +echo " 2. Démarrer le client (nouveau terminal) :" +echo " cd client && npm run dev" +echo "" +echo " 3. Ouvrir https://localhost:5173 dans votre navigateur" +echo "" +echo "📖 Documentation : README.md" +echo "" diff --git a/server/config/config.yaml b/server/config/config.yaml new file mode 100644 index 0000000..88875ec --- /dev/null +++ b/server/config/config.yaml @@ -0,0 +1,54 @@ +# PTT Live - Configuration +# Phase 1: Configuration basique (1 groupe, support multi-canaux) + +# Configuration audio globale +audio: + sampleRate: 48000 + frameSize: 20 # ms + + # Qualité Opus configurable + # Voix économique: 32-64 kbps (WiFi limité) + # Voix standard: 96 kbps (défaut) + # Voix HD: 128-192 kbps + # Musique: 256-320 kbps + defaultBitrate: 96 # kbps + + # Jitter buffer + jitterBufferMs: 40 + +# Configuration des groupes +groups: + - id: production + name: "Équipe Production" + description: "Réalisateur, cadreurs, régisseur" + + # Qualité audio spécifique (optionnel, sinon utilise defaultBitrate) + audioBitrate: 96 + + # Canaux audio associés + channels: + - id: prod-main + name: "Production principale" + audioInput: 0 # Index device CoreAudio/JACK + audioOutput: 0 + + - id: prod-backup + name: "Production backup" + audioInput: 1 + audioOutput: 1 + +# Configuration serveur +server: + host: "0.0.0.0" + port: 3000 + + # LiveKit + livekit: + url: "ws://localhost:7880" + # API key/secret dans .env (LIVEKIT_API_KEY, LIVEKIT_API_SECRET) + +# Logging +logging: + level: "debug" # debug, info, warn, error + logLatency: true + logAudioStats: true diff --git a/server/package.json b/server/package.json new file mode 100644 index 0000000..1c4953e --- /dev/null +++ b/server/package.json @@ -0,0 +1,28 @@ +{ + "name": "ptt-live-server", + "version": "0.1.0", + "description": "PTT Live - Professional WebRTC Intercom Server", + "main": "index.js", + "type": "module", + "scripts": { + "start": "node index.js", + "dev": "node --watch index.js", + "test": "node --test" + }, + "keywords": ["webrtc", "intercom", "livekit", "audio", "ptt"], + "author": "", + "license": "MIT", + "dependencies": { + "express": "^4.19.2", + "livekit-server-sdk": "^2.6.0", + "yaml": "^2.4.2", + "node-opus": "^0.3.3", + "ws": "^8.17.0" + }, + "devDependencies": { + "nodemon": "^3.1.0" + }, + "engines": { + "node": ">=20.0.0" + } +}