Skip to content

Commit

Permalink
use PlayMedia for playing back BGM
Browse files Browse the repository at this point in the history
  • Loading branch information
pannal committed Aug 29, 2018
1 parent adfdc80 commit 8b8d9dc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,8 @@ def close(self):


class BGMPlayerTask(backgroundthread.Task):
def setup(self, player, *args, **kwargs):
self.args = args
self.kwargs = kwargs
self.player = player
def setup(self, source, *args, **kwargs):
self.source = source
return self

def cancel(self):
Expand All @@ -678,8 +676,7 @@ def run(self):
if self.isCanceled():
return

xbmc.Player.play(self.player, *self.args, **self.kwargs)
self.player = None
xbmc.executebuiltin("XBMC.PlayMedia(%s)" % self.source)


class PlexPlayer(xbmc.Player, signalsmixin.SignalsMixin):
Expand Down Expand Up @@ -795,7 +792,7 @@ def playBackgroundMusic(self, source, volume, rating_key, *args, **kwargs):

self.handler.setVolume(volume)

self.BGMTask = BGMPlayerTask().setup(self, source, *args, **kwargs)
self.BGMTask = BGMPlayerTask().setup(source, *args, **kwargs)
backgroundthread.BGThreader.addTask(self.BGMTask)

def playVideo(self, video, resume=False, force_update=False, session_id=None, handler=None):
Expand Down

0 comments on commit 8b8d9dc

Please sign in to comment.