Metadata-Version: 2.2
Name: tirtc
Version: 2.4.0
Summary: TiRTC headless RTC and Ti Cloud Storage SDK
Author: tange.ai
License: MIT License
         
         Copyright (c) 2024 tange.ai
         
         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.
         
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Communications
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Multimedia :: Video
Project-URL: Homepage, https://github.com/tangeai/tirtc-client-python
Project-URL: Repository, https://github.com/tangeai/tirtc-client-python
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# TiRTC Python SDK

`tirtc` 提供 headless RTC 接收与 Ti Cloud Storage 查询、回放和导出。它直接消费 Runtime public C，不在 Python 中重新实现连接、媒体处理、录像或云端协议。

当前支持普通 CPython 3.11 及之后的稳定版本，以及 macOS 11.5+ arm64、glibc Linux x86_64。binary wheel 已包含 Native 动态库和第三方许可证；安装和运行都不需要另外下载 Runtime，也不需要设置 `DYLD_LIBRARY_PATH` 或 `LD_LIBRARY_PATH`。

## 安装

公开发布后使用精确版本安装：

```bash
python -m pip install --only-binary=:all: tirtc==<version>
```

RTC 主链路从初始化开始，按 Output、Connection 的反向顺序释放：

```python
from pathlib import Path
import tirtc

tirtc.initialize(APP_ID, Path("/absolute/cache"))
try:
    with tirtc.Connection(on_state_changed=on_state) as connection:
        with tirtc.VideoOutput(on_frame=on_frame, on_error=on_error) as video:
            video.attach(connection, stream_id=0)
            connection.connect(DEVICE_ID, TOKEN)
            connection.subscribe_video(0)
            wait_for_frame()
            connection.unsubscribe_video(0)
            video.detach()
            connection.disconnect()
finally:
    tirtc.shutdown()
```

持续事件与媒体帧通过 callback 交付。Frame 是不可变 value，数据为 read-only `memoryview`；需要独立的可变或长期缓冲时显式调用 `bytes(frame.data)`。所有 Native 资源都提供明确的 `close()`、`stop()`、`wait()` 或 `delete()`，正常释放不依赖垃圾回收。

完整 RTC 程序见 [`example/client`](example/client)，Ti Cloud Storage 程序见 [`example/storage`](example/storage)。公开声明分别见仓库的 Python RTC 与 Ti Cloud Storage API Reference。
