Python implementation of WebRTC and ORTC for real-time peer-to-peer communication
87
Build a session descriptor parser and builder utility that processes WebRTC session descriptions for a media streaming application. The utility should handle parsing existing session descriptions and creating new ones with proper formatting.
@generates
def parse_sdp(sdp_string: str) -> dict:
"""
Parse an SDP string into a structured dictionary.
Args:
sdp_string: Session Description Protocol string to parse
Returns:
Dictionary with 'type' and 'sdp' keys, where 'sdp' contains parsed SDP object
"""
pass
def get_codecs(sdp_object, media_type: str) -> list:
"""
Extract codec information for a specific media type from parsed SDP.
Args:
sdp_object: Parsed SDP object
media_type: Media type ('audio' or 'video')
Returns:
List of dictionaries containing codec 'name' and 'payload_type'
"""
pass
def get_ice_candidates(sdp_object) -> list:
"""
Extract all ICE candidates from parsed SDP.
Args:
sdp_object: Parsed SDP object
Returns:
List of ICE candidate strings
"""
pass
def create_offer(media_types: list) -> str:
"""
Create a new SDP offer with specified media types.
Args:
media_types: List of media types ('audio', 'video')
Returns:
SDP string formatted as an offer
"""
pass
def add_ice_candidate_to_sdp(sdp_string: str, candidate: str, media_index: int = 0) -> str:
"""
Add an ICE candidate to an SDP string.
Args:
sdp_string: Original SDP string
candidate: ICE candidate string to add
media_index: Index of media section to add candidate to (default 0)
Returns:
Modified SDP string with candidate added
"""
passProvides WebRTC implementation including session description protocol support.
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