elevenlabs-python
elevenlabs-python copied to clipboard
Stream function error: MPV can't access audio drivers (Streamlit web app)
Is there any way to use the stream
function on the cloud-deployed web app?
I'm using it in a very simple Streamlit app. Although it works on my local device, the stream
function doesn't play any sound on Streamlit cloud or within a Docker container. Specifically, this line just doesn't work: mpv_process.stdin.write(chunk) # type: ignore
. It seems like MPV cannot access the system's audio drivers in streamlit cloud or in a Docker container. Here's the stderror output for the mpv_process
on Streamlit cloud:
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory\nALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory\nALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory\nALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory\nALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default\nCannot connect to server socket err = No such file or directory\nCannot connect to server request channel\njack server is not running or cannot be started\nJackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock\nJackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock\nALSA lib confmisc.c:767:(parse_card) cannot find card '0'\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory\nALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory\nALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name\nALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory\nALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory\nALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default\nALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card\ncouldn't open play stream: No such file or directory\n
On streamlit cloud, when i list the audio devices with mpv --audio-device=help"
, this is what I receive:
List of detected audio devices:
'auto' (Autoselect device) '
alsa' (Default (alsa))
'jack' (Default (jack)) '
sdl' (Default (sdl))
'sndio' (Default (sndio))
Any advice here? I want to 'hear' the audio on a deployed webapp. It doesn't have to be on streamlit cloud but I want the stream function to work.
I tested locally on streamlit but only the source machine plays the audio...not sure if the 2 are connected from your issue.
I'm curious to this thread as I'm planning to spin up a cloud instance (debating providers now) I'm wondering if some providers have issues ... streamlit being one since I also am testing on streamlit.
I'll let you now what I find
Hey guys, did you find a fix to this? trying to do something similar