|
2 | 2 |
|
3 | 3 | [](https://dl.circleci.com/status-badge/redirect/gh/jellyfish-dev/python-server-sdk/tree/main) |
4 | 4 |
|
5 | | -Python server SDK for [Jellyfish](https://github.com/jellyfish-dev/jellyfish). |
| 5 | +Python server SDK for the [Jellyfish](https://github.com/jellyfish-dev/jellyfish) media server. |
| 6 | + |
| 7 | +Read the docs [here](https://jellyfish-dev.github.io/python-server-sdk/jellyfish.html) |
6 | 8 |
|
7 | 9 | ## Installation |
8 | | -TODO |
| 10 | + |
| 11 | +You can install the latest version of the package from github: |
| 12 | +``` |
| 13 | +pip install git+https://github.com/jellyfish-dev/python-server-sdk |
| 14 | +``` |
9 | 15 |
|
10 | 16 | ## Usage |
11 | 17 |
|
| 18 | +First create a `RoomApi` instance, providing the jellyfish server address and api token |
| 19 | + |
| 20 | +```python |
| 21 | +from jellyfish import RoomApi |
| 22 | + |
| 23 | +room_api = RoomApi(server_address='localhost:5002', server_api_token='development') |
| 24 | +``` |
| 25 | + |
| 26 | +You can use it to interact with Jellyfish managing rooms, peers and components |
| 27 | + |
| 28 | +```python |
| 29 | +# Create a room |
| 30 | +jellyfish_address, room = room_api.create_room() |
| 31 | +# 'localhost:5002', Room(components=[], id='f7cc2eac-f699-4609-ac8f-92f1ad6bea0c', peers=[]) |
| 32 | + |
| 33 | +# Add peer to the room |
| 34 | +from jellyfish import PeerOptionsWebRTC |
| 35 | + |
| 36 | +peer_token, peer_webrtc = room_api.add_peer(room.id, peer_type='webrtc', options=PeerOptionsWebRTC()) |
| 37 | +# 'AgDYfrCSigFiAA', Peer(id='2869fb5', status=<PeerStatus.DISCONNECTED: 'disconnected'>, type='webrtc') |
| 38 | + |
| 39 | +# Add component to the room |
| 40 | +component_hls = room_api.add_component(room.id, component_type='hls') |
| 41 | +# Component(id='4c028a86', metadata=ComponentMetadata(playable=False), type='hls') |
| 42 | +``` |
| 43 | + |
12 | 44 | ## Copyright and License |
13 | 45 |
|
14 | 46 | Copyright 2023, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=jellyfish) |
|
0 commit comments