-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(livekit): inital livekit support
- Loading branch information
Showing
12 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
from .role import * | ||
from .server import * | ||
from .user import * | ||
from .voice import * | ||
|
||
__version__ = "0.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
from .role import * | ||
from .server import * | ||
from .user import * | ||
from .voice import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TypedDict | ||
|
||
from typing_extensions import NotRequired | ||
|
||
__all__ = ( | ||
"VoiceInformation", | ||
"ChannelVoiceState" | ||
) | ||
|
||
class VoiceInformation(TypedDict): | ||
max_users: NotRequired[int] | ||
|
||
class ChannelVoiceState(TypedDict): | ||
id: str | ||
participants: list[UserVoiceState] | ||
|
||
class UserVoiceState(TypedDict): | ||
id: str | ||
can_receive: bool | ||
can_publish: bool | ||
screensharing: bool | ||
camera: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
import livekit | ||
Check failure on line 4 in revolt/voice.py
|
||
import livekit.rtc | ||
Check failure on line 5 in revolt/voice.py
|
||
|
||
|
||
if TYPE_CHECKING: | ||
from .types import VoiceInformation as VoiceInformationPayload | ||
from .state import State | ||
|
||
|
||
__all__ = ( | ||
"VoiceInformation", | ||
"VoiceState" | ||
) | ||
|
||
|
||
class VoiceInformation: | ||
"""Holds information on the voice configuration of the text channel | ||
Attributes | ||
----------- | ||
max_users: Optional[:class:`int`] | ||
How many users can be in the voice at once | ||
""" | ||
def __init__(self, data: VoiceInformationPayload) -> None: | ||
self.max_users: int | None = data.get("max_users", None) | ||
|
||
class VoiceState: | ||
def __init__(self, state: State, token: str) -> None: | ||
self.state = state | ||
self.token = token | ||
self.room = livekit.rtc.Room() | ||
Check failure on line 34 in revolt/voice.py
|
||
|
||
async def connect(self): | ||
await self.room.connect(self.state.api_info["features"]["livekit"]["url"], self.token) |