From cedda9662e854c46b5cb03bfbc29f7d2452417b5 Mon Sep 17 00:00:00 2001 From: Ben Xu Date: Mon, 9 Dec 2024 14:12:56 -0800 Subject: [PATCH] use participant token in meet_url --- software/main.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/software/main.py b/software/main.py index 49fb5ef..d8437d5 100644 --- a/software/main.py +++ b/software/main.py @@ -241,17 +241,17 @@ def run( time.sleep(1) else: raise Exception(f"Server at {url} failed to respond after 10 attempts") - - ### DISPLAY QR CODE - if qr: - participant_token = str(api.AccessToken('devkey', 'secret') \ + + participant_token = str(api.AccessToken('devkey', 'secret') \ .with_identity("Participant") \ .with_name("You") \ .with_grants(api.VideoGrants( room_join=True, room="my-room", )).to_jwt()) - + + ### DISPLAY QR CODE + if qr: def display_qr_code(): time.sleep(10) content = json.dumps({"livekit_server": url, "token": participant_token}) @@ -271,16 +271,8 @@ def run( os.environ['01_TTS'] = interpreter.tts os.environ['01_STT'] = interpreter.stt - token = str(api.AccessToken('devkey', 'secret') \ - .with_identity("You") \ - .with_name("You") \ - .with_grants(api.VideoGrants( - room_join=True, - room="my-room", - )).to_jwt()) - # meet_url = f'http://localhost:3000/custom?liveKitUrl={url.replace("http", "ws")}&token={token}\n\n' - meet_url = f'https://meet.livekit.io/custom?liveKitUrl={url.replace("http", "ws")}&token={token}\n\n' + meet_url = f'https://meet.livekit.io/custom?liveKitUrl={url.replace("http", "ws")}&token={participant_token}\n\n' print("\n") print("For debugging, you can join a video call with your assistant. Click the link below, then send a chat message that says {CONTEXT_MODE_OFF}, then begin speaking:") print(meet_url)