use participant token in meet_url
This commit is contained in:
		
							parent
							
								
									ba2813d716
								
							
						
					
					
						commit
						cedda9662e
					
				| 
						 | 
					@ -242,8 +242,6 @@ def run(
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            raise Exception(f"Server at {url} failed to respond after 10 attempts")
 | 
					            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_identity("Participant") \
 | 
				
			||||||
                .with_name("You") \
 | 
					                .with_name("You") \
 | 
				
			||||||
| 
						 | 
					@ -252,6 +250,8 @@ def run(
 | 
				
			||||||
                    room="my-room",
 | 
					                    room="my-room",
 | 
				
			||||||
            )).to_jwt())
 | 
					            )).to_jwt())
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        ### DISPLAY QR CODE
 | 
				
			||||||
 | 
					        if qr:
 | 
				
			||||||
            def display_qr_code():
 | 
					            def display_qr_code():
 | 
				
			||||||
                time.sleep(10)
 | 
					                time.sleep(10)
 | 
				
			||||||
                content = json.dumps({"livekit_server": url, "token": participant_token})
 | 
					                content = json.dumps({"livekit_server": url, "token": participant_token})
 | 
				
			||||||
| 
						 | 
					@ -271,16 +271,8 @@ def run(
 | 
				
			||||||
            os.environ['01_TTS'] = interpreter.tts
 | 
					            os.environ['01_TTS'] = interpreter.tts
 | 
				
			||||||
            os.environ['01_STT'] = interpreter.stt
 | 
					            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'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("\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("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)
 | 
					            print(meet_url)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue