From de2a7cb129093a8a58dcb96281304e23c67b4f10 Mon Sep 17 00:00:00 2001 From: Ben Xu Date: Tue, 26 Nov 2024 12:11:13 -0800 Subject: [PATCH] add token in qr --- software/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/software/main.py b/software/main.py index 9873a75..4ca306f 100644 --- a/software/main.py +++ b/software/main.py @@ -246,9 +246,17 @@ def run( ### DISPLAY QR CODE if qr: + 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()) + def display_qr_code(): time.sleep(10) - content = json.dumps({"livekit_server": url}) + content = json.dumps({"livekit_server": url, "token": participant_token}) qr_code = segno.make(content) qr_code.terminal(compact=True)