我使用了Python和Agora-Python-SDK包。但是Python的API参考仍在继续。然而,它非常类似于“Agora C++ API”。您可以改用this Documentation。另外,如果你能在C++中帮助,它仍然是好的。谢谢你的帮助
此外,我需要无声地录制频道。无需在设备上播放任何声音。我认为如果这在多线程上运行会更好
import agorartc
import threading
channel_name = 'MdgE1K2g' #for example
# Set some global variables
try:
RTC = agorartc.RtcEngineBridge()
eventHandler = agorartc.RtcEngineEventHandlerBase()
RTC.initEventHandler(eventHandler)
# 0xFFFFFFFE will exclude Chinese servers from Agora's servers.
RTC.initialize(Clubhouse.AGORA_KEY, None, agorartc.AREA_CODE_GLOB & 0xFFFFFFFE)
# Enhance voice quality
if RTC.setAudioProfile(
agorartc.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,
agorartc.AUDIO_SCENARIO_GAME_STREAMING
) < 0:
print("[-] Failed to set the high quality audio profile")
except ImportError:
RTC = None
# Check for the voice level.
if RTC:
token = channel_info['token']
RTC.joinChannel(token, channel_name, "", int(user_id))
RTC.startAudioRecording ("%s.mp3"%channel_name, 32)
else:
print("[!] Agora SDK is not installed.")
print(" You may not speak or listen to the conversation.")
目前没有回答
相关问题 更多 >
编程相关推荐