Improve API design of publishing data
davidzhao opened this issue · comments
Currently to publish audio data, a user would have to write something like this:
audio_frame = livekit.AudioFrame.create(
...
)
audio_data = np.ctypeslib.as_array(audio_frame.data)
while True:
duration, decoded_pcm_data = producer.get_frame()
np.copyto(audio_data, decoded_pcm_data)
source.capture_frame(audio_frame)
Dealing with ctypes is not clean here, and this should be abstracted within the SDK itself.