livekit / python-sdks

LiveKit real-time and server SDKs for Python
https://docs.livekit.io
Apache License 2.0
116 stars 36 forks source link

Problem with retrieving the room name and metadata #227

Open love4php opened 2 months ago

love4php commented 2 months ago

In the worker, I am trying to obtain the room name and metadata using the following method, but unfortunately, after the latest update, these two values are no longer displayed.

`async def entrypoint(ctx: JobContext): try: print(ctx.room.name) print(ctx.room.metadata)

if name == "main":

Initialize the worker with the entrypoint

cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))

`

keepingitneil commented 2 months ago

I pushed a fix to today to participant metadata: https://github.com/livekit/python-sdks/pull/226 but I'm unable to reproduce your issue for room metadata.

For example, this code:

    lkapi = livekit.api.LiveKitAPI()
    await lkapi.room.update_room_metadata(
        livekit.api.UpdateRoomMetadataRequest(room=ctx.room.name, metadata="test")
    )
    await asyncio.sleep(1)
    print("room md", ctx.room.metadata)

prints "room md test" as expected.