Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run the following code using python bindings for vlc

I started with Python Bindings for the first time with: operating system- ubuntu 14.04 vlc-1.1.2 and python-2.7.6 Here is the sample code I am working on:

import vlc 
instance = vlc.Instance()
media_ply = instance.media_player_new()
media_ply.set_mrl("test1.mp3")
media_ply.play()

But I am constantly getting the following error message:

 Traceback (most recent call last):
 File "vlc1.py", line 3, in <module>
 instance = vlc.Instance()
 File "/home/ankita/env2/mmenv5/local/lib/python2.7/site-packages/vlc.py",                line 1551, in __new__
 return libvlc_new(len(args), args)
 File "/home/ankita/env2/mmenv5/local/lib/python2.7/site-packages/vlc.py",        line 3903, in libvlc_new
 ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p))
 File "/home/ankita/env2/mmenv5/local/lib/python2.7/site-packages/vlc.py", line 246, in _Cfunction
 raise NameError('no function %r' % (name,))
 NameError: no function 'libvlc_new'

Can anybody tell me , did I do something wrong?

like image 538
Zuhi Avatar asked Dec 30 '16 09:12

Zuhi


2 Answers

I was getting same error. Then I solved it by installing vlc (stupid mistake :D) using

sudo apt-get install vlc
like image 189
aquaman Avatar answered Sep 30 '22 07:09

aquaman


download vlc.py from vlc.py

Place vlc.py in the same directory as your program.

Note that you must have the VLC Media Player program already installed on your system.

To test it quickly in python:

>>> import vlc
>>> p=vlc.MediaPlayer('test1.mp3')
>>> p.play()
like image 45
Rolf of Saxony Avatar answered Sep 30 '22 08:09

Rolf of Saxony