agora-python-server-sdk 2.2.1__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agora_python_server_sdk-2.2.1/agora_python_server_sdk.egg-info → agora_python_server_sdk-2.3.2}/PKG-INFO +197 -13
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/README.md +195 -5
- agora_python_server_sdk-2.3.2/agora/rtc/__init__.py +33 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_ctypes_data.py +170 -11
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_local_user_observer.py +6 -6
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_rtc_connection_observer.py +51 -1
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_base.py +68 -13
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_service.py +39 -21
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_encoded_frame_sender.py +12 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_pcm_data_sender.py +5 -3
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/local_user.py +27 -15
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/local_user_observer.py +5 -4
- agora_python_server_sdk-2.3.2/agora/rtc/rtc_connection.py +519 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/rtc_connection_observer.py +22 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/utils/audio_consumer.py +41 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/video_encoded_image_sender.py +8 -0
- agora_python_server_sdk-2.3.2/agora/rtm/__init__.py +36 -0
- agora_python_server_sdk-2.3.2/agora/rtm/_ctypes_handle/_ctypes_data.py +852 -0
- agora_python_server_sdk-2.3.2/agora/rtm/rtm_base.py +350 -0
- agora_python_server_sdk-2.3.2/agora/rtm/rtm_client.py +178 -0
- agora_python_server_sdk-2.3.2/agora/rtm/rtm_event_handler.py +2 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2/agora_python_server_sdk.egg-info}/PKG-INFO +197 -13
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/SOURCES.txt +5 -0
- agora_python_server_sdk-2.3.2/setup.py +140 -0
- agora_python_server_sdk-2.2.1/agora/rtc/__init__.py +0 -88
- agora_python_server_sdk-2.2.1/agora/rtc/rtc_connection.py +0 -139
- agora_python_server_sdk-2.2.1/setup.py +0 -75
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/MANIFEST.in +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_audio_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_video_encoded_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_video_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/_utils/globals.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_parameter.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_sessionctrl.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_vad_manager.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/local_audio_track.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/local_video_track.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/media_node_factory.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/remote_audio_track.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/remote_video_track.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/utils/vad_dump.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/video_encoded_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/video_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/video_frame_sender.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora/rtc/voice_detection.py +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/dependency_links.txt +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/top_level.txt +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/pyproject.toml +0 -0
- {agora_python_server_sdk-2.2.1 → agora_python_server_sdk-2.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: agora_python_server_sdk
|
|
3
|
-
Version: 2.2
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: A Python SDK for Agora Server
|
|
5
5
|
Home-page: https://github.com/AgoraIO-Extensions/Agora-Python-Server-SDK
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -12,22 +12,28 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
13
|
Requires-Python: >=3.10
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: requires-python
|
|
20
|
-
Dynamic: summary
|
|
21
15
|
|
|
22
16
|
# Note
|
|
23
17
|
- This is a Python SDK wrapper for the Agora RTC SDK.
|
|
24
18
|
- It supports Linux and Mac platforms.
|
|
25
19
|
- The examples are provided as very simple demonstrations and are not recommended for use in production environments.
|
|
20
|
+
-rtc examples:https://github.com/AgoraIO-Extensions/Agora-python-Server-SDK/examples
|
|
21
|
+
-rtm examples: https://github.com/AgoraIO-Extensions/Agora-python-Server-SDK/examples_rtm
|
|
26
22
|
|
|
27
23
|
# Very Important Notice !!!
|
|
28
|
-
- A process can only have one instance.
|
|
24
|
+
- A process can only have one instance,and the instance created in process startup is the global instance,and released in process shutdown.
|
|
29
25
|
- An instance can have multiple connections.
|
|
30
26
|
- In all observers or callbacks, you must not call the SDK's own APIs, nor perform CPU-intensive tasks in the callbacks; data copying is allowed.
|
|
27
|
+
- supported video codec:
|
|
28
|
+
- H264: support both encoding and decoding
|
|
29
|
+
- VP8: support both encoding and decoding
|
|
30
|
+
- VP9: support both encoding and decoding
|
|
31
|
+
- H265: only decoding is supported, encoding willl support in the future
|
|
32
|
+
- AV1: both encoding and decoding are suported but if video image's solution is less than 360p, the codec will be changed to H264
|
|
33
|
+
- if you want to recive the encoded video data:
|
|
34
|
+
- set: video_subscription_options.encodedFrameOnly = 1
|
|
35
|
+
- and then register: set_encoded_video_frame_observer
|
|
36
|
+
|
|
31
37
|
|
|
32
38
|
# Required Operating Systems and Python Versions
|
|
33
39
|
- Supported Linux versions:
|
|
@@ -51,11 +57,191 @@ pip install agora_python_server_sdk
|
|
|
51
57
|
- Download and unzip [test_data.zip](https://download.agora.io/demo/test/test_data_202408221437.zip) to the Agora-Python-Server-SDK directory.
|
|
52
58
|
|
|
53
59
|
## Executing Test Script
|
|
60
|
+
or linux os, should set env to :/site_packages/agora/agora_sdk/, like:
|
|
61
|
+
export LD_LIBRARY_PATH=/site_packages/agora/agora_sdk/
|
|
54
62
|
```
|
|
55
63
|
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1
|
|
56
64
|
```
|
|
57
65
|
|
|
58
66
|
# Change log
|
|
67
|
+
# 2025.10.23 release 2.3.2: support rtc and rtm in one package
|
|
68
|
+
-- update: to support rtm.can support both rtc and rtm in one package.
|
|
69
|
+
-- adjust sdk's directory structure
|
|
70
|
+
-- update rtc sdk
|
|
71
|
+
# 2025.10.09 release 2.3.1
|
|
72
|
+
-- update arm64 rtc sdk:Fixed a JNI referencing issue in the previous arm64 build. This issue only outputs logs to the console and does not affect functionality.
|
|
73
|
+
|
|
74
|
+
#2025.09.01 release 2.3.0
|
|
75
|
+
|
|
76
|
+
Overview
|
|
77
|
+
|
|
78
|
+
Agora Python SDK version 2.3.0 introduces significant enhancements for real-time audio and video communication, with particular optimizations for AI server scenarios. This release includes API improvements, automation of previously manual processes, and increased flexibility in connection configuration.
|
|
79
|
+
|
|
80
|
+
New Features
|
|
81
|
+
|
|
82
|
+
1. AudioScenarioAiServer Support
|
|
83
|
+
|
|
84
|
+
• Added support for the AudioScenarioAiServer scenario type, now set as the default AudioScenario.
|
|
85
|
+
|
|
86
|
+
• Enables configuration of different scenarios and profiles for connections within the same process.
|
|
87
|
+
|
|
88
|
+
• Important: When using AI server scenario, client-side must use AIClient scenario to avoid audio abnormalities. Please consult Agora support for SDK versions supporting AIClient scenario.
|
|
89
|
+
|
|
90
|
+
2. Enhanced Connection Configuration
|
|
91
|
+
|
|
92
|
+
• Introduced PublishConfigure parameter in connection creation for setting:
|
|
93
|
+
|
|
94
|
+
• Scenario and profile configurations
|
|
95
|
+
|
|
96
|
+
• Audio/Video publication settings
|
|
97
|
+
|
|
98
|
+
• Other publication parameters
|
|
99
|
+
|
|
100
|
+
• Added multiple observer registration methods to connections:
|
|
101
|
+
|
|
102
|
+
• RegisterLocalUserObserver
|
|
103
|
+
|
|
104
|
+
• RegisterAudioFrameObserver
|
|
105
|
+
|
|
106
|
+
• RegisterVideoFrameObserver
|
|
107
|
+
|
|
108
|
+
• RegisterVideoEncodedFrameObserver
|
|
109
|
+
|
|
110
|
+
3. Stream Management Improvements
|
|
111
|
+
|
|
112
|
+
• Added publication control methods:
|
|
113
|
+
|
|
114
|
+
• PublishAudio/UnpublishAudio
|
|
115
|
+
|
|
116
|
+
• PublishVideo/UnpublishVideo
|
|
117
|
+
|
|
118
|
+
• Added data pushing methods:
|
|
119
|
+
|
|
120
|
+
• PushAudioPcmData/PushAudioEncodedData
|
|
121
|
+
|
|
122
|
+
• PushVideoFrame/PushVideoEncodedData
|
|
123
|
+
|
|
124
|
+
• Added InterruptAudio method for supporting interruption functionality
|
|
125
|
+
|
|
126
|
+
• Added IsPushToRTCCompleted method for checking push status
|
|
127
|
+
|
|
128
|
+
• Added SendAudioMetaData method for audio metadata transmission
|
|
129
|
+
|
|
130
|
+
4. Automation Enhancements
|
|
131
|
+
|
|
132
|
+
• Eliminated manual CreateDataStream calls - now handled automatically
|
|
133
|
+
|
|
134
|
+
• Automatic observer unregistration on Release() instead of manual unregistering
|
|
135
|
+
|
|
136
|
+
• Internal handling of media node factory creation:
|
|
137
|
+
|
|
138
|
+
• No longer requires manual calls to newMediaNodeFactory
|
|
139
|
+
|
|
140
|
+
• Automatic handling of track creation (NewCustomAudioTrackPcm, NewCustomAudioTrackEncoded, NewCustomVideoTrack)
|
|
141
|
+
|
|
142
|
+
• Automatic management of audio data senders (NewAudioPcmDataSender)
|
|
143
|
+
|
|
144
|
+
Integration Process
|
|
145
|
+
|
|
146
|
+
The updated integration workflow is as follows:
|
|
147
|
+
|
|
148
|
+
1. Initialize Agora Service (once per process startup):
|
|
149
|
+
config = AgoraServiceConfig()
|
|
150
|
+
agora_service = AgoraService()
|
|
151
|
+
agora_service.initialize(config)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
2. Connection Management (can be looped for multiple connections):
|
|
155
|
+
# Create connection with configuration
|
|
156
|
+
con = agora_service.create_rtc_connection(con_config, publish_config)
|
|
157
|
+
|
|
158
|
+
# Register observers
|
|
159
|
+
con.register_observer(conHandler)
|
|
160
|
+
con.register_audio_frame_observer(audioFrameObserver)
|
|
161
|
+
con.register_local_user_observer(localUserObserver)
|
|
162
|
+
|
|
163
|
+
# Connect and publish
|
|
164
|
+
con.connect(token, channelName, userId)
|
|
165
|
+
con.publish_audio() # or con.publish_video()
|
|
166
|
+
|
|
167
|
+
# Push data
|
|
168
|
+
con.push_audio_pcm_data() # or push_audio_encoded_data()
|
|
169
|
+
# or con.push_video_frame()/push_video_encoded_data()
|
|
170
|
+
|
|
171
|
+
# Disconnect and release
|
|
172
|
+
con.disconnect()
|
|
173
|
+
con.release()
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
3. Release Agora Service (once during process termination):
|
|
177
|
+
agora_service.release()
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
Performance Recommendations
|
|
181
|
+
|
|
182
|
+
1. For AI Scenarios:
|
|
183
|
+
• Use AudioScenarioAIServer for server-side applications
|
|
184
|
+
|
|
185
|
+
• Provides optimized performance with lower latency (20-30ms reduction on iPhone compared to chorus)
|
|
186
|
+
|
|
187
|
+
• Enhanced experience in weak network conditions
|
|
188
|
+
|
|
189
|
+
• Mandatory: Client must use AIClient scenario
|
|
190
|
+
|
|
191
|
+
2. For Non-AI Scenarios:
|
|
192
|
+
• Consult Agora technical support for appropriate scenario configuration
|
|
193
|
+
|
|
194
|
+
• Ensure configuration matches specific business use cases
|
|
195
|
+
|
|
196
|
+
Bug Fixes
|
|
197
|
+
|
|
198
|
+
• Updated RTC SDK with 2 bug fixes
|
|
199
|
+
|
|
200
|
+
Important Notes
|
|
201
|
+
|
|
202
|
+
• Backward Compatibility: Review integration code for manual calls that are now automated
|
|
203
|
+
|
|
204
|
+
• Scenario Matching: Ensure client-server scenario compatibility (AIServer requires AIClient)
|
|
205
|
+
|
|
206
|
+
• Resource Management: Connection release now automatically handles observer unregistration
|
|
207
|
+
|
|
208
|
+
• Consult Support: For specific integration guidance and upgrade assistance, contact Agora SA
|
|
209
|
+
|
|
210
|
+
Summary of Core Changes
|
|
211
|
+
|
|
212
|
+
Before After 2.3.0
|
|
213
|
+
|
|
214
|
+
Manual CreateDataStream ✅ Automatic
|
|
215
|
+
|
|
216
|
+
Manual observer unregistration ✅ Automatic on Release()
|
|
217
|
+
|
|
218
|
+
Fixed per-process scenario ✅ Multi-scenario per process
|
|
219
|
+
|
|
220
|
+
Client/Server scenario mismatch ❗ AIClient mandatory for AI use
|
|
221
|
+
|
|
222
|
+
For detailed implementation guidance and version-specific support, please consult Agora technical support.
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
## 2025.04.28 Release 2.2.4
|
|
226
|
+
-- Update: update rtc sdk from 4.4.31 to 4.4.32
|
|
227
|
+
## 2025.04.14 Release 2.2.3
|
|
228
|
+
-- Fix:
|
|
229
|
+
-- Fixed a bug in the salt processing in enable_encryption
|
|
230
|
+
-- Updated the logic in enable_encryption, no processing when enable is 0
|
|
231
|
+
2025.04.10 Release 2.2.2
|
|
232
|
+
-- Additions:
|
|
233
|
+
- Added push_video_encoded_file.py to support pushing mp4 files and h264 encoded h.264 files. Includes conversion from mp4 file avformat to raw 264 stream in annex B format.
|
|
234
|
+
-- Additions:
|
|
235
|
+
- Added set_log_file_filter function to set the log filter level.
|
|
236
|
+
-- Additions:
|
|
237
|
+
- Added support for arm64 version, but currently this version does not support audio label algorithm. Therefore, it is not supported on arm64!
|
|
238
|
+
-- Changes:
|
|
239
|
+
- Modified localuserstats, local video stats, local audio stats, remote video stats, remote audio stats.
|
|
240
|
+
-- Additions:
|
|
241
|
+
- Added connection::agora_rtc_conn_enable_encryption.
|
|
242
|
+
-- Additions:
|
|
243
|
+
- Added connectionObserver::on_encryption_error (but not working for now, need to fix in the next monthly version 4.4.32).
|
|
244
|
+
|
|
59
245
|
2025.02.26 Release 2.2.1
|
|
60
246
|
--Update:
|
|
61
247
|
- Reduced buffer size from 180ms to 100ms to minimize latency.
|
|
@@ -76,7 +262,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
76
262
|
- Add the AudioMetaData interface: localuser::send_audio_meta_data. Done.
|
|
77
263
|
- Add the OnAudioMetaDataReceived callback to localuserObserver::on_audio_meta_data_received. Done.
|
|
78
264
|
-- Sample modifications.
|
|
79
|
-
|
|
80
265
|
2024.12.17 Release 2.1.7
|
|
81
266
|
--Changes:
|
|
82
267
|
|
|
@@ -104,7 +289,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
104
289
|
-- Replaced the use of pacer with AudioConsumer for pushing PCM audio.
|
|
105
290
|
- Updates:
|
|
106
291
|
-- Updated the samples related to Pacer and VAD.
|
|
107
|
-
|
|
108
292
|
## 2024.12.03 release Version 2.1.5
|
|
109
293
|
- Modifications:
|
|
110
294
|
- LocalUser/audioTrack:
|
|
@@ -160,7 +344,6 @@ Fixed some bug.
|
|
|
160
344
|
- Handle business operations.
|
|
161
345
|
- When a user logs out, execute con.disconnect() and release the audio/video tracks and observers associated with the connection, but do not call con.release(); then put the connection back into the connection pool.
|
|
162
346
|
- When the process exits, release the connection pool (release each con.release()), service/media_node_factory, and the connection pool (release each con.release()) to ensure resource release and optimal performance.
|
|
163
|
-
|
|
164
347
|
## Use of VAD
|
|
165
348
|
# Source code: voice_detection.py
|
|
166
349
|
# Sample code: example_audio_vad.py
|
|
@@ -191,7 +374,8 @@ Judge the value of state according to the returned state, and do corresponding p
|
|
|
191
374
|
### How to push the audio generated by TTS into the channel?
|
|
192
375
|
# Source code: audio_consumer.py
|
|
193
376
|
# Sample code: example_audio_consumer.py
|
|
194
|
-
|
|
377
|
+
|
|
378
|
+
### How to release resource?
|
|
195
379
|
## 如何释放资源?
|
|
196
380
|
localuser.unpublish_audio(audio_track)
|
|
197
381
|
localuser.unpublish_video(video_track)
|
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
- This is a Python SDK wrapper for the Agora RTC SDK.
|
|
3
3
|
- It supports Linux and Mac platforms.
|
|
4
4
|
- The examples are provided as very simple demonstrations and are not recommended for use in production environments.
|
|
5
|
+
-rtc examples:https://github.com/AgoraIO-Extensions/Agora-python-Server-SDK/examples
|
|
6
|
+
-rtm examples: https://github.com/AgoraIO-Extensions/Agora-python-Server-SDK/examples_rtm
|
|
5
7
|
|
|
6
8
|
# Very Important Notice !!!
|
|
7
|
-
- A process can only have one instance.
|
|
9
|
+
- A process can only have one instance,and the instance created in process startup is the global instance,and released in process shutdown.
|
|
8
10
|
- An instance can have multiple connections.
|
|
9
11
|
- In all observers or callbacks, you must not call the SDK's own APIs, nor perform CPU-intensive tasks in the callbacks; data copying is allowed.
|
|
12
|
+
- supported video codec:
|
|
13
|
+
- H264: support both encoding and decoding
|
|
14
|
+
- VP8: support both encoding and decoding
|
|
15
|
+
- VP9: support both encoding and decoding
|
|
16
|
+
- H265: only decoding is supported, encoding willl support in the future
|
|
17
|
+
- AV1: both encoding and decoding are suported but if video image's solution is less than 360p, the codec will be changed to H264
|
|
18
|
+
- if you want to recive the encoded video data:
|
|
19
|
+
- set: video_subscription_options.encodedFrameOnly = 1
|
|
20
|
+
- and then register: set_encoded_video_frame_observer
|
|
21
|
+
|
|
10
22
|
|
|
11
23
|
# Required Operating Systems and Python Versions
|
|
12
24
|
- Supported Linux versions:
|
|
@@ -30,11 +42,191 @@ pip install agora_python_server_sdk
|
|
|
30
42
|
- Download and unzip [test_data.zip](https://download.agora.io/demo/test/test_data_202408221437.zip) to the Agora-Python-Server-SDK directory.
|
|
31
43
|
|
|
32
44
|
## Executing Test Script
|
|
45
|
+
or linux os, should set env to :/site_packages/agora/agora_sdk/, like:
|
|
46
|
+
export LD_LIBRARY_PATH=/site_packages/agora/agora_sdk/
|
|
33
47
|
```
|
|
34
48
|
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1
|
|
35
49
|
```
|
|
36
50
|
|
|
37
51
|
# Change log
|
|
52
|
+
# 2025.10.23 release 2.3.2: support rtc and rtm in one package
|
|
53
|
+
-- update: to support rtm.can support both rtc and rtm in one package.
|
|
54
|
+
-- adjust sdk's directory structure
|
|
55
|
+
-- update rtc sdk
|
|
56
|
+
# 2025.10.09 release 2.3.1
|
|
57
|
+
-- update arm64 rtc sdk:Fixed a JNI referencing issue in the previous arm64 build. This issue only outputs logs to the console and does not affect functionality.
|
|
58
|
+
|
|
59
|
+
#2025.09.01 release 2.3.0
|
|
60
|
+
|
|
61
|
+
Overview
|
|
62
|
+
|
|
63
|
+
Agora Python SDK version 2.3.0 introduces significant enhancements for real-time audio and video communication, with particular optimizations for AI server scenarios. This release includes API improvements, automation of previously manual processes, and increased flexibility in connection configuration.
|
|
64
|
+
|
|
65
|
+
New Features
|
|
66
|
+
|
|
67
|
+
1. AudioScenarioAiServer Support
|
|
68
|
+
|
|
69
|
+
• Added support for the AudioScenarioAiServer scenario type, now set as the default AudioScenario.
|
|
70
|
+
|
|
71
|
+
• Enables configuration of different scenarios and profiles for connections within the same process.
|
|
72
|
+
|
|
73
|
+
• Important: When using AI server scenario, client-side must use AIClient scenario to avoid audio abnormalities. Please consult Agora support for SDK versions supporting AIClient scenario.
|
|
74
|
+
|
|
75
|
+
2. Enhanced Connection Configuration
|
|
76
|
+
|
|
77
|
+
• Introduced PublishConfigure parameter in connection creation for setting:
|
|
78
|
+
|
|
79
|
+
• Scenario and profile configurations
|
|
80
|
+
|
|
81
|
+
• Audio/Video publication settings
|
|
82
|
+
|
|
83
|
+
• Other publication parameters
|
|
84
|
+
|
|
85
|
+
• Added multiple observer registration methods to connections:
|
|
86
|
+
|
|
87
|
+
• RegisterLocalUserObserver
|
|
88
|
+
|
|
89
|
+
• RegisterAudioFrameObserver
|
|
90
|
+
|
|
91
|
+
• RegisterVideoFrameObserver
|
|
92
|
+
|
|
93
|
+
• RegisterVideoEncodedFrameObserver
|
|
94
|
+
|
|
95
|
+
3. Stream Management Improvements
|
|
96
|
+
|
|
97
|
+
• Added publication control methods:
|
|
98
|
+
|
|
99
|
+
• PublishAudio/UnpublishAudio
|
|
100
|
+
|
|
101
|
+
• PublishVideo/UnpublishVideo
|
|
102
|
+
|
|
103
|
+
• Added data pushing methods:
|
|
104
|
+
|
|
105
|
+
• PushAudioPcmData/PushAudioEncodedData
|
|
106
|
+
|
|
107
|
+
• PushVideoFrame/PushVideoEncodedData
|
|
108
|
+
|
|
109
|
+
• Added InterruptAudio method for supporting interruption functionality
|
|
110
|
+
|
|
111
|
+
• Added IsPushToRTCCompleted method for checking push status
|
|
112
|
+
|
|
113
|
+
• Added SendAudioMetaData method for audio metadata transmission
|
|
114
|
+
|
|
115
|
+
4. Automation Enhancements
|
|
116
|
+
|
|
117
|
+
• Eliminated manual CreateDataStream calls - now handled automatically
|
|
118
|
+
|
|
119
|
+
• Automatic observer unregistration on Release() instead of manual unregistering
|
|
120
|
+
|
|
121
|
+
• Internal handling of media node factory creation:
|
|
122
|
+
|
|
123
|
+
• No longer requires manual calls to newMediaNodeFactory
|
|
124
|
+
|
|
125
|
+
• Automatic handling of track creation (NewCustomAudioTrackPcm, NewCustomAudioTrackEncoded, NewCustomVideoTrack)
|
|
126
|
+
|
|
127
|
+
• Automatic management of audio data senders (NewAudioPcmDataSender)
|
|
128
|
+
|
|
129
|
+
Integration Process
|
|
130
|
+
|
|
131
|
+
The updated integration workflow is as follows:
|
|
132
|
+
|
|
133
|
+
1. Initialize Agora Service (once per process startup):
|
|
134
|
+
config = AgoraServiceConfig()
|
|
135
|
+
agora_service = AgoraService()
|
|
136
|
+
agora_service.initialize(config)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
2. Connection Management (can be looped for multiple connections):
|
|
140
|
+
# Create connection with configuration
|
|
141
|
+
con = agora_service.create_rtc_connection(con_config, publish_config)
|
|
142
|
+
|
|
143
|
+
# Register observers
|
|
144
|
+
con.register_observer(conHandler)
|
|
145
|
+
con.register_audio_frame_observer(audioFrameObserver)
|
|
146
|
+
con.register_local_user_observer(localUserObserver)
|
|
147
|
+
|
|
148
|
+
# Connect and publish
|
|
149
|
+
con.connect(token, channelName, userId)
|
|
150
|
+
con.publish_audio() # or con.publish_video()
|
|
151
|
+
|
|
152
|
+
# Push data
|
|
153
|
+
con.push_audio_pcm_data() # or push_audio_encoded_data()
|
|
154
|
+
# or con.push_video_frame()/push_video_encoded_data()
|
|
155
|
+
|
|
156
|
+
# Disconnect and release
|
|
157
|
+
con.disconnect()
|
|
158
|
+
con.release()
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
3. Release Agora Service (once during process termination):
|
|
162
|
+
agora_service.release()
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
Performance Recommendations
|
|
166
|
+
|
|
167
|
+
1. For AI Scenarios:
|
|
168
|
+
• Use AudioScenarioAIServer for server-side applications
|
|
169
|
+
|
|
170
|
+
• Provides optimized performance with lower latency (20-30ms reduction on iPhone compared to chorus)
|
|
171
|
+
|
|
172
|
+
• Enhanced experience in weak network conditions
|
|
173
|
+
|
|
174
|
+
• Mandatory: Client must use AIClient scenario
|
|
175
|
+
|
|
176
|
+
2. For Non-AI Scenarios:
|
|
177
|
+
• Consult Agora technical support for appropriate scenario configuration
|
|
178
|
+
|
|
179
|
+
• Ensure configuration matches specific business use cases
|
|
180
|
+
|
|
181
|
+
Bug Fixes
|
|
182
|
+
|
|
183
|
+
• Updated RTC SDK with 2 bug fixes
|
|
184
|
+
|
|
185
|
+
Important Notes
|
|
186
|
+
|
|
187
|
+
• Backward Compatibility: Review integration code for manual calls that are now automated
|
|
188
|
+
|
|
189
|
+
• Scenario Matching: Ensure client-server scenario compatibility (AIServer requires AIClient)
|
|
190
|
+
|
|
191
|
+
• Resource Management: Connection release now automatically handles observer unregistration
|
|
192
|
+
|
|
193
|
+
• Consult Support: For specific integration guidance and upgrade assistance, contact Agora SA
|
|
194
|
+
|
|
195
|
+
Summary of Core Changes
|
|
196
|
+
|
|
197
|
+
Before After 2.3.0
|
|
198
|
+
|
|
199
|
+
Manual CreateDataStream ✅ Automatic
|
|
200
|
+
|
|
201
|
+
Manual observer unregistration ✅ Automatic on Release()
|
|
202
|
+
|
|
203
|
+
Fixed per-process scenario ✅ Multi-scenario per process
|
|
204
|
+
|
|
205
|
+
Client/Server scenario mismatch ❗ AIClient mandatory for AI use
|
|
206
|
+
|
|
207
|
+
For detailed implementation guidance and version-specific support, please consult Agora technical support.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 2025.04.28 Release 2.2.4
|
|
211
|
+
-- Update: update rtc sdk from 4.4.31 to 4.4.32
|
|
212
|
+
## 2025.04.14 Release 2.2.3
|
|
213
|
+
-- Fix:
|
|
214
|
+
-- Fixed a bug in the salt processing in enable_encryption
|
|
215
|
+
-- Updated the logic in enable_encryption, no processing when enable is 0
|
|
216
|
+
2025.04.10 Release 2.2.2
|
|
217
|
+
-- Additions:
|
|
218
|
+
- Added push_video_encoded_file.py to support pushing mp4 files and h264 encoded h.264 files. Includes conversion from mp4 file avformat to raw 264 stream in annex B format.
|
|
219
|
+
-- Additions:
|
|
220
|
+
- Added set_log_file_filter function to set the log filter level.
|
|
221
|
+
-- Additions:
|
|
222
|
+
- Added support for arm64 version, but currently this version does not support audio label algorithm. Therefore, it is not supported on arm64!
|
|
223
|
+
-- Changes:
|
|
224
|
+
- Modified localuserstats, local video stats, local audio stats, remote video stats, remote audio stats.
|
|
225
|
+
-- Additions:
|
|
226
|
+
- Added connection::agora_rtc_conn_enable_encryption.
|
|
227
|
+
-- Additions:
|
|
228
|
+
- Added connectionObserver::on_encryption_error (but not working for now, need to fix in the next monthly version 4.4.32).
|
|
229
|
+
|
|
38
230
|
2025.02.26 Release 2.2.1
|
|
39
231
|
--Update:
|
|
40
232
|
- Reduced buffer size from 180ms to 100ms to minimize latency.
|
|
@@ -55,7 +247,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
55
247
|
- Add the AudioMetaData interface: localuser::send_audio_meta_data. Done.
|
|
56
248
|
- Add the OnAudioMetaDataReceived callback to localuserObserver::on_audio_meta_data_received. Done.
|
|
57
249
|
-- Sample modifications.
|
|
58
|
-
|
|
59
250
|
2024.12.17 Release 2.1.7
|
|
60
251
|
--Changes:
|
|
61
252
|
|
|
@@ -83,7 +274,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
83
274
|
-- Replaced the use of pacer with AudioConsumer for pushing PCM audio.
|
|
84
275
|
- Updates:
|
|
85
276
|
-- Updated the samples related to Pacer and VAD.
|
|
86
|
-
|
|
87
277
|
## 2024.12.03 release Version 2.1.5
|
|
88
278
|
- Modifications:
|
|
89
279
|
- LocalUser/audioTrack:
|
|
@@ -139,7 +329,6 @@ Fixed some bug.
|
|
|
139
329
|
- Handle business operations.
|
|
140
330
|
- When a user logs out, execute con.disconnect() and release the audio/video tracks and observers associated with the connection, but do not call con.release(); then put the connection back into the connection pool.
|
|
141
331
|
- When the process exits, release the connection pool (release each con.release()), service/media_node_factory, and the connection pool (release each con.release()) to ensure resource release and optimal performance.
|
|
142
|
-
|
|
143
332
|
## Use of VAD
|
|
144
333
|
# Source code: voice_detection.py
|
|
145
334
|
# Sample code: example_audio_vad.py
|
|
@@ -170,7 +359,8 @@ Judge the value of state according to the returned state, and do corresponding p
|
|
|
170
359
|
### How to push the audio generated by TTS into the channel?
|
|
171
360
|
# Source code: audio_consumer.py
|
|
172
361
|
# Sample code: example_audio_consumer.py
|
|
173
|
-
|
|
362
|
+
|
|
363
|
+
### How to release resource?
|
|
174
364
|
## 如何释放资源?
|
|
175
365
|
localuser.unpublish_audio(audio_track)
|
|
176
366
|
localuser.unpublish_video(video_track)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
import ssl
|
|
5
|
+
import zipfile
|
|
6
|
+
import site
|
|
7
|
+
from urllib import request
|
|
8
|
+
import ctypes
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
import platform
|
|
12
|
+
import logging
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
ssl._create_default_https_context = ssl._create_unverified_context
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
from .. import sdk_library_dir, sdk_rtc_dir, sdk_rtm_dir
|
|
18
|
+
|
|
19
|
+
lib_dir = sdk_library_dir
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
if sys.platform == 'darwin':
|
|
23
|
+
lib_agora_rtc_path = os.path.join(lib_dir, 'libAgoraRtcKit.dylib')
|
|
24
|
+
agora_lib = ctypes.CDLL(lib_agora_rtc_path)
|
|
25
|
+
|
|
26
|
+
elif sys.platform == 'linux':
|
|
27
|
+
lib_agora_rtc_path = os.path.join(lib_dir, 'libagora_rtc_sdk.so')
|
|
28
|
+
#ctypes.CDLL(os.path.join(lib_dir, 'libagora-fdkaac.so'))
|
|
29
|
+
agora_lib = ctypes.CDLL(lib_agora_rtc_path)
|
|
30
|
+
except OSError as e:
|
|
31
|
+
logger.error(f"Error loading the library: {e}")
|
|
32
|
+
logger.error(f"Attempted to load from: {lib_agora_rtc_path}")
|
|
33
|
+
sys.exit(1)
|