Metadata-Version: 2.3
Name: WhipPyWeb
Version: 1.0.0
Summary: Add your description here
Project-URL: Issues, https://github.com/pkucmus/whipweb/issues
Project-URL: Source, https://github.com/pkucmus/whipweb
Author-email: Paweł Kucmus <pkucmus@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Paweł Kucmus
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: aiortc~=1.9.0
Requires-Dist: click~=8.1
Requires-Dist: rich~=13.8
Requires-Dist: starlette~=0.38
Requires-Dist: uvicorn~=0.30
Requires-Dist: websockets~=13.1
Provides-Extra: dev
Requires-Dist: ipdb; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: test
Requires-Dist: coverage[toml]; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Description-Content-Type: text/markdown

# WhipPyWeb

WhipPyWeb is a Python tool that allows you to stream your desktop to a web browser using WebRTC. It is designed with [OBS](https://obsproject.com/) in mind.

## Installation

You can install WhipPyWeb using pipx:

```bash
pipx install whippyweb
whippyweb run
```

or using Docker:

```bash
docker run -p 8080:8080 whippyweb
```

## Features

- Stream from OBS to a (single) web browser
- Very low latency between OBS and web browser
- You only need the Python server to establish the connection, audio and video are streamed directly from OBS to the web browser - there's no overhead of any Python processing (which can be slow).

## How it works

```mermaid
sequenceDiagram
    participant OBS as OBS
    participant WPW as WhipPyWeb
    participant BRS as Web Browser

    BRS->>WPW: Create websocket connection
    activate BRS
    activate WPW
    Note over OBS,BRS: Stream start
    OBS->>WPW: WebRTC offer
    activate WPW
    WPW->>BRS: WebRTC offer (over websocket)
    BRS->>BRS: Create WebRTC Answer
    BRS->>WPW: WebRTC answer (over websocket)
    WPW->>OBS: WebRTC answer
    deactivate WPW

    OBS->>BRS: Video and audio stream
    Note over OBS,BRS: Stream stop

    OBS->>WPW: WebRTC close
    activate WPW
    WPW->>BRS: WebRTC close (over websocket)
    BRS->>BRS: Close WebRTC connection
    deactivate BRS
    WPW->>OBS: OK
    deactivate WPW
    deactivate WPW
```

## How I got here

I wanted to improve the experience of an event I'm hosting. I wanted to stream my desktop to a web browser, to share the screen with my audience both in the same room (Projector with a Chromecast) and remotely (Google Meet sharescreen).

Tried RTMP, HLS but the latency was too much - imagine talking about a slide that is 3-12 seconds away from being visible on the screen...

Eventually stumbled upon [this Medium article](https://medium.com/@contact_45426/ultra-low-latency-streaming-with-obs-whip-whep-and-broadcast-box-fa649bf87fbe) which pointed me to [Broadcast-box](https://github.com/Glimesh/broadcast-box). Broadcast-box in turn, directed me to [OBS2Browser](https://github.com/Sean-Der/OBS2Browser).

Since I wanted to make some changes and I never written a line of code in GO, I decided to write a Python version of OBS2Browser. WhipPyWeb is the result.

Now I can stream from OBS to a web browser, with very low latency.

```mermaid
flowchart LR
    gl(Guest Laptop) --HDMI-to-USB-C--> ml(My Laptop with OBS)
    ml --With WhipPyWeb--> br(Web Browser)
    br --WiFi--> cc(Chromecast) --HDMI--> pr(Projector)
    br --> gm(Google Meet)
```

## Usage

Once `whippyweb` is running, you can access the player at `http://localhost:8080/player`. There you will see instructions on how to configure your OBS instance.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
