Reputation: 119
There is a link to an mp3
file that needs to be streamed from a URL
like http://example.com/music_radio.mp3
and played on a computer. On the Internet, although there are examples of streaming audio, but they are mainly for Python2
, and for Python3
there are no such libraries anymore, I tried to do it this way:
import vlc
p = vlc.MediaPlayer ("http://example.com/music_radio.mp3")
p.play ()
But it constantly displays an error:
Traceback (most recent call last): File "PythonProjects / URL / main.py", line 2, in import vlc File "PythonProjects / URL / venv / lib / python3.6 / site-packages / vlc / init.py", line 3, in public import ModuleNotFoundError: No module named 'public'
And the problem is that the public
module is not installed. How can you solve this problem or how else can you receive and play audio by reference?
UPD: That link suggests either non-working code, or code using Python2, not Python3
UPD2: When using python-vlc
, this error occurs:
Traceback (most recent call last): File "PythonProjects/URL/main.py", line 4, in import vlc File "PythonProjects/URL/venv/lib/python3.6/site-packages/vlc.py", line 203, in dll, plugin_path = find_lib() File "PythonProjects/URL/venv/lib/python3.6/site-packages/vlc.py", line 194, in find_lib ctypes.CDLL('libvlccore.dylib') File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/init.py", line 348, in init self._handle = _dlopen(self._name, mode) OSError: dlopen(libvlccore.dylib, 6): image not found
Upvotes: 1
Views: 4914
Reputation: 107
If this can help
from IPython.display import Audio
Audio(url="http://www.nch.com.au/acm/8k16bitpcm.wav")
Upvotes: 2