mediasoup-client-pysdk, a simple mediasoup client development kit, i.e. 'smcdk', fork from pymediasoup and do more
Project description
Mediasoup-Client-PySDK (aka "smcdk")
a simple-to-use, pure python sdk of mediasoup client, fork from pymediasoup and do more.
Usage
For the purpose of to be an easy-to-use SDK, smcdk API design focus mainly on high level, and for users who know little about the official mediasoup client API.
from smcdk import *
mediasoup_client = MediasoupClient(...)
mediasoup_client.joinRoom(...)
mediasoup_client.play(...)
mediasoup_client.close()
more details, please see: examples/sdkApiDemo.py at GitHub
Why another mediasoup-client?( My Personal Option, for reference only)
There are several official and unofficial client implementations, but they are not quick and easy to run on all OS's desktop, so are not suitable to be a general SDK:
- official client with official dependency lib
- mediasoup-demo/aiortc: because it is based on Unix Socket, so it can't run in Windows
- mediasoup-demo/broadcasters: it is based on bash language, which is good at integrating command line tools, but is not good at developing new features
- mediasoup-demo/app: it can only run in browsers, and Electron-like desktop environment with less disk space occupation, or run in Node.js with more space occupation because of the node_modules directory
- mediasoup-broadcast-demo: it's quite hard to compile and link a libwebrtc dependency successfully on all OS platform, especially in China mainland's network environment
- no-official client
- pymediasoup: it is quite nice, but its API is a little hard to quick start as SDK
Install
pip3 install smcdk
Note:
- on Linux && MacOS, please ensure that libopus's and libvpx's development files have been installed before doing the above pip install, because there is a building step after installing the dependent aiortc lib. e.g. On Ubuntu:
sudo apt install libopus-dev, libvpx-dev
- in order to run examples/sdkApiDemo.py with mediasoup-demo/server's protoo websocket sub-protocol at GitHub, the websockets lib is also required:
pip3 install websockets
Architecture & Design
Mediasoup Client
it contains:
- Mediasoup Signaler Interface: follow the semantics of mediasoup-demo/server
- Loop Tasks & Listeners: to tackle signaler request and notification from server side
- Room and Peer: a group of simple room information related APIs to be integrated to Listeners
- Multimedia Runtime: a stateful mediasoup Device
Business Domain Based Listener Design
There are several business domain in SDK design: Bandwidth, Peer, Producer, Consumer, DataConsumer, result in 2 request listeners and 5 notification listeners, which their Respective interesting events to listen and tackle
- Server Request
- Consumer Listener event: newConsumer
- DataConsumer Listener event: newDataConsumer
- Server Notification
- Bandwidth Listener event: downlinkBwe
- Peer Listener event: newPeer, peerClosed, peerDisplayNameChanged, activeSpeaker
- Producer Listener event: producerScore
- Consumer Listener event: consumerLayersChanged, consumerScore, consumerClosed, consumerPaused, consumerResumed
- DataConsumer Listener event: dataConsumerClosed
Features
To be an easy-to-use sdk for mediasoup client development
-
quick to run: as mentioned above
-
all os(Windows, Linux, macOS) platform friendly: as mentioned above, I've tested on Windows 10, Ubuntu 22.04 LTS and macOS Catalina
-
signaling pluggable: based on the mediasoup's design goal of "signaling agnostic",
Be signaling agnostic: do not mandate any signaling protocol.”
(sited from mediasoup :: Overview). smcdk provide an out-of-box ProtooSignaler furthermore. Besides the default built-in signaler, which is used to communicate with mediasoup-demo/server, you can provide your own MediasoupSignalerInterface implementation to meet your requirement.
-
listener customizable: currently, you can customize 2 request listeners and 5 notification listeners
About Code Style
You can see many Camel-Case-Style naming in my Python code, e.g. "getRouterRtpCapabilities", not "get_router_rtp_capabilities". The reason is not only that I began my career as a Java developer since 2008, but also that I hope this SDK can be applied by those developers who use Python as a no-major language, and developers who have learned mediasoup by its demo app & server. Maybe sometime in the future, I'll change this naming style to follow Python’s PEP8 rules.
LICENSE
MIT
Thanks
special thanks to pymediasoup, mediasoup, and aiortc projects, they lay a solid foundation for the birth of smcdk.
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smcdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: smcdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 69.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.8.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6cfa67ade7d139b291dfcd92d81ccc68c0bd9975aa7a2d511bb5d4d2a950185
|
|
| MD5 |
8da0208f018db1246e582c051e4c2f9c
|
|
| BLAKE2b-256 |
1bb4ee177154686294cfc2cc134d43180229846c6f82ddcf91e06d27dd7756e0
|