Verified Commit 19068769 authored by Fabio Manganiello's avatar Fabio Manganiello
Browse files

FIX: Replaced VLC event.u occurrences

Newer versions of python-vlc have apparently
removed the `event.u` union object from the
events dispatched by the player, resulting in
player callback failures.

The occurrences of `event.u` have therefore
been replaced with the player methods to
correctly retrieve the current state.
parent f9ce0391
Pipeline #83 passed with stages
in 5 minutes and 18 seconds
......@@ -130,18 +130,17 @@ class MediaVlcPlugin(MediaPlugin):
for cbk in self._on_stop_callbacks:
elif event.type == EventType.MediaPlayerTitleChanged:
self._filename = event.u.filename
self._title = event.u.new_title
self._post_event(NewPlayingMediaEvent, resource=event.u.new_title)
elif event.type == EventType.MediaPlayerMediaChanged:
self._filename = event.u.filename
self._title = event.u.new_title
self._post_event(NewPlayingMediaEvent, resource=event.u.filename)
elif (
event.type == EventType.MediaPlayerTitleChanged or
event.type == EventType.MediaPlayerMediaChanged
self._title = self._player.get_title() or self._filename
if event.type == EventType.MediaPlayerMediaChanged:
self._post_event(NewPlayingMediaEvent, resource=self._title)
elif event.type == EventType.MediaPlayerLengthChanged:
self._post_event(NewPlayingMediaEvent, resource=self._get_current_resource())
elif event.type == EventType.MediaPlayerTimeChanged:
pos = float(event.u.new_time/1000)
pos = float(self._player.get_time()/1000)
if self._latest_seek is None or \
abs(pos-self._latest_seek) > 5:
self._post_event(MediaSeekEvent, position=pos)
......@@ -184,6 +183,7 @@ class MediaVlcPlugin(MediaPlugin):
if resource.startswith('file://'):
resource = resource[len('file://'):]
self._filename = resource
if subtitles:
if subtitles.startswith('file://'):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment