Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions plugin_playback_guiplayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ def __init__(self, config, bus=None, name='guiplayer'):
self.name = name
self._is_playing = False
self._paused = False
self.supports_mime_hints = True
self.tracks = []
self.index = 0
self.track_lock = Lock()
self.track_meta_from_player = None
self.track_meta_from_cps = None
self.web_skillid = None
self.web_player = False

self.bus.on('GuiPlayerServicePlay', self._play)
self.bus.on(
Expand Down Expand Up @@ -64,9 +67,26 @@ def _get_track(self, track_data):
track = track_data[0]
mime = track_data[1]
mime = mime.split('/')
try:
if track_data[2]:
self.web_skillid = track_data[2]
else:
self.web_skillid = None

if "web" in mime[0] and "url" in mime[1]:
self.web_player = True
else:
self.web_player = False

except:
self.web_skillid = None
self.web_player = False

else: # Assume string
track = track_data
mime = self.find_mime(track)
self.web_player = False

return track, mime

def _play(self, message):
Expand All @@ -86,6 +106,10 @@ def _play(self, message):
if 'video' in mime[0]:
LOG.debug("Sending Video Type")
self.bus.emit(Message("playback.display.video.type"))
elif self.web_player:
LOG.debug("Sending Web Video Type")
self.bus.emit(Message("playback.display.web.video.type",
{"url": track, "skill_id": self.web_skillid}))
else:
LOG.debug("Sending Audio Type")
self.bus.emit(Message("playback.display.audio.type"))
Expand All @@ -100,12 +124,19 @@ def _play(self, message):
self.bus.emit(Message("playback.display.audio.type"))

time.sleep(0.5)
self.bus.emit(
Message(
"gui.player.media.service.play", {
"track": track, "mime": mime, "repeat": repeat}))
LOG.debug('Player Emitted gui.player.media.service.play')
self.send_meta_to_player()
if self.web_player:
self.bus.emit(Message("gui.web.media.service.play",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handler for this doesn't exist yet, is that right?
I haven't been able to find where what would actually play the media

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still an issue at all? Or can this be merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webpage itself plays the media.. any media loaded by a webpage in a browser.. will be handled by the browser in this case (QtWebEngine/Chromium)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that is being passed here is the URL of the page to load and display in the browser

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah right, but where is the handler for playback.display.web.video.type to load the url provided?

I couldn't see it in mycroft-gui or this plugin or the playback-control-skill - so it just seems like we're missing a piece of the puzzle?

{"url": track, "mime": mime, "repeat": repeat}))
LOG.debug('Player Emitted gui.web.media.service.play')

else:
self.bus.emit(
Message(
"gui.player.media.service.play", {
"track": track, "mime": mime, "repeat": repeat}))

LOG.debug('Player Emitted gui.player.media.service.play')
self.send_meta_to_player()

def play(self, repeat=False):
""" Play media playback. """
Expand Down