Skip to main content

Janus webrtc client, to be used with asyncio.

Project description

Janus Client for Python

License: MIT Development Stage

This is a Janus webrtc client written in Python, to be used with asyncio.


Description

Features

:heavy_check_mark: Connect to Janus server through websocket (using websockets)
:heavy_check_mark: Create/destroy sessions
:heavy_check_mark: Create/destroy plugins
:heavy_check_mark: Handle transactions with Janus

In Progress

:clock3: Emit events to respective session and plugin handlers
:clock3: Create plugin for videoroom plugin
:clock3: Distribute as PyPI package

Dependencies


Development

Currently only a base class to create Janus plugin handler is inteded to be distributed, so the video_room_plugin.py is not in janus_client_py. From there, you can get a reference of how a plugin handler class can be created.

In main.py, you will be able to find references on how to use the client in general such as connecting and creating sessions. Essence:

from video_room_plugin import JanusVideoRoomPlugin
from janus_client_py import JanusClient, JanusSession

async def main():
    # Connect to server
    client = JanusClient("wss://lt.limmengkiat.name.my/janusws/")
    await client.connect(ssl=ssl_context)
    # Create session
    session = await client.create_session(JanusSession)
    # Create plugin
    plugin_handle = await session.create_plugin_handle(JanusVideoRoomPlugin)

    participants = await plugin_handle.list_participants(1234)
    if len(participants) > 0:
        # Publishers available
        participants_data_1 = participants[0]
        participant_id = participants_data_1["id"]

        # Subscribe to publisher, will get jsep (sdp offer)
        await plugin_handle.subscribe(1234, participant_id)
        # WebRTC streaming not implemented yet
        await asyncio.sleep(5)
        # Unsubscribe from the publisher
        await plugin_handle.unsubscribe()

    # Destroy plugin
    await plugin_handle.destroy()
    # Destroy session
    await session.destroy()
    # Destroy connection
    await client.disconnect()

asyncio.run(main())

Installing for development

Installing gstreamer
https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=python

Installing gst python
http://lifestyletransfer.com/how-to-install-gstreamer-python-bindings/

Installing webrtcbin
https://github.com/centricular/gstwebrtc-demos/issues/37
(gir1.2-gst-plugins-bad-1.0)

More bad plugins
frei0r-plugins

Project details


Download files

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

Source Distribution

janus-client-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

janus_client-0.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file janus-client-0.0.1.tar.gz.

File metadata

  • Download URL: janus-client-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.3

File hashes

Hashes for janus-client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 089dc51dcb7981d20f7b76aeb72f2255c80e1b5eff8ad16390ee74eb2c4bff38
MD5 cbd20bb990b4cbc93bd5e33ba9d5af56
BLAKE2b-256 7847fd2dd5d832e8afa35a3e83ed7a1c02f875590b5d2eba0e43d7567dea1ae9

See more details on using hashes here.

File details

Details for the file janus_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: janus_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.3

File hashes

Hashes for janus_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8a20008e1658181b9379f99055eadc57fc257807d89507390f2d10f5c44e76e
MD5 cac45406abc587a1674d04c9b73e6960
BLAKE2b-256 cc24861600b0b561ee9dddffc90e70160c1bd619b962d0d191911db4ff9da77d

See more details on using hashes here.

Supported by

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