From a50b6e31b2773a4a455f4fdf848390663f245315 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 12 Oct 2023 11:29:39 +0200 Subject: [PATCH 1/4] www: fix webrtc not sending STOP command --- www/app/transcripts/new/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/app/transcripts/new/page.tsx b/www/app/transcripts/new/page.tsx index bfcf13dd..89794005 100644 --- a/www/app/transcripts/new/page.tsx +++ b/www/app/transcripts/new/page.tsx @@ -67,7 +67,7 @@ const TranscriptCreate = () => { { - webRTC?.peer?.send(JSON.stringify({ cmd: "STOP" })); + webRTC?.send(JSON.stringify({ cmd: "STOP" })); setStream(null); setHasRecorded(true); }} From 43016e42aa0fe2d37d230c497173074760366f5b Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 12 Oct 2023 11:31:11 +0200 Subject: [PATCH 2/4] www: add shallow redirection on the final transcript url This prevent the user waiting for the final generation of the summary to have the final url It still redirect nextjs internally when final transcript is received. --- www/app/transcripts/new/page.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/www/app/transcripts/new/page.tsx b/www/app/transcripts/new/page.tsx index 89794005..b4e294d6 100644 --- a/www/app/transcripts/new/page.tsx +++ b/www/app/transcripts/new/page.tsx @@ -16,6 +16,7 @@ import { faGear } from "@fortawesome/free-solid-svg-icons"; import About from "../../(aboutAndPrivacy)/about"; import Privacy from "../../(aboutAndPrivacy)/privacy"; import { lockWakeState, releaseWakeState } from "../../lib/wakeLock"; +import { useRouter } from "next/navigation"; const TranscriptCreate = () => { const [stream, setStream] = useState(null); @@ -36,6 +37,7 @@ const TranscriptCreate = () => { const transcript = useTranscript(stream, api); const webRTC = useWebRTC(stream, transcript?.response?.id, api); const webSockets = useWebSockets(transcript?.response?.id); + const router = useRouter(); const { loading, permissionOk, @@ -53,6 +55,17 @@ const TranscriptCreate = () => { setTranscriptStarted(true); }, [webSockets.transcriptText]); + useEffect(() => { + if (transcript?.response?.id) { + const newUrl = `/transcripts/${transcript.response.id}`; + // Shallow redirection does not work on NextJS 13 + // https://github.com/vercel/next.js/discussions/48110 + // https://github.com/vercel/next.js/discussions/49540 + // router.push(newUrl, undefined, { shallow: true }); + history.replaceState({}, "", newUrl); + } + }); + useEffect(() => { lockWakeState(); return () => { From cc5f1c70a42fd84496a1dbf7aa73933b9d869f52 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 12 Oct 2023 11:41:02 +0200 Subject: [PATCH 3/4] www: use websocket status ended for redirecting --- www/app/transcripts/useWebSockets.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/www/app/transcripts/useWebSockets.ts b/www/app/transcripts/useWebSockets.ts index 75bf8edd..cb31c4bf 100644 --- a/www/app/transcripts/useWebSockets.ts +++ b/www/app/transcripts/useWebSockets.ts @@ -177,6 +177,16 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { case "FINAL_LONG_SUMMARY": if (message.data) { setFinalSummary(message.data); + } + break; + + case "FINAL_TITLE": + console.debug("FINAL_TITLE event:", message.data); + break; + + case "STATUS": + console.log("STATUS event:", message.data); + if (message.data.value === "ended") { const newUrl = "/transcripts/" + transcriptId; router.push(newUrl); console.debug( @@ -186,13 +196,6 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { newUrl, ); } - break; - - case "FINAL_TITLE": - console.debug("FINAL_TITLE event:", message.data); - break; - - case "STATUS": setStatus(message.data); break; From 1f056381a31f1bcfd7d2558b75d6194a2fe1f1e4 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 12 Oct 2023 11:46:02 +0200 Subject: [PATCH 4/4] www: remove webm download button on the recording meeting page --- www/app/transcripts/recorder.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/www/app/transcripts/recorder.tsx b/www/app/transcripts/recorder.tsx index ed86a73f..a550a840 100644 --- a/www/app/transcripts/recorder.tsx +++ b/www/app/transcripts/recorder.tsx @@ -208,12 +208,6 @@ export default function Recorder(props: RecorderProps) { if (!record) return; return record.on("stopRecording", () => { - const link = document.getElementById("download-recording"); - if (!link) return; - - link.setAttribute("href", record.getRecordedUrl()); - link.setAttribute("download", "reflector-recording.webm"); - link.style.visibility = "visible"; renderMarkers(); }); }, [record]); @@ -322,16 +316,6 @@ export default function Recorder(props: RecorderProps) { )} - - {!props.transcriptId && ( - - - - )} )} {!hasRecorded && (