Open motoleon opened 3 years ago
if __name__ == '__main__':
cam = XMCam(CAM_IP, CAM_PORT, 'admin', 'admin')
login = cam.cmd_login()
print(login)
sleep(0.1)
streamconn = cam.create_sub_connection(True)
sleep(0.1)
success, pcm_audio_path = XMCam.talk_convert_to_pcm('/path/to/audio/file.mp3')
if success: # if audio converted into PCM successfully
streamconn.cmd_talk_claim()
sleep(0.1)
cam.cmd_talk_start()
audio_chunks = XMCam.talk_get_chunks(pcm_audio_path)
if audio_chunks is not None:
for audio_chunk in audio_chunks:
streamconn.cmd_talk_send_stream(audio_chunk)
sleep(0.04)
sleep(0.1)
cam.cmd_talk_stop()
sleep(0.1)
streamconn.disconnect()
sleep(0.1)
cam.disconnect()
Just improve the sleep position and time to improve prefered continous audio stream.
Hope this help.
Just forget/remove streamconn.disconnect()
line, because subconnection should not be a keepalive connection. It's should be disconnected automatically after requested keepalive timed out.
"xcam Cannot start keepalive" error
dont connect, user admin and password ***** are corrects. python 2.7 and 3.9 testing
from xmcam import from xmconst import from time import sleep
CAM_IP = '192.168.0.4' CAM_PORT = 34567
if name == 'main': xm = XMCam(CAM_IP, CAM_PORT, 'admin', 'xxxxxxxx') login = xm.cmd_login()
Hi. First many thanks. I need help sending audio to web cam. I dont how to do it, i need an example code (python) to send audiio to web cam, please.
Many thanks for your great job!