-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
880ef18
commit f16e74e
Showing
6 changed files
with
189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exclude agora_rtc/agora/rtc/agora_sdk/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 注意 | ||
- 这是一个 Python SDK 封装的 Agora RTC SDK。 | ||
- 支持Linux和Mac平台。 | ||
- examples只是作为非常简单的演示,不建议在生产环境中使用。 | ||
|
||
# 非常重要的通知 !!!!!!! | ||
- 一个进程只能有一个实例 | ||
- 一个实例,可以有多个connection | ||
- 所有的observer或者是回调中,都不能在调用sdk自身的api,也不能在回调中做cpu耗时的工作,数据拷贝是可以的。 | ||
|
||
# 所需的操作系统和 Python 版本 | ||
- 支持的 Linux 版本: | ||
- Ubuntu 18.04 LTS 及以上 | ||
- CentOS 7.0 及以上 | ||
|
||
- 支持的 Mac 版本: | ||
- MacOS 13 及以上 | ||
|
||
- Python 版本: | ||
- Python 3.8 及以上 | ||
|
||
# 测试数据 | ||
- 下载并解压 [test_data.zip](https://download.agora.io/demo/test/test_data_202408221437.zip) | ||
- 在与 **agora_rtc** 同一目录下创建 **test_data** 目录 | ||
|
||
# Linux 调试与开发 | ||
## 准备 C 版本的 Agora RTC SDK | ||
- 在与 **agora_rtc/agora/rtc** 目录下创建 **agora_sdk** 目录 | ||
- 下载并解压 [agora_sdk.zip](https://download.agora.io/sdk/release/agora_rtc_sdk_linux_v4.4_20240914_1538_336910.zip) 到**agora_sdk** 目录。 | ||
- **agora_sdk** 目录中应有 **libagora_rtc_sdk.so** 和 **include_c** | ||
|
||
## 在 Linux 上运行示例 | ||
``` | ||
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1 | ||
``` | ||
|
||
|
||
# Mac 调试与开发 | ||
## 准备 C 版本的 Agora RTC SDK | ||
- 在与 **agora_rtc/agora/rtc** 目录下创建 **agora_sdk** 目录 | ||
- 下载并解压 [agora_sdk.zip](https://download.agora.io/sdk/release/agora_rtc_sdk_mac_v4.4_20240914_1538_336910.zip),到**agora_sdk** 目录。 | ||
- **agora_sdk** 目录中应有 **libAgoraRtcKit.dylib** | ||
|
||
## 在 Mac 上运行示例 | ||
``` | ||
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Notice | ||
- this is a python sdk wrappered agora rtc sdk. | ||
- can dev under mac, and release unde linux | ||
- the examples is just a simple demo, it is not a good practice to use it in production | ||
# Very import notice !!!!!!! | ||
- It's crucial that a process can only have one instance. | ||
- One instance can have multiple connections. | ||
- In all observers or callbacks, it is not allowed to call the SDK's own APIs, nor is it permitted to perform CPU-intensive tasks within the callbacks. However, data copying is allowed. | ||
|
||
# Required OS and python version | ||
- supported Linux version: | ||
- Ubuntu 18.04 LTS and above | ||
- CentOS 7.0 and above | ||
|
||
- supported Mac version: | ||
|
||
- MacOS 13 and above | ||
|
||
- python version: | ||
- python 3.8 above | ||
|
||
# Test Data | ||
- download and unzip [test_data.zip](https://download.agora.io/demo/test/test_data_202408221437.zip) | ||
- make **test_data** directory in the same directory with **agora_rtc** | ||
|
||
# Linux debug & develop | ||
## Prepare C version of agora rtc sdk | ||
|
||
- make **agora_sdk** directory under the directory of **agora_rtc/agora/rtc** | ||
- download and unzip [agora_sdk.zip](https://download.agora.io/sdk/release/agora_rtc_sdk_linux_v4.4_20240914_1538_336910.zip) to **agora_sdk** | ||
- there should be **libagora_rtc_sdk.so** and **include_c** in **agora_sdk** directory | ||
|
||
## run example on linux | ||
``` | ||
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1 | ||
``` | ||
|
||
# Mac debug & develop | ||
## Prepare C version of agora rtc sdk | ||
- make **agora_sdk** directory under the directory of **agora_rtc/agora/rtc** | ||
- download and unzip [agora_sdk.zip](https://download.agora.io/sdk/release/agora_rtc_sdk_mac_v4.4_20240914_1538_336910.zip) to **agora_sdk** | ||
- there should be **libAgoraRtcKit.dylib** in **agora_sdk** directory | ||
|
||
## run example on mac | ||
|
||
``` | ||
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1 | ||
``` | ||
# Some import call sequence | ||
- 1. about audio frame observer: | ||
|
||
set_playback_audio_frame_before_mixing_parameters MUST be call before register_audio_frame_observer | ||
|
||
sample code: | ||
``` | ||
localuser.set_playback_audio_frame_before_mixing_parameters(1, 16000) | ||
audio_observer = BizAudioFrameObserver() | ||
localuser.register_audio_frame_observer(audio_observer) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os | ||
import sys | ||
import zipfile | ||
# import urllib | ||
from urllib import request | ||
import ssl | ||
ssl._create_default_https_context = ssl._create_unverified_context | ||
import site | ||
from setuptools import setup | ||
from setuptools.command.install import install | ||
|
||
class CustomInstallCommand(install): | ||
def run(self): | ||
self.download_and_extract_sdk() | ||
install.run(self) | ||
|
||
def download_and_extract_sdk(self): | ||
print("download_and_extract_sdk--------------") | ||
|
||
agora_service_path = os.path.join(site.getsitepackages()[0], 'agora', 'rtc') | ||
url = "https://download.agora.io/sdk/release/agora_rtc_sdk_linux_v4.0.1_202409051524_333459.zip" | ||
libagora_rtc_sdk_path = os.path.join(agora_service_path, "agora_sdk/libagora_rtc_sdk.so") | ||
if sys.platform == 'darwin': | ||
url = "https://download.agora.io/sdk/release/agora_rtc_sdk_mac_4.0.1_20240913_320567.zip" | ||
libagora_rtc_sdk_path = os.path.join(agora_service_path, "agora_sdk/libAgoraRtcKit.dylib") | ||
|
||
sdk_dir = os.path.join(agora_service_path, "agora_sdk") | ||
if os.path.exists(sdk_dir): | ||
os.system(f"rm -rf {sdk_dir}") | ||
zip_path = os.path.join(agora_service_path, "agora_rtc_sdk.zip") | ||
libagora_rtc_sdk_path = os.path.join(agora_service_path, "libagora_rtc_sdk.so") | ||
os.makedirs(agora_service_path, exist_ok=True) | ||
|
||
print("agora_service_path:", agora_service_path) | ||
if not os.path.exists(zip_path): | ||
print(f"Downloading {url}...") | ||
request.urlretrieve(url, zip_path) | ||
|
||
if not os.path.exists(libagora_rtc_sdk_path): | ||
print(f"Extracting {zip_path}...") | ||
with zipfile.ZipFile(zip_path, 'r') as zip_ref: | ||
zip_ref.extractall(agora_service_path) | ||
|
||
if os.path.exists(zip_path): | ||
os.remove(zip_path) | ||
|
||
|
||
setup( | ||
name='agora_python_server_sdk', | ||
version='2.0.0', | ||
description='A Python SDK for Agora Server', | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/AgoraIO-Extensions/Agora-Python-Server-SDK', | ||
packages=["agora.rtc"], | ||
classifiers=[ | ||
"Intended Audience :: Developers", | ||
'License :: OSI Approved :: MIT License', | ||
"Topic :: Multimedia :: Sound/Audio", | ||
"Topic :: Multimedia :: Video", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3 :: Only", | ||
|
||
], | ||
python_requires='>=3.8', | ||
cmdclass={ | ||
'install': CustomInstallCommand, | ||
}, | ||
) | ||
|
||
if __name__ == "__main__": | ||
print("run setup -------------") |