problem with vlc python api with vlc 3.0

This forum is about all development around libVLC.
tbaud44
New Cone
New Cone
Posts: 3
Joined: 25 Feb 2018 15:22

problem with vlc python api with vlc 3.0

Postby tbaud44 » 25 Feb 2018 16:24

I use vlc api for python.

i used a function for loading a movie file after i wait 1 second and after i read object python to know the duration of file (method GetDurationVideo).
I add that there is no widget to see the movie because i just want to know the duration of file.

My code looks like this:
import vlc


# import standard libraries
class Player():
"""The main window has to deal with events.
"""
def __init__(self):
# VLC player controls
self.Instance = vlc.Instance("--vout", "dummy", "--no-audio" )
self.player = self.Instance.media_player_new()

def _OnOpen(self, mrl):
"""Pop up a new dialow window to choose a file, then play the selected file.
"""
if os.path.isfile(mrl):
#print (mrl)
# Creation
self.Media = self.Instance.media_new(mrl)
# self.Media = self.Instance.media_new(str(os.path.join(dirname, filename)))
self.player.set_media(self.Media)

""" retourne la duree en seconde de la video """
def _GetDurationCurrentPlaying(self):
return self.player.get_length() / 1000

'''method i used in my application'''
def GetDurationVideo(self, nomVideo, repertoire):
self._OnOpen(str(os.path.join(repertoire, nomVideo)))

self._OnPlay()
time.sleep(1) #on attend une seconde pour que vlc charge entete
duration = self._GetDurationCurrentPlaying()
self._OnStop() #instruction qui plante depuis 20/02/2018
return duration

def _OnStop(self):
"""Stop the player.
"""
self.player.stop()

the code crash when python execute :
self.player.stop()

when pyhon execte self.player.stop(), it call this method above.
here is api function which always crash in python 3.0.

def libvlc_media_player_stop(p_mi):
'''Stop (no effect if there is no media).
@param p_mi: the Media Player.
'''
f = _Cfunctions.get('libvlc_media_player_stop', None) or \
_Cfunction('libvlc_media_player_stop', ((1,),), None,
None, MediaPlayer)
return f(p_mi) --> CRASH

i have no problem with vlc 2.2.6
Do you have an idea ?
it is windows 10 update that have installed vlc 3.0 in my computer so one solution is to reinstall vlc 2.2.6 instead of vlc 3.0.0.
But i would like to use vlc 3.0.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: problem with vlc python api with vlc 3.0

Postby Jean-Baptiste Kempf » 26 Feb 2018 15:44

Can you share a backtrace?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

tbaud44
New Cone
New Cone
Posts: 3
Joined: 25 Feb 2018 15:22

Re: problem with vlc python api with vlc 3.0

Postby tbaud44 » 26 Feb 2018 22:18

sorry but python don't show any backtrace.
python crash when try to execute : return f(p_mi)


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 24 guests