tessl install tessl/pypi-aiortc@1.13.0Python 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%
Build a real-time audio stream receiver that can accept incoming RTP audio streams from a remote peer, decode the audio, and save it to a file.
@generates
import asyncio
from aiortc import RTCPeerConnection, RTCSessionDescription
class AudioReceiver:
"""
Receives real-time audio from a remote WebRTC peer.
"""
def __init__(self, output_file: str):
"""
Initialize the audio receiver.
Args:
output_file: Path where received audio will be saved (WAV format)
"""
pass
async def receive_offer(self, offer_sdp: str, offer_type: str) -> dict:
"""
Process an incoming SDP offer from a remote peer and generate an answer.
Args:
offer_sdp: The SDP offer string from the remote peer
offer_type: The type of the offer (typically "offer")
Returns:
dict with keys 'sdp' (str) and 'type' (str) containing the answer
"""
pass
async def add_ice_candidate(self, candidate: str, sdp_mid: str, sdp_mline_index: int):
"""
Add an ICE candidate received from the remote peer.
Args:
candidate: The ICE candidate string
sdp_mid: Media stream identification
sdp_mline_index: Index of the media description in the SDP
"""
pass
async def start(self):
"""
Start receiving and processing audio. Blocks until the connection ends.
"""
pass
async def close(self):
"""
Close the connection and finalize the audio file.
"""
passProvides WebRTC implementation for real-time audio/video communication.
@satisfied-by