ADBTuner: A "channel tuning" application for networked Google TV / Android TV devices

Hey, thanks! That worked!

For the record, I have five Onn Plus for testing, use three in production. They have not given me major challenges. WiFi6 has been reliable, the performance is really great for $30.

The only difference to my DirecTV Osprey (hardware) setup is the lower audio output, which was also on other Onn boxes. To correct this, I boost Onn audio capture by +6fB on my LinkPi.

@turtletank I've been playing around with HTML in the WebUI, mostly for my own purposes, but maybe others would like it too?

For those of us with large numbers of channels, I thought adding Expand/Collapse to the Channels section would be nice.

Also, when I imported my channels, I did so without channel numbers, but now when I make any changes entering a channel number is required -- even though everything's been working fine without that value. So, I've removed that as a required value.

Given you never open sourced this project, I'm unsure if you're interested in anything resembling a PR? I've only changed index.html, so I could PM that to you -- unless you'd rather me just keep mods to myself, which is fine too. :slight_smile:

2 Likes

I found that sleep 15 works best for me, but sometimes fails. I can get a paused video if it takes too long, or the watch now screen if too soon. What is really needed is a way to detect the 'watch now' message, like in detecting 'who's watching'.

The other problem that I have, the Development version sometimes kicks me out of the video, to the home screen of the Sling app or the YTTV app. It doesn't happen often, but I never saw it happen with the Latest version.

Looking for some tips to make my setup more reliable.

I'm using a Chromecast w/Google TV and I find the setup works, but many times it gets stuck on a channel and won't unlock. Even if I click release the tuner, it won't release. This makes all my channels untuneable and fail since the tuner shows as not available.

Any advice in making the tuner more reliable would be appreciated.

@turtletank I've made a few more enhancements, which I'm happy to contribute -- if you're cool with it.

I've added the ability to tune CDVR Virtual Channels via ADBTuner. The main value in this is to be able to watch Virtual Channels in the WebUI, Multiview, or in other apps (like VLC or other Media Centers). curl is used for channel changes, as the CDVR Android client doesn't support deeplinks.

There are about 12-18 lines of code and a custom config, so very minimal impact on your core:

{
    "name": "CDVR Virtual Channels using curl for Channel Changes",
    "author": "bnhf",
    "version": "1.0.0",
    "description": "Tunes CDVR Virtual Channels via a virtual tuner using curl for channel changes.",
    "uuid": "99f34ebf-6484-4043-aa6c-bfeaf9214eb8",
    "global_options": {
        "wait_for_video_playback_detection": false,
        "use_fixed_delay": false,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false,
        "wait_after_post_playback_start_commands_seconds": 0
    },
    "pre_tune_commands": [
        "am force-stop com.getchannels.dvr.app",
        "am start -n com.getchannels.dvr.app/com.getchannels.android.MainActivity",
        "sleep 5"
    ],
    "tune_commands": [
        "http://||TARGET_DEVICE_IP||:57000/api/play/channel/||TARGET_URL_OR_IDENTIFIER||"
    ],
    "post_playback_start_commands": [],
    "post_tune_commands": [
        "input keyevent KEYCODE_BACK",
        "am force-stop com.getchannels.dvr.app"
    ]
}

Also, I've reworked the Expand/Collapse I did for the Channels section of the UI, so that it's all done in JavaScript now, which means there's only one line of code to change in your current base -- plus a new small .html and modest .js.

I'm doing it this way in case you're not interested in integrating these changes, to make it easy for me to stay current -- while still keeping the mods. :slight_smile:

Looks like this, with previous channels collapsed. They can be expanded individually or as a group:

I've been using Sling myself, migrating Sling from the Docker version of cc4c to ADBTuner, and most of what you're talking about I've seen -- with the bad behavior almost always when the app has to load from scratch.

I have it working well now though, and here are the key elements from my perspective:

  • The app itself is pretty slow to load, even on a FireStick 4K Max, which can cause issues with either ADBTuner or Channels. Best results for me have included specifying com.sling as a Keep Alive Package. This results in reasonably quick and reliable tuning.

  • Since I also have YTTV, and that also benefits from being the Keep Alive Package, I'm running two ADBTuner containers (each with two tuners). I'm using one for YTTV, and the other for Sling and CDVR Virtual Channels.

