2021-09-30, 00:16
Hi,
I have two buttons of Play and Pause, one above the other (The same x,y,w,h), kind of a toggle button.
The button visibilty is actually changed:
* When the Play icon is shown: When pressing on it, the Player start playing and the icon is changed to Pauses.
But when the Pause icon is shown: When pressing on it, the Player start playing again instead of pausing,
The onLoad function getting the control as the Play button id and not the Pause one, and the icon is of course stay on the Play icon.
What am I missing here?
Thanks.
I have two buttons of Play and Pause, one above the other (The same x,y,w,h), kind of a toggle button.
The button visibilty is actually changed:
* When the Play icon is shown: When pressing on it, the Player start playing and the icon is changed to Pauses.
But when the Pause icon is shown: When pressing on it, the Player start playing again instead of pausing,
The onLoad function getting the control as the Play button id and not the Pause one, and the icon is of course stay on the Play icon.
What am I missing here?
Thanks.
Code:
self.play = xbmcgui.ControlButton(...)
self.pause = xbmcgui.ControlButton(...)
self.addControls([..., ... , self.prev, self.next])
# set visibility:
self.play.setVisibleCondition('[!Player.Playing]', True)
self.pause.setVisibleCondition('[Player.Playing]', True)
def onControl(self, control):
_controlID = control.getId()
if _controlID == self.pause.getId():
Player().pause()
elif _controlID == self.play.getId():
Player().play(strm)