2014-12-06, 11:41 PM
For reference, I'm tring to implement a simple alarmclock/sleep mode plugin; it seemed an easy starting point.
Starting up LiveTV is simple enough:
PluginHelperFactory.GetPluginHelper().PlayLiveTV( /* optional channel */ )
Even getting the channel is reasonably easy, starting from Channel.LoadAll() and iterating till I find the one I want.
But how do I make it _stop_ correctly?
I've found two big pitfalls so far:
PluginHelperFactory.GetPluginHelper().GetPlaybackProxy().Stop()
a) Doesn't appear to actually exit the live TV mode. The OSD is still shown, and keyboard input resopnds as though in live mode (showing channel list etc.)
Even adding PluginHelperFactory.GetPluginHelper().ActivateScreen(this) didn't help.
b) And what if something else has already manually exited live mode? I can easily enough check if GetPlaybackProxy() is returning null - but I'd actually quite like to pick back up and have my plugin start doing stuff again.
I thought maybe I'd get an Activate() call, but I omly get that when you go in via the menu. I suspect the secret is going to be needing to register some form of callback?
So yeah, how do I do this?
(While I'm at it, there's some nastiness with PlayLiveTV() crashing if the screensaver is currently running. I addd BlockScreenSaver() and that seems to fix it.)
Starting up LiveTV is simple enough:
PluginHelperFactory.GetPluginHelper().PlayLiveTV( /* optional channel */ )
Even getting the channel is reasonably easy, starting from Channel.LoadAll() and iterating till I find the one I want.
But how do I make it _stop_ correctly?
I've found two big pitfalls so far:
PluginHelperFactory.GetPluginHelper().GetPlaybackProxy().Stop()
a) Doesn't appear to actually exit the live TV mode. The OSD is still shown, and keyboard input resopnds as though in live mode (showing channel list etc.)
Even adding PluginHelperFactory.GetPluginHelper().ActivateScreen(this) didn't help.
b) And what if something else has already manually exited live mode? I can easily enough check if GetPlaybackProxy() is returning null - but I'd actually quite like to pick back up and have my plugin start doing stuff again.
I thought maybe I'd get an Activate() call, but I omly get that when you go in via the menu. I suspect the secret is going to be needing to register some form of callback?
So yeah, how do I do this?
(While I'm at it, there's some nastiness with PlayLiveTV() crashing if the screensaver is currently running. I addd BlockScreenSaver() and that seems to fix it.)