Skip to content

Commit 1c8d59c

Browse files
authored
rtc-v0.5.0 & api-v0.1.1 (#81)
1 parent bdd5c80 commit 1c8d59c

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

README.md

+35-12
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,67 @@ Official LiveKit documentation: https://docs.livekit.io/
1616

1717
## Installation
1818

19+
RTC Client:
1920
```shell
2021
$ pip install livekit
2122
```
2223

24+
API / Server SDK:
25+
```shell
26+
$ pip install livekit-api
27+
```
28+
2329
## Connecting to a room
2430

2531
```python
26-
async def main():
27-
room = livekit.Room()
32+
from livekit import rtc
2833

29-
# participants and tracks that are already available in the room
30-
# participant_connected and track_published events will *not* be emitted for them
31-
for participant in room.participants.items():
32-
for publication in participant.tracks.items():
33-
print("track publication: %s", publication.sid)
34+
async def main():
35+
room = rtc.Room()
3436

3537
@room.on("participant_connected")
36-
def on_participant_connected(participant: livekit.RemoteParticipant):
38+
def on_participant_connected(participant: rtc.RemoteParticipant):
3739
logging.info(
3840
"participant connected: %s %s", participant.sid, participant.identity)
3941

40-
async def receive_frames(stream: livekit.VideoStream):
42+
async def receive_frames(stream: rtc.VideoStream):
4143
async for frame in video_stream:
4244
# received a video frame from the track, process it here
4345
pass
4446

4547
# track_subscribed is emitted whenever the local participant is subscribed to a new track
4648
@room.on("track_subscribed")
47-
def on_track_subscribed(track: livekit.Track, publication: livekit.RemoteTrackPublication, participant: livekit.RemoteParticipant):
49+
def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublication, participant: rtc.RemoteParticipant):
4850
logging.info("track subscribed: %s", publication.sid)
49-
if track.kind == livekit.TrackKind.KIND_VIDEO:
50-
video_stream = livekit.VideoStream(track)
51+
if track.kind == rtc.TrackKind.KIND_VIDEO:
52+
video_stream = rtc.VideoStream(track)
5153
asyncio.ensure_future(receive_frames(video_stream))
5254

5355
# By default, autosubscribe is enabled. The participant will be subscribed to
5456
# all published tracks in the room
5557
await room.connect(URL, TOKEN)
5658
logging.info("connected to room %s", room.name)
59+
60+
# participants and tracks that are already available in the room
61+
# participant_connected and track_published events will *not* be emitted for them
62+
for participant in room.participants.items():
63+
for publication in participant.tracks.items():
64+
print("track publication: %s", publication.sid)
65+
```
66+
67+
## Create a new access token
68+
69+
```python
70+
from livekit import api
71+
72+
token = api.AccessToken("API_KEY", "SECRET_KEY")
73+
token = AccessToken()
74+
jwt = (
75+
token.with_identity("user1")
76+
.with_name("user1")
77+
.with_grants(VideoGrants(room_join=True, room="room1"))
78+
.to_jwt()
79+
)
5780
```
5881

5982
## Examples

livekit-api/livekit/api/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.1.dev0"
1+
__version__ = "0.1.1"

livekit-rtc/livekit/rtc/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.4.7.dev0"
1+
__version__ = "0.5.0"

0 commit comments

Comments
 (0)