how to capture log message by python-vlc module

This forum is about all development around libVLC.
ShanH8630
New Cone
New Cone
Posts: 4
Joined: 10 Sep 2021 09:45

how to capture log message by python-vlc module

Postby ShanH8630 » 14 Sep 2021 10:09

Hi ,

I use python-vlc module to start vlc as mediaplayer. Since vlc is a standalone application, it will output log message on console. Is it possible to capture log message while vlc is playing in progress? Is there any example ?
Is is possible to set callback function to receive log message in case vlc output log on console?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: how to capture log message by python-vlc module

Postby Rémi Denis-Courmont » 14 Sep 2021 14:21

There are callbacks in libVLC for that. Please refer to the API documentation.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ShanH8630
New Cone
New Cone
Posts: 4
Joined: 10 Sep 2021 09:45

Re: how to capture log message by python-vlc module

Postby ShanH8630 » 15 Sep 2021 07:37

Hi ,

I try to use python-vlc to create a player. And I also try to set log callback function. I get error about wrong type.
"argument 2: <class 'TypeError'>: wrong type"
Does anyone have idea?

the python code is :
class Player:
def __init__(self, *args):
def log_handler():
print("here output log")

if args:
print("here 1")
instance = vlc.Instance(*args)
self.media = instance.media_player_new()
else:
print("here 3")

#self.media = vlc.MediaPlayer()
instance = vlc.Instance()
instance.log_set(log_handler, None)
self.media = instance.media_player_new()



the error is :
here 3
Traceback (most recent call last):
File "G:\VideoLan_Py\vlc-py-test.py", line 132, in <module>
player = Player()
File "G:\VideoLan_Py\vlc-py-test.py", line 27, in __init__
instance.log_set(log_handler, None)
File "G:\Python_win\lib\site-packages\vlc.py", line 2049, in log_set
return libvlc_log_set(self, cb, data)
File "G:\Python_win\lib\site-packages\vlc.py", line 5171, in libvlc_log_set
return f(p_instance, cb, data)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

ShanH8630
New Cone
New Cone
Posts: 4
Joined: 10 Sep 2021 09:45

Re: how to capture log message by python-vlc module

Postby ShanH8630 » 15 Sep 2021 07:38

There are callbacks in libVLC for that. Please refer to the API documentation.
Hi ,

I try to use python-vlc to create a player. And I also try to set log callback function. I get error about wrong type.
"argument 2: <class 'TypeError'>: wrong type"
Does anyone have idea?

the python code is :
class Player:
def __init__(self, *args):
def log_handler():
print("here output log")

if args:
print("here 1")
instance = vlc.Instance(*args)
self.media = instance.media_player_new()
else:
print("here 3")

#self.media = vlc.MediaPlayer()
instance = vlc.Instance()
instance.log_set(log_handler, None)
self.media = instance.media_player_new()



the error is :
here 3
Traceback (most recent call last):
File "G:\VideoLan_Py\vlc-py-test.py", line 132, in <module>
player = Player()
File "G:\VideoLan_Py\vlc-py-test.py", line 27, in __init__
instance.log_set(log_handler, None)
File "G:\Python_win\lib\site-packages\vlc.py", line 2049, in log_set
return libvlc_log_set(self, cb, data)
File "G:\Python_win\lib\site-packages\vlc.py", line 5171, in libvlc_log_set
return f(p_instance, cb, data)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: how to capture log message by python-vlc module

Postby Rémi Denis-Courmont » 15 Sep 2021 10:56

Please refer to the relevant documentation for your bindings. With all due respect, your question has nothing to do with using VLC media player on Linux.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 15 guests