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

FIX: Don't try and set the volume of the omxplayer when the instance may not be ready yet

parent 144700b6
Pipeline #81 passed with stages
in 5 minutes and 22 seconds
import enum
import threading
import urllib.parse
from platypush.context import get_bus
......@@ -41,6 +42,7 @@ class MediaOmxplayerPlugin(MediaPlugin):
self.args = args
self._player = None
self._handlers = {e.value: [] for e in PlayerEvent}
self._play_started = threading.Event()
def play(self, resource=None, subtitles=None, *args, **kwargs):
......@@ -63,6 +65,8 @@ class MediaOmxplayerPlugin(MediaPlugin):
return self.status()
self._post_event(MediaPlayRequestEvent, resource=resource)
......@@ -89,12 +93,8 @@ class MediaOmxplayerPlugin(MediaPlugin):
'be able to control the media')
if self.volume:
self._post_event(MediaPlayEvent, resource=resource)
return self.status()
......@@ -359,6 +359,10 @@ class MediaOmxplayerPlugin(MediaPlugin):
def on_play(self):
def _f(player):
if self.volume and not self._play_started.is_set():
resource = player.get_source()
self._post_event(MediaPlayEvent, resource=resource)
for callback in self._handlers[PlayerEvent.PLAY.value]:
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