1

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

4
  • Possible duplicate of How to play mp3 from URL Commented Sep 30, 2018 at 8:23
  • @MatthewSmith, This link does not contain a solution to my question. Commented Sep 30, 2018 at 12:02
  • Check out stackoverflow.com/questions/34348607/… Commented Oct 1, 2018 at 3:55
  • @MatthewSmith Anyway error, but when using python-vlc Commented Oct 1, 2018 at 5:36

1 Answer 1

2

If this can help

from IPython.display import Audio
Audio(url="http://www.nch.com.au/acm/8k16bitpcm.wav")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.