stremiok 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
3
3
  What changed in each version of StremioK, newest first. How everything works is in the
4
4
  [user guide](docs/USER-GUIDE.md).
5
5
 
6
+ ## 2.2.3 — 2026-10-30
7
+ - **Xtream films and series:** an account's films and series in the Movies and Series tabs (a show
8
+ is one tile, its episodes on its page), Discover by its categories, and Search. The IPTV tab
9
+ keeps its live channels. Home says *Loading…* while a long list is read; *Reload* on the account
10
+ reads them again.
11
+ - **Its copies on your titles:** a film or episode from your addons lists the account's copy among
12
+ its sources (*Xtream*), matched by TMDB id, or by name and year.
13
+ - **Stalker portals, experimental** (Settings › Content › IPTV › *Add Stalker portal*): its address and MAC
14
+ address; its channels are a playlist, a row per genre.
15
+ - **★ Favorites** shows all your favorites, not the last 30 picked.
16
+ - **Titles in a Home row** (Settings › Appearance): 30, 50, 100 or 200; a catalog that comes a page
17
+ at a time is asked for more pages to fill the row.
18
+ - **Films in a playlist** (a link to a file) play as films you can scrub through, not as live TV.
19
+ - **Subtitles** within a language come in your addon order, each addon's best match first (they
20
+ were shuffled on older TVs).
21
+ - **Smoother on older TVs:** D-pad moves reach the screen a quarter or more sooner on the 2017 TV;
22
+ long rows build as you reach them, and pictures off screen load while you aren't pressing keys.
23
+ - **Progress** is saved once a minute while playing, and at once when you stop or leave.
24
+
25
+ ## 2.2.2 — 2026-10-28
26
+ - **Torrents through a streaming server** (Settings › Content › Streaming server): with Stremio's
27
+ streaming server or a TorrServer running on your network (a computer or a NAS), torrent-only
28
+ sources play like any other. *Test* says whether it answers; torrents get longer to start (2
29
+ minutes by default).
30
+ - **Seeders** in Source ranking: torrent sources with more people sharing them first.
31
+ - **Zoom** (Settings › Appearance): 100% to 140%, everything bigger to read from further away;
32
+ subtitles keep their own size.
33
+ - **Leaving StremioK:** BACK on Home's top menu asks *Exit StremioK?* (OK exits), instead of
34
+ pressing BACK twice (#3).
35
+ - **The top menu scrolls** when its items don't all fit, the StremioK name staying at the right.
36
+ - **IPTV Auto-refresh** (Settings › Content › IPTV, *Off* by default): every 1, 3, 6 or 12 hours,
37
+ your playlists and their TV guides are read again; never while something plays.
38
+ - **Quicker switching:** subtitles (a track still coming isn't started over, the last 8 files
39
+ come back at once) and channels (what StremioK checks on each one stops when you move on).
40
+ - **Diagnostics says what went wrong** (*Timed out after 20 s*, *No answer…*) instead of
41
+ "HTTP 0"; slow subtitle servers get longer: 20 seconds for a file, 15 for an addon's list.
42
+ - **USB downloads:** a drive prepared with links can no longer make StremioK read or overwrite a
43
+ file outside it.
44
+ - **Fixed:** your IPTV rows (and the Radio tab) missing from Home at start-up until a Reload; a
45
+ next episode or a hold menu whose details came late opening after you'd left.
46
+
6
47
  ## 2.2.1 — 2026-10-24
7
48
  - **Every language OpenSubtitles uses** (94, Indonesian among them, #1) for subtitles and audio:
8
49
  to pick as your default, second choice or second subtitle, listed by name, and each track
package/README.md CHANGED
@@ -31,12 +31,14 @@ video through Samsung's AVPlay API.
31
31
  - **The player:** resume where you stopped, skip intros, recaps and credits, next episode,
32
32
  subtitles (addons', the file's own, and your own files on a USB drive) with your choice of look, audio
33
33
  tracks remembered, switching source mid-playback, private viewing.
34
- - **IPTV and radio** from your M3U playlists and Xtream accounts, with CH+ / CH−.
34
+ - **IPTV and radio** from your M3U playlists, Xtream accounts (with their films and series) and
35
+ Stalker portals, with CH+ / CH−.
35
36
  - **YouTube:** live channels, trailers, and your own YouTube channels, playlists and searches,
36
37
  with SponsorBlock, DeArrow, chapters and captions.
37
38
  - **Local:** the videos on a USB drive, matched to their titles.
39
+ - **Torrents**, through Stremio's streaming server or a TorrServer you run on your network.
38
40
  - **Made for the remote:** D-pad navigation throughout; hold OK where an item has more to
39
- offer (*Hold OK for more* says so).
41
+ offer (*Hold OK for more* says so); zoom up to 140% for reading from further away.
40
42
 
41
43
  ## Install
42
44
 
@@ -52,12 +54,13 @@ Three ways, all covered step by step in the **[installation guide](docs/INSTALL.
52
54
 
53
55
  1. **Addons:** add the addons you use, by link, or bring them in from your Stremio account,
54
56
  AIOManager or a configuration file. A stream addon that gives HTTP(S) links (for example
55
- through a debrid service) is what makes titles playable.
57
+ through a debrid service), or a torrent addon with a streaming server you run, is what makes
58
+ titles playable.
56
59
  2. **API keys**, optional: your own TMDB, OMDb and MDBList keys add ratings, *Cast & more*,
57
60
  *where to watch* and episode trailers.
58
61
  3. **Trakt**, optional: connect your account to share watched marks and Continue Watching.
59
- 4. **IPTV**, optional: your M3U playlist links, or an Xtream account (its server, username and
60
- password).
62
+ 4. **IPTV**, optional: your M3U playlist links, an Xtream account (its server, username and
63
+ password) or a Stalker portal (its address and MAC address).
61
64
  5. **A USB drive**, optional: plug it in and the Local tab appears.
62
65
 
63
66
  [Getting started](docs/USER-GUIDE.md#getting-started) in the user guide walks through each.
@@ -67,16 +70,16 @@ Three ways, all covered step by step in the **[installation guide](docs/INSTALL.
67
70
  This app hosts **no** media. It is a client for the open Stremio addon protocol: catalogs and
68
71
  metadata come from the addons you install (**Cinemeta**, the official one, by default), and
69
72
  playable sources come from whatever **stream addons you add yourself** in Settings. Streams
70
- that only expose a torrent `infoHash` (no HTTP URL) are listed but not playable: AVPlay needs
71
- a direct HTTP(S)/HLS/DASH URL, and this app embeds no torrent or debrid engine.
73
+ that only expose a torrent `infoHash` play only through a streaming server you run (Stremio's
74
+ or TorrServer): this app embeds no torrent or debrid engine.
72
75
  > **Note on WatchHub:** StremioK doesn't install it. Its answers say it's only for clients
73
76
  > Stremio authorizes in writing, and StremioK isn't one; "where to watch" comes from TMDB
74
77
  > instead (with a TMDB key). You can still add it yourself as a third-party addon (Settings
75
78
  > shows that notice on it); its results are rent/buy/subscription *links to external
76
79
  > services*, not video URLs. Add stream addons that return HTTP/HLS URLs for actual playback.
77
80
 
78
- The **IPTV** feature likewise hosts no content: you supply your own M3U playlist URLs or Xtream
79
- accounts. For YouTube entries, the bundled service finds the video's stream; the video itself
81
+ The **IPTV** feature likewise hosts no content: you supply your own M3U playlist URLs, Xtream
82
+ accounts or Stalker portals. For YouTube entries, the bundled service finds the video's stream; the video itself
80
83
  comes straight from YouTube. No video or audio is kept: everything plays straight from its
81
84
  source, unless you download it to your own USB drive. What StremioK does keep, on the TV, is
82
85
  your progress, settings and copies that let it start faster (see
@@ -85,9 +88,9 @@ your progress, settings and copies that let it start faster (see
85
88
  ## Known limitations
86
89
 
87
90
  - AVPlay behavior varies by TV generation, codec and HLS provider.
88
- - No torrent playback: sources need a direct HTTP(S)/HLS/DASH URL (e.g. through a debrid
89
- addon).
90
- - Home rows show a catalog's first page (up to 30 titles); Discover pages through the rest.
91
+ - Torrents play only through a streaming server you run on your network.
92
+ - Home rows show up to 200 titles of a catalog (30 unless you change it; ★ Favorites shows all
93
+ yours); Discover pages through the rest.
91
94
  - No StremioK account and no profiles: settings, addons and progress stay on the TV. The
92
95
  only sync is optional: Trakt (watched marks, Continue Watching, ratings).
93
96
  - Subtitles use an HTML overlay; gzipped (`.gz`) subtitle files aren't decoded.
package/config.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
3
- id="http://stremiok.tizen/StremioKTizen" version="2.2.1" viewmodes="maximized">
3
+ id="http://stremiok.tizen/StremioKTizen" version="2.2.3" viewmodes="maximized">
4
4
  <tizen:application id="StremioK01.StremioK" package="StremioK01" required_version="3.0"/>
5
5
  <content src="index.html"/>
6
6
  <feature name="http://tizen.org/feature/screen.size.all"/>
package/css/style.css CHANGED
@@ -19,20 +19,20 @@ html, body {
19
19
  #av-player, #html5-player {
20
20
  position: absolute;
21
21
  top: 0; left: 0;
22
- width: 1920px; height: 1080px;
22
+ width: 100%; height: 100%; /* (the page: 1920×1080, or less under a zoom, scaled up) */
23
23
  background: #000;
24
24
  display: none;
25
25
  z-index: 1;
26
26
  }
27
27
  #av-player.active, #html5-player.active { display: block; }
28
28
 
29
- #app { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; z-index: 10; }
30
- .screen { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; }
29
+ #app { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; }
30
+ .screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
31
31
  .hidden { display: none !important; }
32
32
 
33
33
  /* --- Header --- */
34
34
  .header { height: 96px; padding: 30px 60px 0 60px; display: flex; align-items: center; }
35
- .brand { font-size: 40px; font-weight: bold; color: #818cf8; letter-spacing: 1px; }
35
+ .brand { font-size: 40px; font-weight: bold; color: #818cf8; letter-spacing: 1px; flex-shrink: 0; }
36
36
  .brand .dot { color: #e6e9ef; }
37
37
  /* private viewing on: StremioK as an outline (the fill hidden; the outline takes each letter's
38
38
  own color, so it follows the accent color and a light background) */
@@ -48,7 +48,9 @@ html, body {
48
48
  .row { margin: 0 0 16px 0; }
49
49
  .row-title { font-size: 26px; font-weight: bold; margin: 0 0 8px 60px; color: #c7cbd4; }
50
50
  /* vertical padding leaves room for the scaled focus ring (overflow clips the rest) */
51
- .row-scroller { white-space: nowrap; padding: 26px 60px; overflow: hidden; }
51
+ /* Its own GPU layer: on the 2017 TV a D-pad move reached the screen a quarter or more sooner
52
+ (65 -> 47 ms sideways, 96 -> 72 ms up / down, measured); a layer per card was no better overall. */
53
+ .row-scroller { white-space: nowrap; padding: 26px 60px; overflow: hidden; -webkit-transform: translateZ(0); transform: translateZ(0); }
52
54
 
53
55
  /* --- Cards --- */
54
56
  .card {
@@ -94,7 +96,7 @@ html, body {
94
96
  .detail-hero .shade { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, rgba(14,17,23,0.96) 30%, rgba(14,17,23,0.35) 100%), linear-gradient(0deg, #0e1117 4%, transparent 40%); }
95
97
  /* The source and episode lists: the backdrop over the whole screen, shaded lighter, the rows
96
98
  see-through (a focused one stays solid) */
97
- .detail-hero.hero-full { height: 1080px; }
99
+ .detail-hero.hero-full { height: 100%; }
98
100
  .detail-hero.hero-full .shade { background: linear-gradient(90deg, rgba(14,17,23,0.9) 22%, rgba(14,17,23,0.4) 100%), linear-gradient(0deg, rgba(14,17,23,0.5) 0%, transparent 45%); }
99
101
  .streams-panel .stream, .list-panel .ep { background: rgba(22,27,38,0.7); }
100
102
  .streams-panel .stream-group, .streams-panel .stream-for, .streams-panel .streams-hidden { text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,0.6); }
@@ -319,7 +321,7 @@ html, body {
319
321
  .card.landscape { width: 340px; height: 200px; }
320
322
 
321
323
  /* --- Confirm modal --- */
322
- .modal-overlay { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; z-index: 45; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; }
324
+ .modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 45; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; }
323
325
  .modal-box { width: 820px; background: #161b26; border: 2px solid #2a3346; border-radius: 16px; padding: 44px 48px; text-align: center; }
324
326
  .modal-msg { font-size: 30px; line-height: 1.4; color: #e6e9ef; margin-bottom: 36px; }
325
327
  .modal-row { display: flex; justify-content: center; }
@@ -365,7 +367,7 @@ html, body {
365
367
  /* --- Toast + spinner --- */
366
368
  #hold-hint { position: absolute; right: 36px; bottom: 20px; z-index: 20; font-size: 17px; color: #c7cbd4; background: rgba(0,0,0,0.6); padding: 6px 14px; border-radius: 16px; pointer-events: none; }
367
369
  #toast { position: absolute; bottom: 60px; left: 50%; margin-left: -300px; width: 600px; text-align: center; z-index: 40; background: rgba(0,0,0,0.85); padding: 18px 24px; border-radius: 10px; font-size: 22px; }
368
- #spinner { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); }
370
+ #spinner { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); }
369
371
  /* status line under the spinner ("Opening stream at 1080p…"); empty when unused */
370
372
  #spinner-msg { margin-top: 26px; font-size: 28px; color: #fff; text-shadow: 0 2px 6px #000; text-align: center; }
371
373
  .spin { width: 70px; height: 70px; border: 7px solid rgba(255,255,255,0.2); border-top-color: #818cf8; border-radius: 50%; -webkit-animation: sp 0.9s linear infinite; animation: sp 0.9s linear infinite; }
@@ -373,7 +375,10 @@ html, body {
373
375
  @keyframes sp { to { transform: rotate(360deg); } }
374
376
 
375
377
  /* Home top row: tab pills + Search + Settings on the left, StremioK logo on the right */
376
- .home-header .tabbar-inline { display: flex; align-items: center; }
378
+ /* the items scroll sideways in their strip when they don't all fit (position: the items' offsets are the strip's) */
379
+ .home-header .menu-scroll { flex: 1 1 auto; min-width: 0; overflow: hidden; position: relative; display: flex; align-items: center; margin-right: 24px; padding: 4px 0; }
380
+ .home-header .tabbar-inline { display: flex; align-items: center; flex-shrink: 0; }
381
+ .home-header .menu-scroll > .hchip { flex-shrink: 0; }
377
382
  .tab-pill { display: inline-flex; align-items: center; font-size: 22px; padding: 8px 9px; margin-right: 5px; border-radius: 28px; background: #1a1f2b; color: #aeb6c4; border: 4px solid transparent; white-space: nowrap; }
378
383
  .tab-ic { margin-left: 6px; font-size: 22px; }
379
384
  .tab-pill.active { background: #2a3346; color: #fff; }
package/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=1920, height=1080, user-scalable=no">
6
6
  <title>StremioK</title>
7
- <link rel="stylesheet" href="css/style.css?v=2.2.1">
7
+ <link rel="stylesheet" href="css/style.css?v=2.2.3">
8
8
  </head>
9
9
  <body>
10
10
  <!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
@@ -53,37 +53,38 @@
53
53
 
54
54
  <!-- Load order matters: polyfills -> util -> iptv -> data -> input -> tvapps -> player parts -> player -> ytplay -> view parts -> views -> app -->
55
55
  <!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
56
- <script src="js/polyfills.js?v=2.2.1"></script>
57
- <script src="js/util.js?v=2.2.1"></script>
58
- <script src="js/iptv.js?v=2.2.1"></script>
59
- <script src="js/epg.js?v=2.2.1"></script>
60
- <script src="js/youtube.js?v=2.2.1"></script>
61
- <script src="js/stremio.js?v=2.2.1"></script>
62
- <script src="js/trakt.js?v=2.2.1"></script>
63
- <script src="js/keys.js?v=2.2.1"></script>
64
- <script src="js/focus.js?v=2.2.1"></script>
65
- <script src="js/tvapps.js?v=2.2.1"></script>
66
- <script src="js/player-core.js?v=2.2.1"></script>
67
- <script src="js/player-store.js?v=2.2.1"></script>
68
- <script src="js/player-lang.js?v=2.2.1"></script>
69
- <script src="js/player-quality.js?v=2.2.1"></script>
70
- <script src="js/player-subs.js?v=2.2.1"></script>
71
- <script src="js/player-audio.js?v=2.2.1"></script>
72
- <script src="js/player-controls.js?v=2.2.1"></script>
73
- <script src="js/player.js?v=2.2.1"></script>
74
- <script src="js/ytplay.js?v=2.2.1"></script>
75
- <script src="js/local.js?v=2.2.1"></script>
76
- <script src="js/downloads.js?v=2.2.1"></script>
77
- <script src="js/stremio-account.js?v=2.2.1"></script>
78
- <script src="js/view-core.js?v=2.2.1"></script>
79
- <script src="js/view-home.js?v=2.2.1"></script>
80
- <script src="js/view-guide.js?v=2.2.1"></script>
81
- <script src="js/view-detail.js?v=2.2.1"></script>
82
- <script src="js/view-search.js?v=2.2.1"></script>
83
- <script src="js/view-settings.js?v=2.2.1"></script>
84
- <script src="js/view-discover.js?v=2.2.1"></script>
85
- <script src="js/views.js?v=2.2.1"></script>
86
- <script src="js/app.js?v=2.2.1"></script>
87
- <script src="js/hubpreview.js?v=2.2.1"></script>
56
+ <script src="js/polyfills.js?v=2.2.3"></script>
57
+ <script src="js/util.js?v=2.2.3"></script>
58
+ <script src="js/iptv.js?v=2.2.3"></script>
59
+ <script src="js/xtvod.js?v=2.2.3"></script>
60
+ <script src="js/epg.js?v=2.2.3"></script>
61
+ <script src="js/youtube.js?v=2.2.3"></script>
62
+ <script src="js/stremio.js?v=2.2.3"></script>
63
+ <script src="js/trakt.js?v=2.2.3"></script>
64
+ <script src="js/keys.js?v=2.2.3"></script>
65
+ <script src="js/focus.js?v=2.2.3"></script>
66
+ <script src="js/tvapps.js?v=2.2.3"></script>
67
+ <script src="js/player-core.js?v=2.2.3"></script>
68
+ <script src="js/player-store.js?v=2.2.3"></script>
69
+ <script src="js/player-lang.js?v=2.2.3"></script>
70
+ <script src="js/player-quality.js?v=2.2.3"></script>
71
+ <script src="js/player-subs.js?v=2.2.3"></script>
72
+ <script src="js/player-audio.js?v=2.2.3"></script>
73
+ <script src="js/player-controls.js?v=2.2.3"></script>
74
+ <script src="js/player.js?v=2.2.3"></script>
75
+ <script src="js/ytplay.js?v=2.2.3"></script>
76
+ <script src="js/local.js?v=2.2.3"></script>
77
+ <script src="js/downloads.js?v=2.2.3"></script>
78
+ <script src="js/stremio-account.js?v=2.2.3"></script>
79
+ <script src="js/view-core.js?v=2.2.3"></script>
80
+ <script src="js/view-home.js?v=2.2.3"></script>
81
+ <script src="js/view-guide.js?v=2.2.3"></script>
82
+ <script src="js/view-detail.js?v=2.2.3"></script>
83
+ <script src="js/view-search.js?v=2.2.3"></script>
84
+ <script src="js/view-settings.js?v=2.2.3"></script>
85
+ <script src="js/view-discover.js?v=2.2.3"></script>
86
+ <script src="js/views.js?v=2.2.3"></script>
87
+ <script src="js/app.js?v=2.2.3"></script>
88
+ <script src="js/hubpreview.js?v=2.2.3"></script>
88
89
  </body>
89
90
  </html>
package/js/app.js CHANGED
@@ -5,7 +5,6 @@ var App = (function () {
5
5
  var _current = 'home';
6
6
  var _stack = []; // frames: { screen, focus }
7
7
  var _lastBackAt = 0; // debounce BACK across keydown + tizenhwkey
8
- var _exitArmedAt = 0; // double-Back-to-exit guard on the home root
9
8
 
10
9
  function screenEl(name) { return U.byId('screen-' + name); }
11
10
 
@@ -121,8 +120,8 @@ var App = (function () {
121
120
  }
122
121
 
123
122
  // On a main page (Home's tabs, Discover, Search, Settings), BACK goes to the top menu first
124
- // (its current item; DOWN comes back), and from there does what it did: the page before,
125
- // or "Press Back again to exit" on Home. Also a way out if focus is ever lost on a page.
123
+ // (its current item; DOWN comes back), and from there to the page before, or (nothing
124
+ // before: Home) asks "Exit StremioK?". Also a way out if focus is ever lost on a page.
126
125
  var MAIN_SCREENS = { home: 1, discover: 1, search: 1, settings: 1 };
127
126
  function toTopMenu() {
128
127
  if (!MAIN_SCREENS[_current]) { return false; }
@@ -145,7 +144,7 @@ var App = (function () {
145
144
  if (_current === 'home' && Views.backInLocal && Views.backInLocal()) { return; } // (the Local tab: up a folder)
146
145
  if (toTopMenu()) { return; }
147
146
  var f = _stack.pop();
148
- if (!f) { tryExitApp(); return; }
147
+ if (!f) { askExit(); return; }
149
148
  if (f.screen !== _current) { abandon(_current); }
150
149
  showScreen(f.screen);
151
150
  if (f.detail) { Views.restoreDetail(f.detail); return; } // the previous title / person page
@@ -158,21 +157,21 @@ var App = (function () {
158
157
  }
159
158
  }
160
159
 
161
- // Require a deliberate double-Back from the home root to exit, so a single stray
162
- // Back (e.g. left over from closing the player) can never close the app by accident.
163
- function tryExitApp() {
164
- var now = Date.now();
165
- if (now - _exitArmedAt < 3000) {
166
- try {
167
- if (window.tizen && tizen.application) {
168
- U.sessionState('exit');
169
- tizen.application.getCurrentApplication().exit();
170
- return;
171
- }
172
- } catch (e) {}
173
- }
174
- _exitArmedAt = now;
175
- U.toast('Press Back again to exit', 3000);
160
+ // Asked, so a stray BACK (one left over from closing the player) never closes the app; focus
161
+ // starts on Exit, so BACK, OK leaves.
162
+ function askExit() { Views.confirm('Exit StremioK?', 'Exit', exitApp, { plain: true, focusYes: true }); }
163
+ // The TV's own exit where StremioK has it (the sideloaded app). A TizenBrew module's page
164
+ // doesn't get it: the window closed instead, and if it's still open, the TV's way said.
165
+ function exitApp() {
166
+ U.sessionState('exit');
167
+ try {
168
+ if (window.tizen && tizen.application) { tizen.application.getCurrentApplication().exit(); return; }
169
+ } catch (e) { U.log('app', 'Exit: the TV\'s exit failed (' + e.message + ')'); }
170
+ try { window.close(); } catch (e2) {}
171
+ setTimeout(function () {
172
+ U.log('app', 'Exit: still open after closing the window (' + (typeof YTPlay !== 'undefined' && YTPlay.installMode ? YTPlay.installMode() : '?') + ')');
173
+ U.toast('Hold BACK to close StremioK', 4000);
174
+ }, 500);
176
175
  }
177
176
 
178
177
  function onKey(action) {
package/js/focus.js CHANGED
@@ -42,7 +42,7 @@ var Focus = (function () {
42
42
  // Scrolls each overflowing box around the node so it's in view, with a margin. A box
43
43
  // marked __noScroll only clips (a page's text block): it never moves.
44
44
  function ensureVisible(node) {
45
- var p = node.parentNode;
45
+ var p = node.parentNode, z = (typeof U !== 'undefined' && U.zoom) ? U.zoom() : 1; // (rects are on screen, zoomed; scrolling isn't)
46
46
  while (p && p.nodeType === 1 && p !== document.body) {
47
47
  var canX = !p.__noScroll && p.scrollWidth > p.clientWidth + 2;
48
48
  var canY = !p.__noScroll && p.scrollHeight > p.clientHeight + 2;
@@ -51,13 +51,13 @@ var Focus = (function () {
51
51
  var nr = node.getBoundingClientRect();
52
52
  if (canX) {
53
53
  var mx = 90;
54
- if (nr.left < pr.left + mx) { p.scrollLeft -= (pr.left + mx - nr.left); }
55
- else if (nr.right > pr.right - mx) { p.scrollLeft += (nr.right - (pr.right - mx)); }
54
+ if (nr.left < pr.left + mx) { p.scrollLeft -= (pr.left + mx - nr.left) / z; }
55
+ else if (nr.right > pr.right - mx) { p.scrollLeft += (nr.right - (pr.right - mx)) / z; }
56
56
  }
57
57
  if (canY) {
58
58
  var my = 70;
59
- if (nr.top < pr.top + my) { p.scrollTop -= (pr.top + my - nr.top); }
60
- else if (nr.bottom > pr.bottom - my) { p.scrollTop += (nr.bottom - (pr.bottom - my)); }
59
+ if (nr.top < pr.top + my) { p.scrollTop -= (pr.top + my - nr.top) / z; }
60
+ else if (nr.bottom > pr.bottom - my) { p.scrollTop += (nr.bottom - (pr.bottom - my)) / z; }
61
61
  }
62
62
  }
63
63
  p = p.parentNode;
@@ -85,12 +85,23 @@ var Focus = (function () {
85
85
  // UP/DOWN in a list of rows (Home, Search, Cast & more): only the next / previous
86
86
  // row's items are candidates, not every card on the screen (thousands on a big IPTV
87
87
  // tab). No row that way: as below (the top menu, …).
88
+ _rowsAsked = false;
88
89
  if ((dir === 'UP' || dir === 'DOWN') && (best = nextRowPick(dir, r))) { setFocus(enterGroup(best)); return; }
90
+ // A card in a sideways row: only its neighbor can be next along the row, and no other
91
+ // row's card is ever on its line. So the next one first, and at the row's end (or going
92
+ // up or down with no row that way) other rows' cards aren't measured at all.
93
+ var inRow = isRowCard(_current);
94
+ if ((dir === 'LEFT' || dir === 'RIGHT') && inRow) {
95
+ var nb = _current[dir === 'RIGHT' ? 'nextElementSibling' : 'previousElementSibling'];
96
+ best = nb ? pick(dir, r, [nb]) : null;
97
+ if (best) { setFocus(enterGroup(best)); return; }
98
+ }
99
+ var skip = (inRow && (dir === 'LEFT' || dir === 'RIGHT' || _rowsAsked)) ? isRowCard : null;
89
100
  // LEFT/RIGHT fast path: in a carousel row the only same-row candidates are the
90
101
  // card's siblings, so skip measuring the whole screen. At a row end (nothing
91
102
  // there) fall back to the full scan, which may reach a non-sibling on the same
92
103
  // line (e.g. last tab pill -> Search).
93
- if ((dir === 'LEFT' || dir === 'RIGHT') && _current.parentNode) {
104
+ if ((dir === 'LEFT' || dir === 'RIGHT') && _current.parentNode && !inRow) {
94
105
  best = pick(dir, r, _current.parentNode.children);
95
106
  }
96
107
  // UP/DOWN: stay inside the scrolling area focus is in (Home rows, a Settings
@@ -100,13 +111,19 @@ var Focus = (function () {
100
111
  // jump to the menu (or skip a row) instead of the row just scrolled out of view.
101
112
  if (dir === 'UP' || dir === 'DOWN') {
102
113
  for (var p = _current.parentNode; !best && p && p !== _scope && p.nodeType === 1; p = p.parentNode) {
103
- if (p.scrollHeight > p.clientHeight + 2) { best = pick(dir, r, p.querySelectorAll('.focusable')); }
114
+ if (p.scrollHeight > p.clientHeight + 2) { best = pick(dir, r, p.querySelectorAll('.focusable'), skip); }
104
115
  }
105
116
  }
106
- if (!best) { best = pick(dir, r, _scope.querySelectorAll('.focusable')); }
117
+ if (!best) { best = pick(dir, r, _scope.querySelectorAll('.focusable'), skip); }
107
118
  if (best) { setFocus(enterGroup(best)); }
108
119
  }
109
120
 
121
+ var _rowsAsked = false; // (this move: every row that way was looked at, by nextRowPick)
122
+ function isRowCard(n) {
123
+ var p = n.parentNode;
124
+ return !!p && (' ' + (p.className || '') + ' ').indexOf(' row-scroller ') !== -1;
125
+ }
126
+
110
127
  function nextRowPick(dir, r) {
111
128
  var row = null, box = null;
112
129
  for (var p = _current.parentNode; p && p !== _scope && p.nodeType === 1; p = p.parentNode) {
@@ -115,6 +132,7 @@ var Focus = (function () {
115
132
  if (row && /\s(rows|search-results|more-rows)\s/.test(cn)) { box = p; break; }
116
133
  }
117
134
  if (!row || !box) { return null; }
135
+ _rowsAsked = true;
118
136
  // a row that's a grid (Watching's): its next / previous line first (a sideways row has
119
137
  // one line: nothing more to measure)
120
138
  var grid = _current.parentNode && (' ' + (_current.parentNode.className || '') + ' ').indexOf(' card-grid ') !== -1 ? _current.parentNode : null;
@@ -139,8 +157,9 @@ var Focus = (function () {
139
157
  return target;
140
158
  }
141
159
 
142
- // Best focusable in `nodes` for a move in `dir` from rect `r` (null if none).
143
- function pick(dir, r, nodes) {
160
+ // Best focusable in `nodes` for a move in `dir` from rect `r` (null if none). skip(node): ones
161
+ // that can't be it.
162
+ function pick(dir, r, nodes, skip) {
144
163
  var cx = r.left + r.width / 2, cy = r.top + r.height / 2;
145
164
 
146
165
  // Collect candidates in the pressed direction with their primary (distance
@@ -150,6 +169,7 @@ var Focus = (function () {
150
169
  for (var i = 0; i < nodes.length; i++) {
151
170
  var node = nodes[i];
152
171
  if (node === _current || !node.classList || !node.classList.contains('focusable')) { continue; }
172
+ if (skip && skip(node)) { continue; } // (without measuring it)
153
173
  var b = node.getBoundingClientRect();
154
174
  if (b.width <= 0 || b.height <= 0) { continue; }
155
175
  var bx = b.left + b.width / 2, by = b.top + b.height / 2;