2016-01-12, 06:01
I'm developing addon for casting from Kodi to Chromecast. Here is a link to its source:
https://github.com/kharts/kastodi
I'd like to have "Cast" button on the Video OSD window, so user can start casting from video player.
I've managed to add button with textures, but I cannot handle onClick() or onControl() events.
Here is my code
Here is a full version https://github.com/kharts/kastodi/blob/m...kastodi.py
The button appears, but when I click on it, nothing happens.
So, my questions is: does Kodi allow to override events of the built-in standard windows? And if yes, how it can be done?
Thanks in advance.
https://github.com/kharts/kastodi
I'd like to have "Cast" button on the Video OSD window, so user can start casting from video player.
I've managed to add button with textures, but I cannot handle onClick() or onControl() events.
Here is my code
PHP Code:
WINDOW_OSD = 12901 # video on screen display window ID
class CustomPlayer(xbmc.Player):
def onPlayBackStarted(self):
self.add_cast_button()
def add_cast_button(self):
player_window = PlayerWindow(WINDOW_OSD)
player_window.add_cast_button()
class PlayerWindow(xbmcgui.Window):
def add_cast_button(self):
if not hasattr(self, "cast_button"):
self.cast_button = xbmcgui.ControlButton(
x=50,
y=50,
width=72,
height=72,
label="",
focusTexture=image("ic_cast_blue_24dp.png"),
noFocusTexture=image("ic_cast_white_24dp.png"))
self.addControl(self.cast_button)
self.cast_button.setVisible(True)
def onClick(self, controlId):
debug("onClick")
info("Click")
if hasattr(self, "cast_button"):
if controlId == self.cast_button.getId():
info("Click on cast_button")
def onControl(self, control):
debug("onControl")
info("Some control is pressed")
if hasattr(self, "cast_button"):
if control == self.cast_button:
info("Cast button is pressed")
player = CustomPlayer()
The button appears, but when I click on it, nothing happens.
So, my questions is: does Kodi allow to override events of the built-in standard windows? And if yes, how it can be done?
Thanks in advance.