-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
714 additions
and
652 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
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
from .enums import ArchiveMode, MediaMode, TokenRole | ||
from .session import SessionOptions, VideoSession | ||
from .token import TokenOptions | ||
|
||
__all__ = ['MediaMode', 'ArchiveMode', 'TokenRole', 'TokenOptions'] | ||
__all__ = [ | ||
'MediaMode', | ||
'ArchiveMode', | ||
'TokenRole', | ||
'TokenOptions', | ||
'SessionOptions', | ||
'VideoSession', | ||
] |
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 was deleted.
Oops, something went wrong.
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,47 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field, model_validator | ||
|
||
from .enums import ArchiveMode, MediaMode, P2pPreference | ||
|
||
|
||
class SessionOptions(BaseModel): | ||
"""Options for creating a new session. | ||
Args: | ||
media_mode (MediaMode): The media mode for the session. | ||
archive_mode (ArchiveMode): The archive mode for the session. | ||
location (str): The location of the session. | ||
e2ee (bool): Whether end-to-end encryption is enabled. | ||
p2p_preference (str): The preference for peer-to-peer connections. | ||
This is set automatically by selecting the `media_mode`. | ||
""" | ||
|
||
archive_mode: Optional[ArchiveMode] = Field(None, serialization_alias='archiveMode') | ||
location: Optional[str] = None | ||
media_mode: Optional[MediaMode] = None | ||
e2ee: Optional[bool] = None | ||
p2p_preference: Optional[str] = Field( | ||
P2pPreference.DISABLED, serialization_alias='p2p.preference' | ||
) | ||
|
||
@model_validator(mode='after') | ||
def set_p2p_preference(self): | ||
if self.media_mode == MediaMode.ROUTED: | ||
self.p2p_preference = P2pPreference.DISABLED | ||
if self.media_mode == MediaMode.RELAYED: | ||
self.p2p_preference = P2pPreference.ALWAYS | ||
return self | ||
|
||
@model_validator(mode='after') | ||
def set_p2p_preference_if_archive_mode_set(self): | ||
if self.archive_mode == ArchiveMode.ALWAYS: | ||
self.p2p_preference = P2pPreference.DISABLED | ||
return self | ||
|
||
|
||
class VideoSession(BaseModel): | ||
session_id: str | ||
archive_mode: Optional[ArchiveMode] = None | ||
media_mode: Optional[MediaMode] = None | ||
location: Optional[str] = None |
File renamed without changes.
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,21 @@ | ||
from typing import List, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class StreamInfo(BaseModel): | ||
id: Optional[str] = Field(None, validation_alias='id') | ||
video_type: Optional[str] = Field(None, validation_alias='videoType') | ||
name: Optional[str] = Field(None, validation_alias='name') | ||
layout_class_list: Optional[List[str]] = Field( | ||
None, validation_alias='layoutClassList' | ||
) | ||
|
||
|
||
class StreamLayout(BaseModel): | ||
id: str | ||
layout_class_list: List[str] = Field(..., validation_alias='layoutClassList') | ||
|
||
|
||
class StreamLayoutOptions(BaseModel): | ||
items: List[StreamLayout] |
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
Oops, something went wrong.