livekit / python-sdks

LiveKit real-time and server SDKs for Python

Home Page:https://docs.livekit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR:livekit:livekit::rtc_engine

semsphy opened this issue · comments

Hi There,

I was testing example and I got below error log.

Environment variables

export LIVEKIT_URL=wss://xxxxx.livekit.cloud
export LIVEKIT_API_KEY=APIxxxxxxxx
export LIVEKIT_API_SECRET=secret

Snippet

import asyncio
import logging
from signal import SIGINT, SIGTERM
from typing import Union
import os

from livekit import api, rtc

# ensure LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET are set


async def main(room: rtc.Room) -> None:
    @room.on("participant_connected")
    def on_participant_connected(participant: rtc.RemoteParticipant) -> None:
        logging.info(
            "participant connected: %s %s", participant.sid, participant.identity
        )

    @room.on("participant_disconnected")
    def on_participant_disconnected(participant: rtc.RemoteParticipant):
        logging.info(
            "participant disconnected: %s %s", participant.sid, participant.identity
        )

    token = (
        api.AccessToken()
        .with_identity("python-bot")
        .with_name("Python Bot")
        .with_grants(
            api.VideoGrants(
                room_join=True,
                room="my-room",
            )
        )
        .to_jwt()
    )

    room.adaptive_streams = False
    room.video_capture_defaults = None
    room.simulcast = False



    await room.connect(os.getenv("LIVEKIT_URL"), token)
    logging.info("connected to room %s", room.name)
    logging.info("participants: %s", room.participants)

    await asyncio.sleep(2)
    # await room.local_participant.publish_data("hello world")


if __name__ == "__main__":
    logging.basicConfig(
        level=logging.INFO,
        handlers=[logging.FileHandler("basic_room.log"), logging.StreamHandler()],
    )

    loop = asyncio.get_event_loop()
    room = rtc.Room(loop=loop)

    async def cleanup():
        await room.disconnect()
        loop.stop()

    asyncio.ensure_future(main(room))
    for signal in [SIGINT, SIGTERM]:
        loop.add_signal_handler(signal, lambda: asyncio.ensure_future(cleanup()))

    try:
        loop.run_forever()
    finally:
        loop.close()

Error logs

ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "198.19.249.x", port: 64291, url: "stun:167.99.68.15:3478", error_code: 701, error_text: "STUN binding request timed out." }
ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "192.168.247.x", port: 57591, url: "stun:167.99.68.15:3478", error_code: 701, error_text: "STUN binding request timed out." }
ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "198.19.249.x", port: 64291, url: "turn:167.99.68.15:3478?transport=udp", error_code: 701, error_text: "TURN allocate request timed out." }
ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "192.168.247.x", port: 57591, url: "turn:167.99.68.15:3478?transport=udp", error_code: 701, error_text: "TURN allocate request timed out." }
ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "192.168.31.x", port: 50088, url: "turn:167.99.68.15:3478?transport=udp", error_code: 701, error_text: "TURN allocate request timed out." }
ERROR:livekit:livekit::rtc_engine::rtc_events:111:livekit::rtc_engine::rtc_events - IceCandidateError { address: "192.168.247.x", port: 57591, url: "turn:ip-167-99-68-15.host.livekit.cloud:3478?transport=udp", error_code: 701, error_text: "TURN allocate request timed out." }

I also get this error on WSL 2