Here's my custom config:

{
    "name": "Deep Links - Sling with No Video Playback Detection",
    "author": "bnhf",
    "version": "0",
    "description": "Sling virtual tuning without video playback detection.",
    "uuid": "44da8817-32b3-4f52-a5ee-42a208d870a4",
    "global_options": {
        "wait_for_video_playback_detection": false,
        "use_fixed_delay": false,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false,
        "wait_after_post_playback_start_commands_seconds": 0
    },
    "pre_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP"
    ],
    "tune_commands": [
        "am start -n com.sling/.MainActivity '||TARGET_URL_OR_IDENTIFIER||'"
    ],
    "post_playback_start_commands": [],
    "post_tune_commands": [
        "input keyevent KEYCODE_BACK",
        "input keyevent KEYCODE_HOME"
    ]
}

I'm not sure what you mean by 'watch now', as I see Watch from beginning and Watch Live buttons when playback first starts. But those go away on their own in a few seconds, and have no impact on tuning for me. I'm assuming you have profiles and autoplay disabled on every stick you're capturing from?

So with this mod one could also possible tune a Android tv sat box with numbers? Like i do in your app ahc4?

Are you using scripts/allente/livetv? If so, that script sends individual ADB keyevents for each number, which is not what this mod does. Tuning for this is done using a curl command.

Thank you, I'll try yours.

You should not be seeing that. Deeplinks are intended to take you to a live channel. What channel are you trying to tune to? What deeplink did you use? Where did those deeplinks come from?

If I had to guess, it looks like you're using the wrong IDs. Sling has both asset IDs (which reference specific content), and channel IDs (which take you to a live, linear channel). It's very easy to grab the wrong ID, if you're doing it yourself.

Yes, I have the correct links. That pic is using the default Deep Links. I knew that I would get that screen.

I can't click on a link in my Apple TV with your configuration, Channels gives an error message. It worked for a scheduled recording.

I have been using

