Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/api/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "The Python WebRTC API reference: RTCPeerConnection, data channels, tracks, streams, events, enums and exceptions, as in the W3C specifications."
---

# API reference

Everything is importable from the package itself: `webrtc.RTCPeerConnection`, `webrtc.RTCConfiguration`,
Expand Down
4 changes: 1 addition & 3 deletions docs/source/benchmarks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
myst:
html_meta:
"description": "Python WebRTC against aiortc, Pion, libdatachannel and webrtc-rs: connection setup, data channels, memory and media"
description: "Python WebRTC against aiortc, Pion, libdatachannel and webrtc-rs: connection setup, data channels, memory and media"
---

# Benchmarks
Expand Down
4 changes: 4 additions & 0 deletions docs/source/change_log.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
description: "What changed in each release of Python WebRTC, the wrtc package on PyPI."
---

```{include} ../../CHANGES.md
```
20 changes: 19 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

import ast
import enum
import html
import inspect
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

from docutils import nodes
from pygments.formatters import HtmlFormatter
Expand Down Expand Up @@ -384,6 +385,21 @@ def scope_pygments_to_theme(app: Sphinx, exception: Exception | None) -> None:
(Path(app.outdir) / '_static' / 'pygments.css').write_text('\n'.join(blocks), encoding='UTF-8')


def use_page_description(
_app: Sphinx, _pagename: str, _templatename: str, context: dict[str, Any], _doctree: nodes.document | None
) -> None:
"""Give search results and link previews the ``description`` of the page's front matter.

Without it, OpenGraph cuts both from the first paragraph of the page.
"""
description = (context.get('meta') or {}).get('description')
if not description:
return

context['meta']['og:description'] = description
context['metatags'] += f'<meta name="description" content="{html.escape(description)}" />\n'


def _design_components(root: nodes.Element, component: str) -> list[nodes.container]:
return [node for node in root.findall(nodes.container) if node.get('design_component') == component]

Expand Down Expand Up @@ -433,3 +449,5 @@ def setup(app: Sphinx) -> None:
app.connect('autodoc-process-signature', hide_enum_signatures)
app.connect('env-check-consistency', register_short_aliases)
app.connect('build-finished', scope_pygments_to_theme)
# before OpenGraph, which connects at the default priority
app.connect('html-page-context', use_page_description, priority=400)
4 changes: 4 additions & 0 deletions docs/source/examples/browser_server.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "A Python WebRTC server for a browser page: your camera comes back in grayscale, and Python answers a chat over a data channel."
---

# Browser and Python server

A browser page sends your camera to Python, which sends it back in grayscale, and Python answers a chat over a data
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/echo.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "A Python WebRTC peer that sends back the video it receives in grayscale, through a transform stream, as in a browser."
---

# Echo peer

Sends back the video it receives, in grayscale. A processor is piped through a transform stream into a generator,
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/gemini_live.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "A Gemini Live voice agent in the browser with live transcripts, through a Python WebRTC server that keeps the API key."
---

# Voice agent with Gemini Live

Talks to Gemini from a browser page, with live transcripts, through a Python server in the middle:
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Complete Python WebRTC programs: a server for a browser page, voice agents, WHIP and WHEP, live streams in the terminal and more."
---

# Examples

Complete programs from the [examples](https://github.com/MarshalX/python-webrtc/tree/main/examples) directory of the
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/janus_streaming.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Play a live WebRTC stream in the terminal with Python: the video as colored characters, the audio on your speakers."
---

# Live stream in the terminal

Plays a stream of the public [Janus](https://janus.conf.meetecho.com/) demo server. The video is drawn with colored
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/openai_live.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Talk to OpenAI GPT-Live from Python over WebRTC, with your microphone, speakers and live transcripts in the terminal."
---

# Voice chat with OpenAI GPT-Live

Talks to the model through your microphone and speakers, with live transcripts in the terminal. It needs no server, only an
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/recorder.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Record the video and audio a Python WebRTC peer receives to raw I420 and PCM files."
---

# Recorder

Writes the video and audio a peer receives to raw I420 and PCM files, with {obj}`~webrtc.MediaStreamTrackProcessor`.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/examples/whip_whep.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Play a live stream over WHEP in the terminal, or publish one over WHIP, with Python WebRTC."
---

# WHIP and WHEP

Plays a live stream over [WHEP](https://www.rfc-editor.org/rfc/rfc9725) in the terminal, or publishes one over WHIP.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/aiortc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Run aiortc code on Chrome's WebRTC engine: install wrtc[aiortc], change the imports to webrtc.aiortc, and the rest stays as it is."
---

# Migrating from aiortc

`webrtc.aiortc` runs code written for aiortc 1.15 on Python WebRTC's engine. Install the extra, change the imports,
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/connections.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Create an RTCPeerConnection in Python, exchange SDP and ICE candidates over your signalling, and follow its states and stats."
---

# Connections

{obj}`~webrtc.RTCPeerConnection` is one end of a connection. Each end describes itself in an SDP description, and
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/data-channels.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Send text and binary messages between peers with RTCDataChannel in Python: opening, options, back pressure and closing."
---

# Data channels

An {obj}`~webrtc.RTCDataChannel` sends messages between the peers, over SCTP inside the encrypted connection. See {mdn}`RTCDataChannel`.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/events.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Listen to the events of WebRTC connections, channels and tracks in Python: handlers, one-shot handlers, removal and errors."
---

# Events

Connections, channels, tracks and transports fire the events of the specification. Every one of them is an
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/field-trials.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Turn on features the native WebRTC engine ships turned off, such as WARP, with webrtc.field_trials in Python."
---

# Field trials

The native WebRTC engine ships some features turned off, behind field trials. A trial has a name, like
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/h264.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "H.264 in Python WebRTC: VideoToolbox on macOS, and Cisco's OpenH264 binary downloaded at runtime elsewhere."
---

# H.264

On macOS, H.264 comes from the OS's VideoToolbox and is always offered: Constrained Baseline and High, sent and
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Guides to Python WebRTC: connections, data channels, media, events, H.264, field trials and migrating from aiortc."
---

# Guides

The API is the one of the browsers, so the guides of MDN apply as they are, in snake_case. These pages cover what
Expand Down
4 changes: 4 additions & 0 deletions docs/source/guides/media.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Receive, send and transform audio and video in Python with MediaStreamTrackProcessor and MediaStreamTrackGenerator, as in a browser."
---

# Media

Media is read from tracks and written to them with the APIs of the browsers:
Expand Down
4 changes: 1 addition & 3 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
myst:
html_meta:
"description": "Python WebRTC: Chrome's WebRTC engine, with the browser API, in Python"
description: "Chrome's WebRTC engine with the browser API, in Python: peer connections, data channels, audio and video. Prebuilt wheels for Linux, macOS and Windows."
---

# Python WebRTC
Expand Down
4 changes: 4 additions & 0 deletions docs/source/licence.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Python WebRTC is under the BSD 3-Clause License. The licences of the bundled third-party code are listed too."
---

# Licence

BSD 3-Clause License. File in repository: [LICENSE.md](https://github.com/MarshalX/python-webrtc/blob/main/LICENSE.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/source/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "Install wrtc from PyPI and connect two Python peers over a WebRTC data channel in a few lines."
---

# Quickstart

## Installation
Expand Down
4 changes: 4 additions & 0 deletions docs/source/security.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
description: "Which versions of Python WebRTC get security fixes, and how to report a vulnerability."
---

```{include} ../../SECURITY.md
```
Loading