Skip to content

Commit 041e4ea

Browse files
committed
Update jupyter.py
1 parent a3df5a8 commit 041e4ea

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

livekit-rtc/livekit/rtc/jupyter.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
import contextlib
66
import os
77
from IPython.core.display import HTML, JSON
8+
from IPython.display import display
89
from importlib.resources import as_file, files
910

1011
_resource_stack = contextlib.ExitStack()
1112
atexit.register(_resource_stack.close)
1213

1314

14-
def display_room(url: str | None = None, token: str | None = None) -> HTML:
15+
def room_html(url: str | None = None, token: str | None = None) -> HTML:
1516
"""
1617
Display a LiveKit room in Jupyter or Google Colab.
1718
@@ -56,3 +57,18 @@ def create_join_token():
5657
index_path = _resource_stack.enter_context(as_file(index_path))
5758

5859
return HTML(index_path.read_text())
60+
61+
62+
def display_room(url: str | None = None, token: str | None = None) -> None:
63+
"""
64+
Display a LiveKit room in Jupyter or Google Colab.
65+
66+
Args:
67+
url (str | None): The LiveKit room URL. If None, the function attempts
68+
to use the LIVEKIT_JUPYTER_URL environment variable in a local or
69+
Colab environment.
70+
token (str | None): The LiveKit join token. If None, the function
71+
attempts to use the LIVEKIT_JUPYTER_URL environment variable in a
72+
local or Colab environment.
73+
"""
74+
display(room_html(url, token))

0 commit comments

Comments
 (0)