agora-python-server-sdk 2.2.4__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.4/agora_python_server_sdk.egg-info → agora_python_server_sdk-2.3.2}/PKG-INFO +177 -6
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/README.md +176 -5
- agora_python_server_sdk-2.3.2/agora/rtc/__init__.py +33 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_ctypes_data.py +129 -9
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_local_user_observer.py +2 -2
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_rtc_connection_observer.py +44 -1
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_base.py +61 -13
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_service.py +33 -21
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_encoded_frame_sender.py +12 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_pcm_data_sender.py +5 -3
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/local_user.py +27 -15
- agora_python_server_sdk-2.3.2/agora/rtc/rtc_connection.py +519 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/rtc_connection_observer.py +20 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/utils/audio_consumer.py +41 -0
- {agora_python_server_sdk-2.2.4 → 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.4 → agora_python_server_sdk-2.3.2/agora_python_server_sdk.egg-info}/PKG-INFO +177 -6
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/SOURCES.txt +5 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/setup.py +55 -4
- agora_python_server_sdk-2.2.4/agora/rtc/__init__.py +0 -101
- agora_python_server_sdk-2.2.4/agora/rtc/rtc_connection.py +0 -164
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/MANIFEST.in +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_audio_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_video_encoded_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_ctypes_handle/_video_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/_utils/globals.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/agora_parameter.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_sessionctrl.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/audio_vad_manager.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/local_audio_track.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/local_user_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/local_video_track.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/media_node_factory.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/remote_audio_track.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/remote_video_track.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/utils/vad_dump.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/video_encoded_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/video_frame_observer.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/video_frame_sender.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora/rtc/voice_detection.py +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/dependency_links.txt +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/agora_python_server_sdk.egg-info/top_level.txt +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/pyproject.toml +0 -0
- {agora_python_server_sdk-2.2.4 → agora_python_server_sdk-2.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
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
|
|
@@ -17,11 +17,23 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
- This is a Python SDK wrapper for the Agora RTC SDK.
|
|
18
18
|
- It supports Linux and Mac platforms.
|
|
19
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
|
|
20
22
|
|
|
21
23
|
# Very Important Notice !!!
|
|
22
|
-
- 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.
|
|
23
25
|
- An instance can have multiple connections.
|
|
24
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
|
+
|
|
25
37
|
|
|
26
38
|
# Required Operating Systems and Python Versions
|
|
27
39
|
- Supported Linux versions:
|
|
@@ -45,11 +57,171 @@ pip install agora_python_server_sdk
|
|
|
45
57
|
- Download and unzip [test_data.zip](https://download.agora.io/demo/test/test_data_202408221437.zip) to the Agora-Python-Server-SDK directory.
|
|
46
58
|
|
|
47
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/
|
|
48
62
|
```
|
|
49
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
|
|
50
64
|
```
|
|
51
65
|
|
|
52
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
|
+
|
|
53
225
|
## 2025.04.28 Release 2.2.4
|
|
54
226
|
-- Update: update rtc sdk from 4.4.31 to 4.4.32
|
|
55
227
|
## 2025.04.14 Release 2.2.3
|
|
@@ -69,6 +241,7 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
69
241
|
- Added connection::agora_rtc_conn_enable_encryption.
|
|
70
242
|
-- Additions:
|
|
71
243
|
- Added connectionObserver::on_encryption_error (but not working for now, need to fix in the next monthly version 4.4.32).
|
|
244
|
+
|
|
72
245
|
2025.02.26 Release 2.2.1
|
|
73
246
|
--Update:
|
|
74
247
|
- Reduced buffer size from 180ms to 100ms to minimize latency.
|
|
@@ -89,7 +262,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
89
262
|
- Add the AudioMetaData interface: localuser::send_audio_meta_data. Done.
|
|
90
263
|
- Add the OnAudioMetaDataReceived callback to localuserObserver::on_audio_meta_data_received. Done.
|
|
91
264
|
-- Sample modifications.
|
|
92
|
-
|
|
93
265
|
2024.12.17 Release 2.1.7
|
|
94
266
|
--Changes:
|
|
95
267
|
|
|
@@ -117,7 +289,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
117
289
|
-- Replaced the use of pacer with AudioConsumer for pushing PCM audio.
|
|
118
290
|
- Updates:
|
|
119
291
|
-- Updated the samples related to Pacer and VAD.
|
|
120
|
-
|
|
121
292
|
## 2024.12.03 release Version 2.1.5
|
|
122
293
|
- Modifications:
|
|
123
294
|
- LocalUser/audioTrack:
|
|
@@ -173,7 +344,6 @@ Fixed some bug.
|
|
|
173
344
|
- Handle business operations.
|
|
174
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.
|
|
175
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.
|
|
176
|
-
|
|
177
347
|
## Use of VAD
|
|
178
348
|
# Source code: voice_detection.py
|
|
179
349
|
# Sample code: example_audio_vad.py
|
|
@@ -204,7 +374,8 @@ Judge the value of state according to the returned state, and do corresponding p
|
|
|
204
374
|
### How to push the audio generated by TTS into the channel?
|
|
205
375
|
# Source code: audio_consumer.py
|
|
206
376
|
# Sample code: example_audio_consumer.py
|
|
207
|
-
|
|
377
|
+
|
|
378
|
+
### How to release resource?
|
|
208
379
|
## 如何释放资源?
|
|
209
380
|
localuser.unpublish_audio(audio_track)
|
|
210
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,171 @@ 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
|
+
|
|
38
210
|
## 2025.04.28 Release 2.2.4
|
|
39
211
|
-- Update: update rtc sdk from 4.4.31 to 4.4.32
|
|
40
212
|
## 2025.04.14 Release 2.2.3
|
|
@@ -54,6 +226,7 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
54
226
|
- Added connection::agora_rtc_conn_enable_encryption.
|
|
55
227
|
-- Additions:
|
|
56
228
|
- Added connectionObserver::on_encryption_error (but not working for now, need to fix in the next monthly version 4.4.32).
|
|
229
|
+
|
|
57
230
|
2025.02.26 Release 2.2.1
|
|
58
231
|
--Update:
|
|
59
232
|
- Reduced buffer size from 180ms to 100ms to minimize latency.
|
|
@@ -74,7 +247,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
74
247
|
- Add the AudioMetaData interface: localuser::send_audio_meta_data. Done.
|
|
75
248
|
- Add the OnAudioMetaDataReceived callback to localuserObserver::on_audio_meta_data_received. Done.
|
|
76
249
|
-- Sample modifications.
|
|
77
|
-
|
|
78
250
|
2024.12.17 Release 2.1.7
|
|
79
251
|
--Changes:
|
|
80
252
|
|
|
@@ -102,7 +274,6 @@ python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx
|
|
|
102
274
|
-- Replaced the use of pacer with AudioConsumer for pushing PCM audio.
|
|
103
275
|
- Updates:
|
|
104
276
|
-- Updated the samples related to Pacer and VAD.
|
|
105
|
-
|
|
106
277
|
## 2024.12.03 release Version 2.1.5
|
|
107
278
|
- Modifications:
|
|
108
279
|
- LocalUser/audioTrack:
|
|
@@ -158,7 +329,6 @@ Fixed some bug.
|
|
|
158
329
|
- Handle business operations.
|
|
159
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.
|
|
160
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.
|
|
161
|
-
|
|
162
332
|
## Use of VAD
|
|
163
333
|
# Source code: voice_detection.py
|
|
164
334
|
# Sample code: example_audio_vad.py
|
|
@@ -189,7 +359,8 @@ Judge the value of state according to the returned state, and do corresponding p
|
|
|
189
359
|
### How to push the audio generated by TTS into the channel?
|
|
190
360
|
# Source code: audio_consumer.py
|
|
191
361
|
# Sample code: example_audio_consumer.py
|
|
192
|
-
|
|
362
|
+
|
|
363
|
+
### How to release resource?
|
|
193
364
|
## 如何释放资源?
|
|
194
365
|
localuser.unpublish_audio(audio_track)
|
|
195
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)
|