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()

    # 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)

    async def receive_frames(stream: livekit.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):
        logging.info("track subscribed: %s", publication.sid)
        if track.kind == livekit.TrackKind.KIND_VIDEO:
            video_stream = livekit.VideoStream(track)
            asyncio.ensure_future(receive_frames(video_stream))

    # 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)

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

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.4.0.tar.gz (31.3 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.4.0-py3-none-win_amd64.whl (6.5 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

livekit-0.4.0-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.4.0.tar.gz.

File metadata

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

File hashes

Hashes for livekit-0.4.0.tar.gz
Algorithm Hash digest
SHA256 87e7796f2feeb9fc7b8bce8cce378bbcd7c0fe876e988e9e08c636b9a41fe431
MD5 2e7ad5aa9fbd37850fd78fd62b80de96
BLAKE2b-256 5f976e99e9d9322e01162c7c15cd37b2fe536fbf7c39c6b1184dc118e760f8b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: livekit-0.4.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 6.5 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.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 664803b9b67fe36fef419dbe6a175898090bea3f189564d2f0d7522601f04778
MD5 ea1ef4243de15cdb0a292f1fdf8f266a
BLAKE2b-256 973f028e376d019e61350a38f5aafffd24b7feef9e7e19e4635472948a6f58b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livekit-0.4.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa2f8a93bdd5b8a1232c1f3c4d6e17a1ec1ad1fbbe46beabfb8ddb9248a7d56a
MD5 390e8f6b160fc73732bbb57138031a10
BLAKE2b-256 c66f9e19ef9146eddeedf0b42377b7b440e308215e2856fcbce0871d6260e233

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livekit-0.4.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c0b62b2668027e5383314babdf2fcf2db9f86bbfd2abc11503951fa23cea656b
MD5 51dbe7437eaa90fec6924bbe5a5cc0de
BLAKE2b-256 b4213cf2329c6835a31e6d2562ebcef33216dcd8884051e4011b9e89be0652e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livekit-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4585ecb3d94369f0e5fa8a53576b746a367a9b3b8b67e1084f5e2f947106b8ae
MD5 451436956882edb0a7d066852c43ebd4
BLAKE2b-256 bdea812d6f87c939ccacc4ef3abffcf25c14f21d9b72bcf3de11aac57e051211

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livekit-0.4.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2ac982d7c7b0966f307d602290be32530d780f87341db12e9563d35bd36bbfec
MD5 3f3687f2cacaab5b465285076ef8ddfa
BLAKE2b-256 02ad2fce545ad1689bfa3ab560aa2c7750da177fcaa284a42d91003f091491dc

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