{
    "name": "Fixed Delay",
    "author": "",
    "version": "0",
    "description": "fixed delay.",
    "uuid": "2d193a0f-641e-4314-b3dc-5c4eeee46582",
    "global_options": {
        "wait_for_video_playback_detection": false,
        "use_fixed_delay": true,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false
    },
    "pre_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP"
    ],
    "tune_commands": [
        "am start -W -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||' '||TARGET_PACKAGE_NAME||'",
        "sleep 15",
        "input keyevent KEYCODE_ENTER"
    ],
    "post_tune_commands": [
        "am force-stop '||TARGET_PACKAGE_NAME||'",
        "input keyevent KEYCODE_MEDIA_STOP",
        "input keyevent KEYCODE_HOME"
    ]
}```

In a prior post @spammedeeper said he had issues when using a sleep command more than 4 seconds. I can't remember specifics but that is why I use multiple sleep commands with no one greater than 4 seconds. I think he said he would get random results when sleep was more than 4.

Edit: it was @nateg that said poor results with sleep > 4

@user3162 After you set com.sling as the Keep Alive Package for your tuners, and changed the custom config, how long did you wait?

It can take a "cycle" (up to about 5 minutes I think) before a new keep alive takes effect. You can confirm using the View option above your streaming endpoint settings. You should see something like this before you test:

This tells you the Sling app is loaded and sitting at its home screen. As I said, tuning is reasonably fast and reliable this way-- using this method with the custom config I provided. About 8 seconds to viewing the live channels, and a few more seconds for the buttons I mentioned above to disappear.

1 Like

This is the sling home page.

When I click on a channel in the menu, I can see by viewing in VLC that it does indeed load very quickly, but, what I see on my TV, is a message that streaming to the tuner failed. Service unavailable.

Are you seeing activity in the ADBTuner log when you try to tune? Maybe post a log snippet from one failed attempt, using the above setup.

You should be able to see what's happening as well, using VLC or the "View" option from the WebUI. You'll probably want to set a tuner to priority "1" so you know which wiil be used.

Here's an example of a successful tune I did moments ago:

2025-10-14 20:18:16.312 - stream - [Tune 5WmFa72Dw6HGWytmHjJnY9] htpc6:5582 | Go-http-client/1.1
2025-10-14 20:18:16.312 - stream - [Tune (5WmFa72Dw6HGWytmHjJnY9)] No active tuners found for Starz in Black HD. Reserving a new tuner.
2025-10-14 20:18:16.312 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Attempting to reserve tuner for: ['com.sling', 'com.sling'].
2025-10-14 20:18:16.315 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Available Tuners:
2025-10-14 20:18:16.315 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Name: firestick-rack1 Priority: 
2025-10-14 20:18:16.315 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Name: firestick-rack2 Priority: 
2025-10-14 20:18:16.315 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Selecting random tuner
2025-10-14 20:18:16.315 - tuner_management - [Tune 5WmFa72Dw6HGWytmHjJnY9] Reserved Tuner: Name: firestick-rack1 Priority: 
2025-10-14 20:18:16.315 - stream - [Tune (5WmFa72Dw6HGWytmHjJnY9)] Tuning to Starz in Black HD on firestick-rack1
2025-10-14 20:18:16.315 - stream - [Tune (5WmFa72Dw6HGWytmHjJnY9)] Using channel configuration: Deep Links - Sling with No Video Playback Detection (44da8817-32b3-4f52-a5ee-42a208d870a4)
2025-10-14 20:18:16.783 - lib.adb - [Tune (5WmFa72Dw6HGWytmHjJnY9)] ADB: firestick-rack1 - pidof com.sling
2025-10-14 20:18:16.894 - stream - [Tune (5WmFa72Dw6HGWytmHjJnY9)] Using https://watch.sling.com/1/channel/23a6ea3c163a47f390f73900ccc76bc1/watch to load channel.
2025-10-14 20:18:16.894 - lib.adb - [Tune (5WmFa72Dw6HGWytmHjJnY9)] ADB: firestick-rack1 - input keyevent KEYCODE_MEDIA_STOP
2025-10-14 20:18:17.627 - lib.adb - [Tune (5WmFa72Dw6HGWytmHjJnY9)] ADB: firestick-rack1 - am start -n com.sling/.MainActivity 'https://watch.sling.com/1/channel/23a6ea3c163a47f390f73900ccc76bc1/watch'
2025-10-14 20:18:19.071 - stream - [Tune 5WmFa72Dw6HGWytmHjJnY9] Waiting for playback start. Status: unknown
2025-10-14 20:18:20.106 - lib.adb - Media session playback has started.
2025-10-14 20:18:20.106 - lib.adb - [Tune (5WmFa72Dw6HGWytmHjJnY9)] ADB: Closing connection - firestick-rack1
2025-10-14 20:18:20.106 - stream - [Tune 5WmFa72Dw6HGWytmHjJnY9] Tuning completed after 3.79 seconds. [Tune 5WmFa72Dw6HGWytmHjJnY9] Display was on, application (com.sling) was running.
2025-10-14 20:18:20.106 - uvicorn.access - 100.xxx.xxx.xxx:0 - "GET /stream/6 HTTP/1.1" 307
2025/10/14 20:18:20 [PROXY] 100.xxx.xxx.xxx -> GET "/proxy/1?requestKey=5WmFa72Dw6HGWytmHjJnY9" -> "http://encoder_48007/0.ts"
2025-10-14 20:18:29.950 - server - 
--------------------------------------------------
Tuner "firestick-rack1" is currently in use and locked.
Tune ID: 5WmFa72Dw6HGWytmHjJnY9
Channel: Starz in Black HD
Lock Obtained: 2025-10-14 20:18:16 (0.23 minutes ago)
Last Seen: 2025-10-14 20:18:29 (0.95 seconds ago)
Bytes Transferred: 5000800 (4.77MB)
Remote User Agent:
Go-http-client/1.1
--------------------------------------------------

Note ADBTuner reported less than 4 seconds to tune this way.

The log is confusing because the bedroom tuner is already in use recording MSNBC. It is the livingroom tuner that is trying to tune CNN that is important here. It looks like it is checking for a profile screen? The who's watching is set to false.

2025-10-14 22:32:18 2025-10-15 02:32:18.036 - uvicorn.access - 172.17.0.1:0 - "POST /admin/channel/4 HTTP/1.1" 303
2025-10-14 22:32:18 2025-10-15 02:32:18.062 - uvicorn.access - 172.17.0.1:0 - "GET / HTTP/1.1" 200
2025-10-14 22:32:24 2025-10-15 02:32:24.983 - stream - [Tune eQKsnxbeVhZ2f4TTc9HBui] 192.168.4.232:5592 | Go-http-client/1.1
2025-10-14 22:32:24 2025-10-15 02:32:24.992 - stream - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] No active tuners found for CNN. Reserving a new tuner.
2025-10-14 22:32:24 2025-10-15 02:32:24.993 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Attempting to reserve tuner for: ['com.sling'].
2025-10-14 22:32:24 2025-10-15 02:32:24.997 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Available Tuners:
2025-10-14 22:32:24 2025-10-15 02:32:24.997 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Name: Livingroom Priority: 4
2025-10-14 22:32:24 2025-10-15 02:32:24.997 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Name: Basement Priority: 5
2025-10-14 22:32:24 2025-10-15 02:32:24.997 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Using first available tuner (by priority).
2025-10-14 22:32:24 2025-10-15 02:32:24.998 - tuner_management - [Tune eQKsnxbeVhZ2f4TTc9HBui] Reserved Tuner: Name: Livingroom Priority: 4
2025-10-14 22:32:24 2025-10-15 02:32:24.998 - stream - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Tuning to CNN on Livingroom
2025-10-14 22:32:24 2025-10-15 02:32:24.999 - stream - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Using channel configuration: Deep Links - Sling with No Video Playback Detection (3f8bdedf-60ee-428a-b699-7ce880ae958f)
2025-10-14 22:32:25 2025-10-15 02:32:25.285 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] ADB: 192.168.4.233 - pidof com.sling
2025-10-14 22:32:25 2025-10-15 02:32:25.348 - stream - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Using https://watch.sling.com/1/channel/eb6c608319dc4328a9aa5bea1307cbaf/watch to load channel.
2025-10-14 22:32:25 2025-10-15 02:32:25.348 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] ADB: 192.168.4.233 - input keyevent KEYCODE_MEDIA_STOP
2025-10-14 22:32:25 2025-10-15 02:32:25.461 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] ADB: 192.168.4.233 - am start -n com.sling/.MainActivity 'https://watch.sling.com/1/channel/eb6c608319dc4328a9aa5bea1307cbaf/watch'
2025-10-14 22:32:27 2025-10-15 02:32:27.092 - stream - [Tune eQKsnxbeVhZ2f4TTc9HBui] Waiting for playback start. Status: unknown
2025-10-14 22:32:33 2025-10-15 02:32:33.841 - stream - [Tune eQKsnxbeVhZ2f4TTc9HBui] Waiting for playback start. Status: unknown
2025-10-14 22:32:38 2025-10-15 02:32:38.582 - server - 
2025-10-14 22:32:38 
2025-10-14 22:32:38 --------------------------------------------------
2025-10-14 22:32:38 Tuner "Bedroom" is currently in use and locked.
2025-10-14 22:32:38 Tune ID: 6okZ4qeZW6kfe7e6Mumo4w
2025-10-14 22:32:38 Channel: MSNBC
2025-10-14 22:32:38 Lock Obtained: 2025-10-15 02:00:00 (32.64 minutes ago)
2025-10-14 22:32:38 Last Seen: 2025-10-15 02:32:38 (0.58 seconds ago)
2025-10-14 22:32:38 Bytes Transferred: 2483851488 (2368.79MB)
2025-10-14 22:32:38 Remote User Agent:
2025-10-14 22:32:38 Go-http-client/1.1
2025-10-14 22:32:38 --------------------------------------------------
2025-10-14 22:32:38 
2025-10-14 22:32:38 --------------------------------------------------
2025-10-14 22:32:38 Tuner "Livingroom" is currently in use and locked.
2025-10-14 22:32:38 Tune ID: N/A
2025-10-14 22:32:38 Channel: CNN
2025-10-14 22:32:38 Lock Obtained: 2025-10-15 02:32:24 (0.24 minutes ago)
2025-10-14 22:32:38 Last Seen: N/A
2025-10-14 22:32:38 Bytes Transferred: None
2025-10-14 22:32:38 Remote User Agent:
2025-10-14 22:32:38 N/A
2025-10-14 22:32:38 --------------------------------------------------
2025-10-14 22:32:39 2025-10-15 02:32:39.799 - stream - [Tune eQKsnxbeVhZ2f4TTc9HBui] Waiting for playback start. Status: unknown
2025-10-14 22:32:40 2025-10-15 02:32:40.303 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Checking for profile screen
2025-10-14 22:32:44 2025-10-15 02:32:44.820 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Checking for profile screen
2025-10-14 22:32:52 2025-10-15 02:32:52.135 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] On screen text: 'owe { ”
2025-10-14 22:32:52 x _ " j 5
2025-10-14 22:32:52 paz
2025-10-14 22:32:52 . _
2025-10-14 22:32:52 # q
2025-10-14 22:32:52 an
2025-10-14 22:32:52 '
2025-10-14 22:32:52 3 ¥
2025-10-14 22:32:52 i _
2025-10-14 22:32:52 pn
2025-10-14 22:32:52 5 4
2025-10-14 22:32:52 
2025-10-14 22:32:52 \
2025-10-14 22:32:52 
2025-10-14 22:32:52 trump: wy $08 bailout of argentina doesn't matter to u.s.
2025-10-14 22:32:52 
2025-10-14 22:32:52 tinuing ail president donald trump says his administration has “iden1 newsnight
2025-10-14 22:32:52 df ~ |
2025-10-14 22:32:52 
2025-10-14 22:32:52 ~~ — .
2025-10-14 22:32:52 
2025-10-14 22:32:52 40:3: 32 pm ='
2025-10-14 22:32:52 2025-10-15 02:32:52.536 - lib.adb - [Tune (eQKsnxbeVhZ2f4TTc9HBui)] Checking for profile screen
2025-10-14 22:33:08 2025-10-15 02:33:08.601 - server - 
2025-10-14 22:33:08 
2025-10-14 22:33:08 --------------------------------------------------
2025-10-14 22:33:08 Tuner "Bedroom" is currently in use and locked.
2025-10-14 22:33:08 Tune ID: 6okZ4qeZW6kfe7e6Mumo4w
2025-10-14 22:33:08 Channel: MSNBC
2025-10-14 22:33:08 Lock Obtained: 2025-10-15 02:00:00 (33.14 minutes ago)
2025-10-14 22:33:08 Last Seen: 2025-10-15 02:33:08 (0.6 seconds ago)
2025-10-14 22:33:08 Bytes Transferred: 2527243768 (2410.17MB)
2025-10-14 22:33:08 Remote User Agent:
2025-10-14 22:33:08 Go-http-client/1.1
2025-10-14 22:33:08 --------------------------------------------------
2025-10-14 22:33:08 
2025-10-14 22:33:08 --------------------------------------------------
2025-10-14 22:33:08 Tuner "Livingroom" is currently in use and locked.
2025-10-14 22:33:08 Tune ID: N/A
2025-10-14 22:33:08 Channel: CNN
2025-10-14 22:33:08 Lock Obtained: 2025-10-15 02:32:24 (0.74 minutes ago)
2025-10-14 22:33:08 Last Seen: N/A
2025-10-14 22:33:08 Bytes Transferred: None
2025-10-14 22:33:08 Remote User Agent:
2025-10-14 22:33:08 N/A
2025-10-14 22:33:08 --------------------------------------------------
2025-10-14 22:33:25 2025-10-15 02:33:25.966 - tuner_management - Releasing tuner 1 as it is untracked and has been locked for over a minute.
2025-10-14 22:33:25 2025-10-15 02:33:25.966 - tuner_management - Released tuner (1).

In the Deep Links - Sling with No Video Playback Detection custom config, try setting use_fixed_delay to true. You can also experiment with leaving fixed_delay_seconds at 0, and also try setting it to something low-ish like 5.

Yes, there was something strange happening in the logs at the time, when I sent sleeps longer than 4. I would just send multiple sleeps to get the total timing I needed. Recently I’ve been able to send longer sleep commands without issue. However there is definitely a race that goes on between setting up the timing against certain apps vs. channels timing out and giving up. This anecdotally is in the 20-ish second range in my experience.

@user3162 Have you had a chance to try the above yet?