add recv python script

This commit is contained in:
wangjiyu 2025-04-10 10:48:05 +08:00
parent a9362449a6
commit 4692afcc3b
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import rtc_plugins
import time
import numpy as np
srcUserId = "srcUser1"
destUserId = "destUser1"
srcDisplayName = "srcDisplayName1"
destDisplayName = "destDisplayName1"
srcRoomId = "srcRoom1"
destRoomId = "destRoomId1"
srcChannelIndex = 42
destChannelIndex = 43
def my_callback(npData, dataCount, sampleRate, numChannels, channelIndex):
print(f"dataCount:{dataCount}, sampleRate:{sampleRate}, numChannels:{numChannels}, channelIndex:{channelIndex}")
ret = rtc_plugins.init(destUserId, destDisplayName, destRoomId, my_callback)
if ret != 0:
print(f"init fail, ret:{ret}")
exit(1)
ret = rtc_plugins.initRecv(destRoomId, srcUserId, destChannelIndex)
if ret != 0:
print(f"initRecv fail, ret:{ret}")
exit(1)
while True:
time.sleep(3)