or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aiortc@1.13.x
tile.json

tessl/pypi-aiortc

tessl install tessl/pypi-aiortc@1.13.0

Python implementation of WebRTC and ORTC for real-time peer-to-peer communication

Agent Success

Agent success rate when using this tile

87%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.02x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-5/

Video Conference Participant Manager

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.

Requirements

Participant Roles

The system should support three participant roles with different transmission capabilities:

  1. Presenter: Can send both audio and video, but cannot receive any media
  2. Viewer: Can receive both audio and video, but cannot send any media
  3. Moderator: Can both send and receive audio and video

Core Functionality

Implement a participant manager that:

  • Creates peer connections for participants with role-specific media capabilities
  • Configures transceivers based on participant roles to control media direction
  • Switches participant roles dynamically (e.g., promoting a viewer to presenter)
  • Tracks the current state of each participant's media capabilities

Role-Specific Media Configuration

  • Presenter role: Should be configured to send audio and video without receiving any media (send-only)
  • Viewer role: Should be configured to receive audio and video without sending any media (receive-only)
  • Moderator role: Should be configured for full bidirectional audio and video (send and receive)

Role Transitions

The system must support the following role transitions:

  • Viewer → Presenter: Change transceivers from receive-only to send-only
  • Presenter → Moderator: Change transceivers from send-only to bidirectional
  • Moderator → Viewer: Change transceivers from bidirectional to receive-only

Implementation

@generates

API

"""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
        """
        pass

Test Cases

  • A participant created with PRESENTER role has audio and video transceivers configured to send-only @test
  • A participant created with VIEWER role has audio and video transceivers configured to receive-only @test
  • A participant created with MODERATOR role has audio and video transceivers configured for bidirectional communication @test
  • Changing a participant from VIEWER to PRESENTER updates transceivers from receive-only to send-only @test

Dependencies { .dependencies }

aiortc { .dependency }

Provides WebRTC implementation for real-time communication, including RTCPeerConnection and transceiver management.