recording to s3
This commit is contained in:
parent
8bf1bb53b4
commit
4f6c9336c6
@ -4,7 +4,9 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const roomName = req.nextUrl.searchParams.get('roomName');
|
||||
const now = req.nextUrl.searchParams.get('now');
|
||||
|
||||
new Date(Date.now()).toISOString();
|
||||
/**
|
||||
* CAUTION:
|
||||
* for simplicity this implementation does not authenticate users and therefore allows anyone with knowledge of a roomName
|
||||
@ -15,6 +17,9 @@ export async function GET(req: NextRequest) {
|
||||
if (roomName === null) {
|
||||
return new NextResponse('Missing roomName parameter', { status: 403 });
|
||||
}
|
||||
if (now === null) {
|
||||
return new NextResponse('Missing now parameter', { status: 403 });
|
||||
}
|
||||
|
||||
const {
|
||||
LIVEKIT_API_KEY,
|
||||
@ -38,11 +43,11 @@ export async function GET(req: NextRequest) {
|
||||
}
|
||||
|
||||
const fileOutput = new EncodedFileOutput({
|
||||
filepath: `${new Date(Date.now()).toISOString()}-${roomName}.mp4`,
|
||||
filepath: `${now}-${roomName}.mp4`,
|
||||
output: {
|
||||
case: 's3',
|
||||
value: new S3Upload({
|
||||
endpoint: S3_ENDPOINT,
|
||||
// endpoint: S3_ENDPOINT,
|
||||
accessKey: S3_KEY_ID,
|
||||
secret: S3_KEY_SECRET,
|
||||
region: S3_REGION,
|
||||
|
||||
@ -30,6 +30,7 @@ import React from 'react';
|
||||
const CONN_DETAILS_ENDPOINT =
|
||||
process.env.NEXT_PUBLIC_CONN_DETAILS_ENDPOINT ?? '/api/connection-details';
|
||||
const SHOW_SETTINGS_MENU = process.env.NEXT_PUBLIC_SHOW_SETTINGS_MENU == 'true';
|
||||
console.log('SHOW_SETTINGS_MENU', SHOW_SETTINGS_MENU);
|
||||
|
||||
export function PageClientImpl(props: {
|
||||
roomName: string;
|
||||
|
||||
@ -27,9 +27,9 @@ export function SettingsMenu(props: SettingsMenuProps) {
|
||||
|
||||
const settings = React.useMemo(() => {
|
||||
return {
|
||||
recording: recordingEndpoint ? { label: 'Recording' } : undefined,
|
||||
media: { camera: true, microphone: true, label: 'Media Devices', speaker: true },
|
||||
effects: { label: 'Effects' },
|
||||
recording: recordingEndpoint ? { label: 'Recording' } : undefined,
|
||||
};
|
||||
}, []);
|
||||
|
||||
@ -92,10 +92,13 @@ export function SettingsMenu(props: SettingsMenuProps) {
|
||||
setProcessingRecRequest(true);
|
||||
setInitialRecStatus(isRecording);
|
||||
let response: Response;
|
||||
const now = new Date(Date.now()).toISOString();
|
||||
const fileName = `${now}-${room.name}.mp4`;
|
||||
console.log('recoding to S3 file: ', fileName);
|
||||
if (isRecording) {
|
||||
response = await fetch(recordingEndpoint + `/stop?roomName=${room.name}`);
|
||||
} else {
|
||||
response = await fetch(recordingEndpoint + `/start?roomName=${room.name}`);
|
||||
response = await fetch(recordingEndpoint + `/start?roomName=${room.name}&now=${now}`);
|
||||
}
|
||||
if (response.ok) {
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user