fix: add GO2RTC_PUBLIC_URL environment variable
CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 10s

This commit is contained in:
2026-10-25 15:05:42 +01:00
parent 6a4cbab077
commit 1dd8802c68
3 changed files with 56 additions and 48 deletions
+2 -2
View File
@@ -29,5 +29,5 @@ jobs:
cd "$dir"
git pull --ff-only origin main
docker compose --profile prod build
docker compose --profile prod up -d
docker image prune -f
docker compose --profile prod up -d --force-recreate kai-sa-go2rtc kai-sa-cam
docker image prune -f
+50 -44
View File
@@ -1,54 +1,64 @@
import { useState, useEffect, useRef } from 'react'
import { VideoPlayer } from './components/VideoPlayer'
import { Controls } from './components/Controls'
import { MediaGallery } from './components/MediaGallery'
import { useRecorder } from './hooks/useRecorder'
import { useTalk } from './hooks/useTalk'
import { useState, useEffect, useRef } from "react";
import { VideoPlayer } from "./components/VideoPlayer";
import { Controls } from "./components/Controls";
import { MediaGallery } from "./components/MediaGallery";
import { useRecorder } from "./hooks/useRecorder";
import { useTalk } from "./hooks/useTalk";
export function App() {
const [activeTab, setActiveTab] = useState<'live' | 'media'>('live')
const [isRecording, setIsRecording] = useState(false)
const [isTalking, setIsTalking] = useState(false)
const [gain, setGain] = useState(1)
const [recordingTime, setRecordingTime] = useState(0)
const [snapshots, setSnapshots] = useState<string[]>([])
const [activeTab, setActiveTab] = useState<"live" | "media">("live");
const [isRecording, setIsRecording] = useState(false);
const [isTalking, setIsTalking] = useState(false);
const [gain, setGain] = useState(1);
const [recordingTime, setRecordingTime] = useState(0);
const [snapshots, setSnapshots] = useState<string[]>([]);
const { startRecording, stopRecording, error: recError } = useRecorder({
onStart: () => { setIsRecording(true); setRecordingTime(0) },
onStop: () => { setIsRecording(false); setRecordingTime(0) },
const {
startRecording,
stopRecording,
error: recError,
} = useRecorder({
onStart: () => {
setIsRecording(true);
setRecordingTime(0);
},
onStop: () => {
setIsRecording(false);
setRecordingTime(0);
},
onTimeUpdate: (t) => setRecordingTime(t),
})
});
const { startTalk, stopTalk, error: talkError } = useTalk({ gain })
const { startTalk, stopTalk, error: talkError } = useTalk({ gain });
const handleRecord = async () => {
if (isRecording) {
await stopRecording()
await stopRecording();
} else {
await startRecording()
await startRecording();
}
}
};
const handleSnapshot = async () => {
try {
const res = await fetch('/api/media/snapshots', { method: 'POST' })
if (!res.ok) throw new Error('Snapshot failed')
const data = await res.json()
setSnapshots(prev => [data.filename, ...prev])
const res = await fetch("/api/media/snapshots", { method: "POST" });
if (!res.ok) throw new Error("Snapshot failed");
const data = await res.json();
setSnapshots((prev) => [data.filename, ...prev]);
} catch (e) {
console.error('Snapshot error:', e)
console.error("Snapshot error:", e);
}
}
};
const handleTalk = async () => {
if (isTalking) {
stopTalk()
setIsTalking(false)
stopTalk();
setIsTalking(false);
} else {
await startTalk()
setIsTalking(true)
await startTalk();
setIsTalking(true);
}
}
};
return (
<div className="min-h-screen bg-gray-900 text-white flex flex-col">
@@ -73,24 +83,22 @@ export function App() {
<main className="flex-1 flex flex-col">
<nav className="flex border-b border-gray-700 bg-gray-800">
<button
className={`flex-1 py-3 text-center font-medium ${activeTab === 'live' ? 'text-blue-400 border-b-2 border-blue-400' : 'text-gray-400'}`}
onClick={() => setActiveTab('live')}
className={`flex-1 py-3 text-center font-medium ${activeTab === "live" ? "text-blue-400 border-b-2 border-blue-400" : "text-gray-400"}`}
onClick={() => setActiveTab("live")}
>
Live
</button>
<button
className={`flex-1 py-3 text-center font-medium ${activeTab === 'media' ? 'text-blue-400 border-b-2 border-blue-400' : 'text-gray-400'}`}
onClick={() => setActiveTab('media')}
className={`flex-1 py-3 text-center font-medium ${activeTab === "media" ? "text-blue-400 border-b-2 border-blue-400" : "text-gray-400"}`}
onClick={() => setActiveTab("media")}
>
Médias
</button>
</nav>
{activeTab === 'live' && (
{activeTab === "live" && (
<div className="flex-1 flex flex-col p-4 gap-4 overflow-hidden">
<VideoPlayer
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
/>
<VideoPlayer streamUrl="https://stream.esiah.dev/stream.html?src=webcam&mode=mse" />
<Controls
isRecording={isRecording}
recordingTime={recordingTime}
@@ -109,10 +117,8 @@ export function App() {
</div>
)}
{activeTab === 'media' && (
<MediaGallery />
)}
{activeTab === "media" && <MediaGallery />}
</main>
</div>
)
}
);
}
+4 -2
View File
@@ -13,6 +13,7 @@ services:
- ./config/kai-sa-go2rtc.yaml:/config/go2rtc.yaml:ro
networks:
- kai-sa-cam-internal
- kai-sa-cam-tunnel
cap_drop:
- ALL
security_opt:
@@ -40,8 +41,9 @@ services:
- MAX_RECORDING_MINUTES=${MAX_RECORDING_MINUTES:-120}
- DISK_MIN_FREE_GB=${DISK_MIN_FREE_GB:-2}
- GO2RTC_URL=http://kai-sa-go2rtc:1984
- GO2RTC_PUBLIC_URL=https://stream.esiah.dev
- GO2RTC_RTSP_URL=rtsp://kai-sa-go2rtc:8554/webcam
- PULSE_SERVER=unix:/run/user/1001/pulse/native
- PULSE_SERVER=${PULSE_SERVER}
- XDG_RUNTIME_DIR=/run/user/1001
volumes:
- ./media:/media
@@ -65,4 +67,4 @@ networks:
internal: true
kai-sa-cam-tunnel:
external: true
name: kai-sa-cam-tunnel
name: kai-sa-cam-tunnel