Package: smcdk
Mediasoup-Client-PySDK (aka "smcdk")a simple-to-use, pure python sdk ofmediasoupclient, fork frompymediasoupand do more.UsageFor 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.fromsmcdkimport*mediasoup_client=MediasoupClient(...)mediasoup_client.joinRoom(...)mediasoup_client.play(...)mediasoup_client.close()more details, please see: examples/sdkApiDemo.py at GitHubWhy 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 libmediasoup-demo/aiortc: because it is based on Unix Socket, so it can't run in Windowsmediasoup-demo/broadcasters: it is based on bash language, which is good at integrating command line tools, but is not good at developing new featuresmediasoup-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 directorymediasoup-broadcast-demo: it's quite hard to compile and link a libwebrtc dependency successfully on all OS platform, especially in China mainland's network environmentno-official clientpymediasoup： it is quite nice, but its API is a little hard to quick start as SDKInstallpip3installsmcdkNote: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：sudoaptinstalllibopus-dev,libvpx-devin 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 websocketsArchitecture & DesignMediasoup Clientit contains:Mediasoup Signaler Interface: follow the semantics of mediasoup-demo/serverLoop Tasks & Listeners: to tackle signaler request and notification from server sideRoom and Peer: a group of simple room information related APIs to be integrated to ListenersMultimedia Runtime: a stateful mediasoup DeviceBusiness Domain Based Listener DesignThere 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 tackleServer RequestConsumer Listener event: newConsumerDataConsumer Listener event: newDataConsumerServer NotificationBandwidth Listener event: downlinkBwePeer Listener event: newPeer, peerClosed, peerDisplayNameChanged, activeSpeakerProducer Listener event: producerScoreConsumer Listener event: consumerLayersChanged, consumerScore, consumerClosed, consumerPaused, consumerResumedDataConsumer Listener event: dataConsumerClosedFeaturesTo be an easy-to-use sdk for mediasoup client developmentquick to run: as mentioned aboveall os(Windows, Linux, macOS) platform friendly: as mentioned above, I've tested on Windows 10, Ubuntu 22.04 LTS and macOS Catalinasignaling pluggable: based on the mediasoup's design goal of "signaling agnostic",Be signaling agnostic: do not mandate any signaling protocol.”(sited frommediasoup :: 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 listenersAbout Code StyleYou 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.LICENSEMITThanksspecial thanks topymediasoup,mediasoup, andaiortcprojects, they lay a solid foundation for the birth of smcdk.