NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 9 10 11 12 13 … 93 Next »
Random API questions

 
  • 0 Vote(s) - 0 Average
Random API questions
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#1
2012-08-08, 04:26 AM

  1. What's the difference between SettingsHelper.SetSetting() and SettingsHelper.SetOverride()?
  2. Is there a way to monitor and intercept/override keypresses? I would like to intercept keys while playing video and override the default behaviour but implimenting IScreenPlugin will only fire OnKeyDown() if the plugin is active and OnKeyPress() never seems to be fired when implementing IKeyPress.
  3. If I want to display my own subtitles on videos (non .ts files), can I just call Native.UpdateCCBitmap() or do I need to implement ICCSubtitleData. If the latter, how would I do that? I see SetSubtitleStream() but not a SetSubtitlePlugin()

I do realize that the answer for 2 and 3 is probably "It wasn't meant to do this". Big Grin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2012-08-08, 04:39 AM
Quote:1.What's the difference between SettingsHelper.SetSetting() and SettingsHelper.SetOverride()?
It not intended that developers use SetOverride(). It was only added as a workaround for a complicated circular problem I created for myself.

Quote:2.Is there a way to monitor and intercept/override keypresses? I would like to intercept keys while playing video and override the default behaviour but implimenting IScreenPlugin will only fire OnKeyDown() if the plugin is active and OnKeyPress() never seems to be fired when implementing IKeyPress.
If your plugin is listening for event bus notifications, it'll get the PLAYBACK_KEYDOWN event, where "args" is a KeyEventArgs object.

Quote:3.If I want to display my own subtitles on videos (non .ts files), can I just call Native.UpdateCCBitmap() or do I need to implement ICCSubtitleData. If the latter, how would I do that? I see SetSubtitleStream() but not a SetSubtitlePlugin()
You'd maybe call PluginHelperFactory.GetInstance().GetPlaybackProxy().SetOSD() passing in a renderlist of UiElement objects. In your case that renderlist would be one object, containing your bitmap.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#3
2012-08-08, 05:05 AM
sub Wrote:It not intended that developers use SetOverride(). It was only added as a workaround for a complicated circular problem I created for myself.
That makes my choice easy then. I want to set <MenuItem> enabled to false when saving settings to make sure that "background" plugins don't ever appear in the menu and SetOverride() made me stop and think.

sub Wrote:If your plugin is listening for event bus notifications, it'll get the PLAYBACK_KEYDOWN event, where "args" is a KeyEventArgs object.
Doh, I missed that event somehow.

sub Wrote:You'd maybe call PluginHelperFactory.GetInstance().GetPlaybackProxy().SetOSD() passing in a renderlist of UiElement objects. In your case that renderlist would be one object, containing your bitmap.
One of these days I will have to learn how to not make things so complicated.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#4
2012-08-08, 06:35 AM
sub Wrote:If your plugin is listening for event bus notifications, it'll get the PLAYBACK_KEYDOWN event, where "args" is a KeyEventArgs object.

That worked to capture the the event but I can't override the default handling. Even if I activate my own popup, the defaults kill it and activate.

Next time you're in that part of the code, would it be possible to get a Notify("ACTIVATE_POPUP", "SelectAudio") and Notify("ACTIVATE_POPUP", "SelectSubtitles") for videos and dvds? (I'm filtering filetypes if it is fired for all playback or none type of deal)

I can then override it with my own popup.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#5
2012-08-08, 06:46 AM
I should be able to do something like that. I'm a bit busy today though.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#6
2012-08-08, 06:53 AM
There's no rush on it. I'm off to bed and not sure if I will get back to it tomorrow or not. I just figure there is not much point to assigning yet another key for existing functions just for BD playback.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#7
2012-08-09, 01:43 AM (This post was last modified: 2012-08-09, 01:51 AM by whurlston.)
sub, I set a delay so that my popup will render after the default popup and it serves my purpose. One thing I noticed though is that once the default audio/subtitle selection is activated, PluginHelperFactory.GetPluginHelper().GetActivePopup() still returns null. So even though I render my popup, once my popup is cleared, the default popup reappears on screen.

I hope I'm making some sense.

Edit: Here's my code:
Code:
public void Notify(string eventName, object eventArg)
        {
            if (eventName == "PLAYBACK_KEYDOWN")
            {
                string s = new KeyCommandHelper(SettingsHelper.GetInstance().GetDataDirectory() + "KeyMappings.xml").GetCommand("VideoPlayback", (KeyEventArgs)eventArg);
                if (s == "SelectAudio" || s == "SelectSubtitles")
                {
                    delay = new System.Timers.Timer(1000);
                    delay.AutoReset = false;
                    delay.Elapsed += new System.Timers.ElapsedEventHandler(delay_Elapsed);
                    delay.Start();
                }
        }

        void delay_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            IScreenPlugin currentPopup = PluginHelperFactory.GetPluginHelper().GetActivePopup();
            if (currentPopup != null)
              PluginHelperFactory.GetPluginHelper().ActivatePopup(null);                         // This never gets fired because GetActivePopup always returns null even though there is a popup on screen.
            PluginHelperFactory.GetPluginHelper().ActivatePopup(new StreamPopup());
        }
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#8
2012-08-09, 02:21 PM
End result (with a few niggles):

And yes... the selections do actually work. Big Grin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Couple of questions about hacking npvr.db3 drmargarit 6 4,208 2014-09-08, 02:22 AM
Last Post: sub
  Questions about Scraping from thetvdb and themoviedb craigrs84 0 2,492 2014-08-19, 05:30 PM
Last Post: craigrs84
  NPVR database questions mvallevand 25 9,776 2011-01-06, 12:58 AM
Last Post: jksmurf
  Positioning of elements in skins (...and some other questions) ShiningDragon 13 4,254 2010-07-22, 06:42 PM
Last Post: ShiningDragon
  Plugin Questions systemshark 2 1,697 2009-02-28, 08:01 AM
Last Post: systemshark
  Plugins and interface questions from a C# rookie mvallevand 11 4,054 2008-08-26, 03:20 PM
Last Post: McBainUK
  IRecordingSource Questions blackpaw 6 2,451 2008-04-01, 04:50 AM
Last Post: sub
  XMLTV Questions -Oz- 34 10,280 2008-03-24, 01:19 AM
Last Post: zehd
  I-xmltv for SchedulesDirect questions FlatEarth 0 1,107 2007-09-17, 04:44 PM
Last Post: FlatEarth
  Questions about getPreviewGraph() whurlston 3 1,717 2006-12-28, 05:36 AM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode