TiVO HTML App Development

Discussion in 'Developers Corner' started by greeneca, May 9, 2017.

  1. greeneca

    greeneca New Member

    May 9, 2017
    I am looking to develop an app for TiVo using HTML but don't really know where to start or if this is actually possible. I have an account at developer.tivo.com but I can't find any documentation there except for the TiVo Control API and I don't think that is what I am looking for. Looking around I have seen people mention the Opera Devices SDK in reference to TiVO. I also have seen the HME SDK but that seems to be an old system and doesn't seem to have an HTML API.

    If someone could point me towards some documentation or just tell me what I'm trying can't be done that would be great.
  2. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    Apr 17, 2000
    TiVo uses the Opera TV store. They have an emulator that you can use to develop on, and I believe that if you apply for a license there is some way to test the app directly on the TiVo. There is one member here that went through the process of getting an app published and from what he posted it's kind of tedious.

    HME is the old API. It was originally developed in Java but was ported to C# and python. However it's be sort of gutted on recent TiVos, indicating that TiVo is likely to drop suppirt for it completely in the near future, so I wouldn't really recommend using it for development.
  3. greeneca

    greeneca New Member

    May 9, 2017
    Thanks. That's a great help.
  4. davidblackledge

    davidblackledge Registered lÜser

    Sep 9, 2008
    FYI, I started looking into HTML app development recently, too. I have other priorities so it's slow going, but I have been trying to learn some key things (that probably already got learned by the other people) and still have a ways to go.
    Main things I've learned so far:
    • It's just HTML 5 with a few particular limitations - if you know how to do that you're way ahead of the game. You could have a set of static pages that do all the work in JavaScript, or you could have a set of server-generated pages based on some data, or a combination using JavaScript technologies like JSON/AJAX.
    • For maximum compatibility with other devices that have access to Opera TV Store, you want to make your app work well enough if somebody only has Directions and Select (D-Pad) and maybe a Back key.
    • You can detect every TiVo remote key press with a little effort with the following exceptions and details:
      • The usual teleport keys you can't detect from HME either (TiVo, Live TV, Guide).
      • TV interaction keys you can detect in HME, but not Opera TV (Volume up/dn, Mute, Input). But TV Power in Opera TV is code 15, for some reason.
      • Advance/Skip, Thumbs Up, and Thumbs Down don't get sent at all in Opera TV. This is pretty maddening since those are distinguishing features of a TiVo.
      • Replay and Back (on remotes that have Back) indistinguishably send the same "BACK_SPACE" virtual key. Opera TV requires that repeated pressing of this key must eventually exit the App (so it goes back through all your screens and exits the app on the last one). I have a note that I thought I saw an app distinguish between Replay and Back, though, so maybe I'm missing something (perhaps it was a case of Replay vs. Zoom - see below).
      • Enter/Last indistinguishably sends the same virtual key as Select: "VK_ENTER".
      • Zoom/Window/Aspect (positioned where Back goes on remotes that don't have Back) sends nothing and exits the app immediately. Also frustrating since it doesn't match other features in TiVo. Seems to me they could have claimed "TiVo" worked as that key.
      • Record, for some inexplicable reason, sends a letter "v" key press (code 86).
      • There is no VK for Slow, which sends code 463.
      • Either there is no VK for Clear, or it doesn't get sent as it, but instead sends code 12.
      • I haven't done any testing with keyboards. I presume they'll work fine, but most users don't have them anyhow (except when they're using the TiVo App.. I haven't tested with that, either) - and of course if somebody types "v" you might think they pressed "Record"
      • Everything else sends an appropriate Virtual Key mapping
        • Channel(page) Up/Down send VK_TRACK_NEXT/PREV (which is backwards from how they're used for navigation, but correct in how they're used for channel numbers changes)
        • Action buttons A/B/C/D send VK_<color> that matches the colors on the TiVo, but those colors are usually in a different order on other devices.
        • Typical VK's that exist but aren't sent by TiVo remote: VK_MENU, VK_STOP, and VK_SUBTITLE (I don't think I've tested for these with the network remote commands).
    • You can detect the model of TiVo that connects using the User Agent string which includes something like "TiVo TiVo/83400" which is the first 5 or 6 digits of the TSN - enough to fully identify the model type. There is not a unique ID sent that I can find, so you'll have to do your own handling of that with Cookies like you'd do with any other Web Browser.
    • Opera TV in general has its idiosyncrasies:
      • Default Web page handling is decent, but not good enough for arbitrary pages - black background by default instead of white, no scrollbar indicator, simplistic navigation between links, etc.
      • javascript dialogs (e.g. alert) don't work by design.
      • Although HTML5 Video Tag is pretty functional in Opera, in Opera TV it does not support setting the speed - so you can't do slow or fast forward or rewind normally. Also, setting the video's position (in Opera TV on the TiVo) has a long seek time (we've all seen this in other apps) - instant replay isn't reasonable because it takes more than 8 seconds to go back 8 seconds.
        • As a result the first thing I've spent time on is a video player with a particular interface for doing fast forward/rewind/skip handling.
        • Video size seems to have some oddness under the right circumstances. My test pages work fine, but I pointed it at HTML5 Video and the video there is clipping to the size, not resizing.
        • Full screen has overscan issues like HME does, so that's a challenge as usual.
        • I haven't tested SD or other atypically sized content for aspect ratio handling to see if it's similar to what HME does (HME uses the TV's mode if it's full screen, but forces "FULL" aspect (I think) if it's not full screen).
      • I haven't messed with HTML5 Audio Tag yet, but I don't suspect there will be as many issues.
    • I tried the "LiveTV:" video URL that works in HME, but it didn't work in Opera TV. There may be some other way to access the Live TV stream from HTML5, especially if that's the tech they're using in the upcoming UI.
  5. davidblackledge

    davidblackledge Registered lÜser

    Sep 9, 2008
    Oh, and of course the key is to set your page up on a server for testing, then open the Opera TV app "URL Loader" to try it out.

    If you hook up your Opera TV developer account to your device correctly (I succeeded on one, but the other is not working right) you get an extra Developer category that just contains that app (and I think any apps you submit as in-progress on your Opera TV account), but you can get to the URL Loader app without that.
  6. greeneca

    greeneca New Member

    May 9, 2017

    Thanks for all the information. Should be very helpful.
  7. davidblackledge

    davidblackledge Registered lÜser

    Sep 9, 2008
    Just a clarification thanks to Zatz' TiVo "Vox" post (TiVo Preps “Vox” Offering (with voice remote)) - the remote prototype clearly has relabeled that button as "Exit" which fits how it functions in HTML5 apps and how it functions in the TiVo interface (except when watching video).
  8. davidblackledge

    davidblackledge Registered lÜser

    Sep 9, 2008
    I've got some more detail and some javascript code I'm using. Ends up Mini and Premiere run one version of Opera while Roamio (and I presume Bolt) run another. They have slightly different key code implementations.
    Notably, Thumbs are available after all on the Roamio (and Bolt?), record's value changes on those models, and Info is mapped wrong and requires special handling on those models.

    (The forum blocked me posting the code as is (with some try/catch blocks around the regular expression executions and array access) so I'm posting a simplified version.)
    var OPERA_VERSION = 12;
     OPERA_VERSION = ( /\W(?:OPR|Version)\/(\d+(\.\d+)?)/i ) // exec'd on (navigator.userAgent) and accessing the subscript 1
    var TIVO_VERSION = "A93";
     TIVO_VERSION = ( /Model\/TiVo-TiVo-(?:TCD)?(\S+)/i ) // exec'd on (navigator.userAgent) and accessing the subscript 1 
    // TiVo Remote keys that do not map to a Opera TV VK constant.
    var OPT_TIVO_TV_POWER = 15; // ONLY on mini/premiere; also sends a keypress, but event.key is blank
    var OPT_TIVO_TV_INPUT = 5; // not on mini/premiere
    var TIVO_SLOW = 463; // event.key "MediaPlayPause"
    var TIVO_CLEAR = 12; // event.key "Clear"
    var OPT_TIVO_RECORD_MINI = 86; // aka 'v' // also sends a keypress, but event.key is blank
    var OPT_TIVO_RECORD_ROAMIO = 416; // event.key:"MediaRecord" // should be VK_RECORD (not in Opera TV standard)
    var OPT_TIVO_THUMBS_DOWN = 437; // not on mini/premiere; event.key:"ClearFavorite"
    var OPT_TIVO_THUMBS_UP = 429; // not on mini/premiere; event.key:"StoreFavorite"
    var TIVO_INFO = 457; // VK_INFO may not have this value that tivo remote sends. (on the Roamio, have to check this value as well as VK_INFO)
    // desktop chrome does 173,174,175 for mute, voldown, volup, but keypressup only

Share This Page