Metadata-Version: 2.4
Name: easyrtc
Version: 0.0.2
Summary: A lightweight Python WebRTC streaming server-client using aiortc and OpenCV.
Author-email: Kayra Aytug <kayraaytug@outlook.com>
Maintainer-email: Kayra Aytug <kayraaytug@outlook.com>
License: MIT License
        
        Copyright (c) 2025 Kayra Aytug
        
        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.
Project-URL: Homepage, https://github.com/kayraaytug/easyrtc
Project-URL: Repository, https://github.com/kayraaytug/easyrtc
Project-URL: Bug Reports, https://github.com/kayraaytug/easyrtc/issues
Keywords: webrtc,stream,camera,opencv
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: aiortc>=1.4.0
Requires-Dist: opencv-python>=4.9.0.80
Requires-Dist: av>=10.0.0
Requires-Dist: numpy>=1.26.0
Dynamic: license-file

# EasyRTC

**EasyRTC** is a lightweight Python-based WebRTC framework built with `aiortc` that allows easy peer-to-peer video and data streaming between a server and client using OpenCV and asyncio. This example demonstrates how to capture video on the server side and display it in real-time on the client side with grayscale processing.

---

## Features

- 🎥 Simple server-side webcam streaming
- 📡 WebRTC-based peer-to-peer video connection
- 🎞️ Real-time OpenCV processing

---

## Requirements

- Python 3.7+
- `aiortc`
- `opencv-python`
- `numpy`
- `av`

You can install the required packages with:

```bash
pip install easyrtc
```

## Examples

### `camera_server.py`

```python
from easyrtc import WebRTCServer, CameraStream
import asyncio

async def main():
    server = WebRTCServer("127.0.0.1", 9999)
    server.add_camera_stream(CameraStream())
    await server.run()

if __name__ == "__main__":
    asyncio.run(main())
```

### `camera_client.py`

```python
from easyrtc import WebRTCClient
import asyncio
import cv2

async def main():
    client = WebRTCClient("127.0.0.1", 9999)
    await client.connect()
  
    while True:
        frame = await client.get_frame()
        if frame is not None:
            gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
            cv2.imshow("WebRTC Client", gray)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    await client.close()
    cv2.destroyAllWindows()

if __name__ == "__main__":
    asyncio.run(main())

```

#### `data_server.py`

```python
from easyrtc import WebRTCServer, DataStream
import asyncio

async def main():
    server = WebRTCServer("127.0.0.1", 9999)
    server.add_data_stream(DataStream(
        message={"type": "status", "value": "running"},
        interval=1.0
    ))
    await server.run()

if __name__ == "__main__":
    asyncio.run(main())
```
