completed Audio frontend
This commit is contained in:
@@ -5,12 +5,12 @@ if (!process.env.LIVEKIT_API_KEY) throw new Error("LIVEKIT_API_KEY not set");
|
||||
if (!process.env.LIVEKIT_API_SECRET)
|
||||
throw new Error("LIVEKIT_API_SECRET not set");
|
||||
|
||||
const createToken = async () => {
|
||||
const createToken = async (roomName: string) => {
|
||||
// If this room doesn't exist, it'll be automatically created when the first
|
||||
// participant joins
|
||||
const roomName = "quickstart-room";
|
||||
// Identifier to be used for participant.
|
||||
// It's available as LocalParticipant.identity with livekit-client SDK
|
||||
// TODO: Move function to dispatch nextjs app as API route to use authentication of nextAuth
|
||||
const participantName =
|
||||
"quickstart-username" + Math.random().toString(36).substring(7);
|
||||
|
||||
@@ -31,8 +31,10 @@ const createToken = async () => {
|
||||
const router = Router();
|
||||
|
||||
router.get("/token", async (req, res) => {
|
||||
const roomName = req.query.roomName as string;
|
||||
console.log("roomName", roomName);
|
||||
res.send({
|
||||
token: await createToken(),
|
||||
token: await createToken(roomName),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user