180e95f74d
- Switch OBS output to RTMP; add FFmpeg AAC->Opus transcoding via MediaMTX runOnReady so WebRTC can carry audio (WebRTC requires Opus, not AAC) - Enable RTSP on localhost so FFmpeg reads game path without publisher conflict; viewers connect to game-opus path (H264+Opus) - Fix WHEP/HLS path prefix stripping in NPM advanced config; move all custom locations (/whep, /hls, /v3) out of NPM GUI and into advanced conf so trailing-slash proxy_pass correctly strips prefixes before hitting MediaMTX - Fix MediaMTX API port 49997->19997 (49997 was in Windows ephemeral range) - Add /status proxy endpoint to OBS HTTP server so frontend can poll stream readiness without hitting /v3/ through NPM where auth_request blocked it - Fix authInternalUsers: split publish (localhost only) from read (any IP) so WHEP viewers are not challenged with Basic Auth by MediaMTX - Remove muted attribute from video element; show unmute/play button on autoplay block so viewers get audio after one click - Fix webrtcAdditionalHosts to include LAN IP 192.168.50.254 - Fix hlsAllowOrigin->hlsAllowOrigins deprecation warning - Move MediaMTX/HTTP server startup to script_load (not streaming started) so MediaMTX is ready before OBS attempts RTMP connection - Log MediaMTX output to bin/mediamtx.log for easier debugging Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
116 lines
4.1 KiB
PowerShell
116 lines
4.1 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
One-time installer for game-stream-app on Windows.
|
|
|
|
.DESCRIPTION
|
|
- Downloads the latest MediaMTX Windows amd64 release from GitHub
|
|
into bin/mediamtx.exe.
|
|
- Creates a disabled Windows Firewall rule "GameStream-UDP-48189" that
|
|
the OBS script will toggle on/off with stream lifecycle.
|
|
|
|
Must be run from an elevated (Administrator) PowerShell prompt.
|
|
|
|
.EXAMPLE
|
|
PS> cd C:\Users\bheth\Documents\game-stream-app
|
|
PS> .\scripts\install.ps1
|
|
#>
|
|
|
|
#Requires -RunAsAdministrator
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[string]$FirewallRuleName = "GameStream-UDP-48189",
|
|
[int]$UdpPort = 48189
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$projectRoot = Split-Path -Parent $PSScriptRoot
|
|
$binDir = Join-Path $projectRoot 'bin'
|
|
|
|
function Write-Step { param([string]$msg) Write-Host "==> $msg" -ForegroundColor Cyan }
|
|
function Write-Ok { param([string]$msg) Write-Host " $msg" -ForegroundColor Green }
|
|
function Write-Warn2 { param([string]$msg) Write-Host " $msg" -ForegroundColor Yellow }
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 1. Download MediaMTX
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Write-Step "Locating latest MediaMTX release"
|
|
$releaseApi = 'https://api.github.com/repos/bluenviron/mediamtx/releases/latest'
|
|
$headers = @{ 'User-Agent' = 'game-stream-app-installer' }
|
|
$release = Invoke-RestMethod -Uri $releaseApi -Headers $headers
|
|
|
|
$asset = $release.assets |
|
|
Where-Object { $_.name -match 'windows_amd64\.zip$' } |
|
|
Select-Object -First 1
|
|
|
|
if (-not $asset) {
|
|
throw "Could not find a windows_amd64 asset in the latest MediaMTX release"
|
|
}
|
|
|
|
Write-Ok "Found $($asset.name) ($($release.tag_name))"
|
|
|
|
if (-not (Test-Path $binDir)) {
|
|
New-Item -ItemType Directory -Path $binDir | Out-Null
|
|
}
|
|
|
|
$zipPath = Join-Path $env:TEMP $asset.name
|
|
Write-Step "Downloading MediaMTX"
|
|
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $zipPath -UseBasicParsing
|
|
Write-Ok "Downloaded to $zipPath"
|
|
|
|
Write-Step "Extracting to $binDir"
|
|
Expand-Archive -Path $zipPath -DestinationPath $binDir -Force
|
|
Remove-Item $zipPath -Force
|
|
|
|
$mediamtxExe = Join-Path $binDir 'mediamtx.exe'
|
|
if (-not (Test-Path $mediamtxExe)) {
|
|
throw "mediamtx.exe was not found after extraction - check the archive contents"
|
|
}
|
|
Write-Ok "mediamtx.exe installed at $mediamtxExe"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 2. Create (or refresh) the Windows Firewall rule in DISABLED state
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Write-Step "Configuring Windows Firewall rule '$FirewallRuleName'"
|
|
$existing = Get-NetFirewallRule -DisplayName $FirewallRuleName -ErrorAction SilentlyContinue
|
|
if ($existing) {
|
|
Write-Warn2 "Rule already exists - updating"
|
|
$existing | Remove-NetFirewallRule
|
|
}
|
|
|
|
New-NetFirewallRule `
|
|
-DisplayName $FirewallRuleName `
|
|
-Description "game-stream-app: WebRTC media (toggled by OBS script)" `
|
|
-Direction Inbound `
|
|
-Action Allow `
|
|
-Protocol UDP `
|
|
-LocalPort $UdpPort `
|
|
-Profile Any `
|
|
-Enabled False | Out-Null
|
|
|
|
Write-Ok "Firewall rule created (currently DISABLED)"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 3. Next-step instructions
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Write-Host ""
|
|
Write-Host "Install complete." -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Next steps:"
|
|
Write-Host " 1. Open OBS -> Tools -> Scripts -> + and add:"
|
|
Write-Host " $(Join-Path $projectRoot 'obs-script\game_stream.py')"
|
|
Write-Host " 2. In the script properties panel, set:"
|
|
Write-Host " MediaMTX binary : $mediamtxExe"
|
|
Write-Host " MediaMTX config : $(Join-Path $projectRoot 'config\mediamtx.yml')"
|
|
Write-Host " Frontend dir : $(Join-Path $projectRoot 'frontend')"
|
|
Write-Host " 3. Configure OBS Stream output:"
|
|
Write-Host " Service : Custom"
|
|
Write-Host " Protocol : WHIP"
|
|
Write-Host " Server : http://localhost:48889/game/whip"
|
|
Write-Host " 4. See docs/ for NPM + Authentik setup on your reverse proxy host."
|
|
Write-Host ""
|