Skip to main content

LiveKit Python Client SDK for LiveKit

Project description

The LiveKit icon, the name of the repository and some sample code in the background.

pypi-v

📹🎙️🐍 Python Client SDK for LiveKit

The Livekit Python Client provides a convenient interface for integrating Livekit's real-time video and audio capabilities into your Python applications. With this library, developers can easily leverage Livekit's WebRTC functionalities, allowing them to focus on building their AI models or other application logic without worrying about the complexities of WebRTC.

Official LiveKit documentation: https://docs.livekit.io/

Installation

$ pip install livekit

Connecting to a room

async def main():
    room = livekit.Room()
    # By default, autosubscribe is enabled. The participant will be subscribed to
    # 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)

    @room.on("participant_connected")
    def on_participant_connected(participant: livekit.RemoteParticipant):
        logging.info(
            "participant connected: %s %s", participant.sid, participant.identity)

    video_stream = None

    # 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):
        logging.info("track subscribed: %s", publication.sid)
        if track.kind == livekit.TrackKind.KIND_VIDEO:
            nonlocal video_stream
            video_stream = livekit.VideoStream(track)

            async for frame in video_stream:
                # received a video frame from the track, process it here
                pass

    await room.run()

Examples

Getting help / Contributing

Please join us on Slack to get help from our devs / community members. We welcome your contributions(PRs) and details can be discussed there.


LiveKit Ecosystem
Client SDKsComponents · JavaScript · iOS/macOS · Android · Flutter · React Native · Rust · Python · Unity (web) · Unity (beta)
Server SDKsNode.js · Golang · Ruby · Java/Kotlin · PHP (community) · Python (community)
ServicesLivekit server · Egress · Ingress
ResourcesDocs · Example apps · Cloud · Self-hosting · CLI

Project details


Release history Release notifications | RSS feed

This version

0.3.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit-0.3.3.tar.gz (30.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

livekit-0.3.3-py3-none-win_amd64.whl (6.4 MB view details)

Uploaded Python 3Windows x86-64

livekit-0.3.3-py3-none-manylinux_2_28_x86_64.whl (7.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

livekit-0.3.3-py3-none-manylinux_2_28_aarch64.whl (6.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

livekit-0.3.3-py3-none-macosx_11_0_arm64.whl (7.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

livekit-0.3.3-py3-none-macosx_10_9_x86_64.whl (8.8 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file livekit-0.3.3.tar.gz.

File metadata

  • Download URL: livekit-0.3.3.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for livekit-0.3.3.tar.gz
Algorithm Hash digest
SHA256 65477df9ecfc50bc888147920747a6176816069ecbe939f998d96eb2b9220da0
MD5 cc84c02b44ba6f41d28e03549fe9a23c
BLAKE2b-256 a537acdf13160675983257b5e287cf678d211e8cf99f4d16774e6e0e78f73797

See more details on using hashes here.

File details

Details for the file livekit-0.3.3-py3-none-win_amd64.whl.

File metadata

  • Download URL: livekit-0.3.3-py3-none-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for livekit-0.3.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a8e0d4865a087ccd6a09f839d8debd074c350c9121972197c2fd34fa2c950f74
MD5 dc70b29862e7378883e5cfda1da32426
BLAKE2b-256 21e3f5a377aa4c373e3a3b8ce0c48434d175136c8911458ae6f75ca3cb661826

See more details on using hashes here.

File details

Details for the file livekit-0.3.3-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for livekit-0.3.3-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc024531342a2a6be49a8009684741088d27acb3d9b5e5f8a8fb74604c10d054
MD5 b48745a23117107ae0130f8b733884a6
BLAKE2b-256 2fdcaadfbf232b3430b17d1c0de791640ae394ea3d13ff16167878ceff4a2a17

See more details on using hashes here.

File details

Details for the file livekit-0.3.3-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for livekit-0.3.3-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f4a73d0925e734828bf10e068a9d514e7ec5d829ebfd6e3ece6bbb4b25a6cdb2
MD5 f831ec5d41e22ced6e7d79b2a18e9149
BLAKE2b-256 051a20f20a9406f7a280cba286027aae3371a4eb57856e7db196b220a38130dc

See more details on using hashes here.

File details

Details for the file livekit-0.3.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for livekit-0.3.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 63ecb3746cee01ef6da030f46a0974cb53f1bfcd8d9748750d85dfbeda80480a
MD5 f6292d2d718a7e1c229dedb25fc1e70c
BLAKE2b-256 f45ab813372a5505bc52f961106aecb16aada86d4f1ffd693f54d94f15e46916

See more details on using hashes here.

File details

Details for the file livekit-0.3.3-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for livekit-0.3.3-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d1167f0210673f47f665e4e0dd8c58370ecbc535158ca84acfaae70634a5e7d
MD5 6b067b070fc2bf4e34d851443468266a
BLAKE2b-256 bbed7573fec53b1919ada99e1dbf6adba94323daabc83c7dc64c30b6a17cb6bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page