Update media.py

This commit is contained in:
Saifeddine ALOUI 2024-05-24 09:57:20 +02:00 committed by GitHub
parent ec7af0bb66
commit 27b4964cb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,10 +141,10 @@ class RTCom:
if snd_input_device is None: if snd_input_device is None:
devices = sd.query_devices() devices = sd.query_devices()
snd_input_device = [device['name'] for device in devices if device['type'] == 'input'][0] snd_input_device = [device['name'] for device in devices if device["max_input_channels"]>0][0]
if snd_output_device is None: if snd_output_device is None:
devices = sd.query_devices() devices = sd.query_devices()
snd_output_device = [device['name'] for device in devices if device['type'] == 'output'][0] snd_output_device = [device['name'] for device in devices if device["max_output_channels"]>0][0]
self.snd_input_device = snd_input_device self.snd_input_device = snd_input_device
self.snd_output_device = snd_output_device self.snd_output_device = snd_output_device
@ -574,4 +574,4 @@ class RealTimeTranscription:
# Stop the stream and clean up # Stop the stream and clean up
self.stream.stop_stream() self.stream.stop_stream()
self.stream.close() self.stream.close()
self.p.terminate() self.p.terminate()