Python implementation of WebRTC and ORTC for real-time peer-to-peer communication
87
A system for managing video conference participants with selective audio/video transmission capabilities. The system should allow fine-grained control over which media types each participant can send and receive.
The system should support three participant roles with different transmission capabilities:
Implement a participant manager that:
The system must support the following role transitions:
@generates
"""Video conference participant manager with role-based media control."""
from aiortc import RTCPeerConnection
from enum import Enum
from typing import Optional
class ParticipantRole(Enum):
"""Participant role definitions."""
PRESENTER = "presenter"
VIEWER = "viewer"
MODERATOR = "moderator"
class ParticipantManager:
"""Manages video conference participants with role-based media control."""
def __init__(self):
"""Initialize the participant manager."""
pass
def create_participant(
self,
participant_id: str,
role: ParticipantRole,
peer_connection: RTCPeerConnection
) -> None:
"""
Create a participant with the specified role and configure media transceivers.
Args:
participant_id: Unique identifier for the participant
role: The participant's role (PRESENTER, VIEWER, or MODERATOR)
peer_connection: The RTCPeerConnection for this participant
"""
pass
def change_role(
self,
participant_id: str,
new_role: ParticipantRole
) -> None:
"""
Change a participant's role and update their media transceiver directions.
Args:
participant_id: The participant's unique identifier
new_role: The new role to assign
"""
pass
def get_participant_role(self, participant_id: str) -> Optional[ParticipantRole]:
"""
Get the current role of a participant.
Args:
participant_id: The participant's unique identifier
Returns:
The participant's current role, or None if not found
"""
passProvides WebRTC implementation for real-time communication, including RTCPeerConnection and transceiver management.
Install with Tessl CLI
npx tessl i tessl/pypi-aiortcdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10