diff options
Diffstat (limited to 'player_vlc.py')
-rw-r--r-- | player_vlc.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/player_vlc.py b/player_vlc.py index c0eadf9..9f8bb56 100644 --- a/player_vlc.py +++ b/player_vlc.py @@ -38,3 +38,14 @@ class Player: def setCurrentSong(self, path): media = vlc.Media(path) self._player.set_media(media) + + def setPlayingStateChangedCallback(self, callback): + events = [ + vlc.EventType.MediaPlayerStopped, + vlc.EventType.MediaPlayerPlaying, + vlc.EventType.MediaPlayerPaused + ] + manager = self._player.event_manager() + for e in events: + manager.event_attach(e, callback) + self._playingStateChangedCallback = callback |