From 17726834e2bf58472bfa66d45ac1a3c33058cba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 09:57:26 -0700 Subject: [PATCH 1/5] wip --- README.md | 18 ++++++++++++------ livekit-api/livekit/api/version.py | 2 +- livekit-rtc/livekit/rtc/version.py | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 51c880ca..1d4612d7 100644 --- a/README.md +++ b/README.md @@ -16,22 +16,22 @@ Official LiveKit documentation: https://docs.livekit.io/ ## Installation +Rtc Client ```shell $ pip install livekit ``` +Api +```shell +$ pip install livekit-rtc +``` + ## Connecting to a room ```python async def main(): room = livekit.Room() - # participants and tracks that are already available in the room - # participant_connected and track_published events will *not* be emitted for them - for participant in room.participants.items(): - for publication in participant.tracks.items(): - print("track publication: %s", publication.sid) - @room.on("participant_connected") def on_participant_connected(participant: livekit.RemoteParticipant): logging.info( @@ -54,6 +54,12 @@ async def main(): # all published tracks in the room await room.connect(URL, TOKEN) logging.info("connected to room %s", room.name) + + # participants and tracks that are already available in the room + # participant_connected and track_published events will *not* be emitted for them + for participant in room.participants.items(): + for publication in participant.tracks.items(): + print("track publication: %s", publication.sid) ``` ## Examples diff --git a/livekit-api/livekit/api/version.py b/livekit-api/livekit/api/version.py index 1acd9021..485f44ac 100644 --- a/livekit-api/livekit/api/version.py +++ b/livekit-api/livekit/api/version.py @@ -1 +1 @@ -__version__ = "0.1.1.dev0" +__version__ = "0.1.1" diff --git a/livekit-rtc/livekit/rtc/version.py b/livekit-rtc/livekit/rtc/version.py index c672a18b..3d187266 100644 --- a/livekit-rtc/livekit/rtc/version.py +++ b/livekit-rtc/livekit/rtc/version.py @@ -1 +1 @@ -__version__ = "0.4.7.dev0" +__version__ = "0.5.0" From 0daec121ced02bc3a714a50582ee2feef4c86cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 09:58:57 -0700 Subject: [PATCH 2/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d4612d7..dc882d9b 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,12 @@ Official LiveKit documentation: https://docs.livekit.io/ ## Installation -Rtc Client +RTC Client ```shell $ pip install livekit ``` -Api +API / Server SDK ```shell $ pip install livekit-rtc ``` From bdf982d471f809662e138e4bf54deb09a7d81515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 10:00:51 -0700 Subject: [PATCH 3/5] Update README.md --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dc882d9b..ed5ac268 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,12 @@ Official LiveKit documentation: https://docs.livekit.io/ ## Installation -RTC Client +RTC Client: ```shell $ pip install livekit ``` -API / Server SDK +API / Server SDK: ```shell $ pip install livekit-rtc ``` @@ -29,25 +29,27 @@ $ pip install livekit-rtc ## Connecting to a room ```python +from livekit import rtc + async def main(): - room = livekit.Room() + room = rtc.Room() @room.on("participant_connected") - def on_participant_connected(participant: livekit.RemoteParticipant): + def on_participant_connected(participant: rtc.RemoteParticipant): logging.info( "participant connected: %s %s", participant.sid, participant.identity) - async def receive_frames(stream: livekit.VideoStream): + async def receive_frames(stream: rtc.VideoStream): async for frame in video_stream: # received a video frame from the track, process it here pass # track_subscribed is emitted whenever the local participant is subscribed to a new track @room.on("track_subscribed") - def on_track_subscribed(track: livekit.Track, publication: livekit.RemoteTrackPublication, participant: livekit.RemoteParticipant): + def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublication, participant: rtc.RemoteParticipant): logging.info("track subscribed: %s", publication.sid) - if track.kind == livekit.TrackKind.KIND_VIDEO: - video_stream = livekit.VideoStream(track) + if track.kind == rtc.TrackKind.KIND_VIDEO: + video_stream = rtc.VideoStream(track) asyncio.ensure_future(receive_frames(video_stream)) # By default, autosubscribe is enabled. The participant will be subscribed to From ee5b2effb078e5ce5c402f4e833b2d1df2c96174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 10:10:32 -0700 Subject: [PATCH 4/5] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index ed5ac268..e43797f8 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,21 @@ async def main(): print("track publication: %s", publication.sid) ``` +## Create a new access token + +``` +from livekit import api + +token = api.AccessToken("API_KEY", "SECRET_KEY") +token = AccessToken() +jwt = ( + token.with_identity("user1") + .with_name("user1") + .with_grants(VideoGrants(room_join=True, room="room1")) + .to_jwt() +) +``` + ## Examples - [Facelandmark](https://github.com/livekit/client-sdk-python/tree/main/examples/face_landmark): Use mediapipe to detect face landmarks (eyes, nose ...) From abd586d7c19709442d4a6915a248c0646b5476e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 10:11:47 -0700 Subject: [PATCH 5/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e43797f8..319ffe60 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ $ pip install livekit API / Server SDK: ```shell -$ pip install livekit-rtc +$ pip install livekit-api ``` ## Connecting to a room @@ -66,7 +66,7 @@ async def main(): ## Create a new access token -``` +```python from livekit import api token = api.AccessToken("API_KEY", "SECRET_KEY")