HDMI for Channels

You and I both, we'll have to wait to see what the unique YouTube TV Channel IDs are going to be for NFL Sunday Ticket games.

1 Like

Thanks, that's what I was looking for. Tested and I'm able to show content on my "dummy" channel. Now just have to wait for the season to start.....

Are you aware that this should be achievable through the YTTV app since they're allowing unlimited Sunday Ticket streams from your home IP? I'm not dismissing your use case for piping them through Channels since there are plenty of other reasons you'd want to do so, just wanted to maybe save you some trouble if you didn't know!

Okey-dokey, there's now a multi-arch version of bnhf/ah4c:test that includes ws-scrcpy (the websocket version of scrcpy) -- so please give it a try and let me know how it works for you.

I really like it myself, as it adds the ability to control my firestick devices directly from anywhere. I recommend opening a shell session (which will open in a new tab) before starting the "stream" in the current browser tab. That way, if you want to send an ADB command instead of using mouse-clicks or having the keyboard interact with the device, it's easy to do.

No need to use a remote control or remote control app! Protected and/or DRM'd video streams will not show in ws-scrcpy, but all the menus and pop-ups do -- so it should work well for entering credentials or recovering from unanticipated scenarios:

The container image size has been reduced 10x as well.

2 Likes

Is there a docker container for this?

Yes. Here's the docker-compose for Portainer-Stacks:

version: '3.9'
services:
  ah4c:
    image: bnhf/ah4c:test
    container_name: ah4c
    hostname: ah4c
    dns_search: localdomain # Specify the name of your LAN's domain, usually local or localdomain
    ports:
      - 5037:5037 # Port used by adb-server
      - 7654:7654 # Port used by this androidhdmi-for-channels proxy
      - 7655:8000 # Port used by ws-scrcpy
    environment:
      - IPADDRESS=${IPADDRESS} # Hostname or IP address of this androidhdmi-for-channels extension to be used in M3U file (also add port number if not in M3U)
      - NUMBER_TUNERS=${NUMBER_TUNERS} # Number of tuners you'd like defined 1, 2, 3 or 4 supported
      - TUNER1_IP=${TUNER1_IP} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - TUNER2_IP=${TUNER2_IP} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - TUNER3_IP=${TUNER3_IP} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - TUNER4_IP=${TUNER4_IP} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - ENCODER1_URL=${ENCODER1_URL} # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - ENCODER2_URL=${ENCODER2_URL} # Full URL for tuner #2 in the form http://hostname/stream or http://ip/stream
      - ENCODER3_URL=${ENCODER3_URL} # Full URL for tuner #3 in the form http://hostname/stream or http://ip/stream
      - ENCODER4_URL=${ENCODER4_URL} # Full URL for tuner #4 in the form http://hostname/stream or http://ip/stream
      - STREAMER_APP=${STREAMER_APP} # Streaming device name and streaming app you're using in the form scripts/streamer/app (use lowercase with slashes between as shown)
      - CHANNELSIP=${CHANNELSIP} # Hostname or IP address of the Channels DVR server itself
      #- ALERT_SMTP_SERVER="smtp.gmail.com:587"
      #- ALERT_AUTH_SERVER="smtp.gmail.com"
      #- ALERT_EMAIL_FROM=""
      #- ALERT_EMAIL_PASS=""
      #- ALERT_EMAIL_TO=""
      #- ALERT_WEBHOOK_URL=""
      - TZ=${TZ} # Your local timezone in Linux "tz" format
    volumes:
      - /data/ah4c/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - /data/ah4c/m3u:/opt/m3u # m3u files will be stored here and hosted at http://<hostname or ip>:7654/m3u for use in Channels DVR - Custom Channels settings
      - /data/ah4c/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped

The container image is for the "test" version of ah4c that includes ws-scrcpy. You might want to check out this blog post from @johnofcamas for details on setting up ah4c (which is a supercharged version of the original androidhdmi-for-channels project) with Docker.

2 Likes

Good call out. My wife doesn't like "change" and why I was trying to pump through channels so she has one less place to have to try and find something (Amazon, Disney, Netflix oh my), though having to use a separate remote to tune the OON device probably will trigger a reaction from her, so no perfect solution at this point.

1 Like

Actually there is something else to consider. If you are going to be tuning a stream from Channels via a separate device remote the latency can be maddenly high. Like 2 to 5 second between any kind of button press and any kind of visual reaction on your display. The device will make the changes in realtime, but those changes will be delayed getting to your display because the encoder needs time to process and convert the signal from the HDMI into a stream usable by Channels.

Since my last changes I have not had a single failure. Detecting the video lockup fixed more problems than I realized! If your on the fence give it a go! It's more reliable than watching live because the script will fire off a new intent if it detects a lockup - watching live without channels + ah4c you have to do with ze remote!

EDIT: I think it is a hulu bug but it applies to all providers.

Anybody know what the ADB KEYCODE is for the "TV" button on the FireStick remote? It's the key that brings up the Live TV Guide if that helps. I've tried a bunch of likely possibilities with no joy so far...

EDIT: Found it: KEYCODE_LIVE_TV

1 Like

@johnofcamas Have you made in progress with Sling TV on ah4c? I'm giving it a shot myself, so let me know if you've figured anything out, or have any promising strategies for tuning thus far.

EDIT: I have a functioning structure figured out. Additional testing tomorrow, including adding more channels to the M3U.

1 Like

@turtletank If a given app is compatible with the "Live TV" guide, does that suggest (or guarantee) that deep links are supported? And if so, what's the best way to figure out what those links might be?

I have a working solution for Sling TV using keyevents, but I just want to be sure I'm not missing a possible solution using deep links.

Yes.

Sling supports deep links, but nobody has been able to find links that link to a specific channel and not just a specific program.

Figuring out what the links should be is the challenge. More often than not they just match up to the links used in the browser version of the service, but sometimes you just have to try a bunch of variants until something works (or doesn't).

Some tools/methods that can confirm deep link support and provide clues as to the structure of the supported links:


  1. Use apktool (apktool d app.apk) to decompile the apk and review the contents of AndroidManifest.xml. Each activity is broken down in this file along with the supported schemes, protocals, domains, etc.

  2. If you have adb setup and the app installed you can use adb shell dumpsys package package_name to get the same info. Example:

$ adb shell dumpsys package com.sling
Activity Resolver Table:
  Schemes:
      slingtv:
        8b32cae com.sling/.MainActivity filter 7294145
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "slingtv"
          Authority: "sling.com": -1
          Authority: "watch.sling.com": -1
          Authority: "play": -1
          Authority: "navigate": -1
          Authority: "open": -1
      http:
        8b32cae com.sling/.MainActivity filter ed2009a
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "http"
          Scheme: "https"
          Authority: "watch.sling.com": -1
          AutoVerify=true
      https:
        8b32cae com.sling/.MainActivity filter ed2009a
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "http"
          Scheme: "https"
          Authority: "watch.sling.com": -1
          AutoVerify=true
        8b32cae com.sling/.MainActivity filter cb55dcb
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "https"
          Authority: "slingtv.app.link": -1
          Authority: "slingtv-alternate.app.link": -1
          AutoVerify=true
        8b32cae com.sling/.MainActivity filter 1cef9a8
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "https"
          Authority: "slingtv.test-app.link": -1
          Authority: "slingtv-alternate.test-app.link": -1
          AutoVerify=true
...

In here you can see that links such as slingtv://watch.sling.com and http(s)://watch.sling.com are supported links that automatically match up to .MainActivity.

  1. If you want to see the URLs being used by the Live TV feature you can do something like adb shell dumpsys activity | grep https which would give you something along these lines:
intent={act=android.intent.action.VIEW dat=https://tv.youtube.com/watch/xxxx?launch=launcher&parentCsn=xxxx&parentTrackingParams=xxx flg=0x00000000 pkg=com.google.android.youtube.tvunplugged cmp=com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity}

I believe that Sling uses the same show specific URLs here as well, but it's been a while since I last checked.

Are you able to log into sling tv and view the channels from your computer? Does each channel have a unique address?

The unique part of the yoututbetv address that I used near the start of this thread as an alternative to automation came from the address that shows up in the browser when you turn each channel from your computer. Does sling hide its address when you use it from a browser?

Presumably, 7f5f5993457648d68db2fa5d5103cbcc would be the unique identifier for Showtime HD?:

Nothing from dumpsys activity | grep https (or http or slingtv), but I am seeing something that's maybe interesting from logcat | grep com.sling:

08-19 11:30:55.841   488   554 I ActivityManager: Start proc 2719:com.sling/u0a192 for service com.sling/com.movenetworks.livetv.LiveTvInputService
08-19 11:30:59.976   488  8424 I ActivityManager: START u0 {act=android.intent.action.VIEW (has data) flg=0x14800000 cmp=com.sling/.MainActivity (has extras)} from uid 10126
08-19 11:31:24.056   488  2751 I ActivityManager: START u0 {act=android.intent.action.VIEW (has data) cmp=com.sling/.MainActivity} from uid 10192

Is that a thread worth pulling on?

Hit play for the live stream for show time and see what the address changes to if any at all. Play or Watch now or whatever starts the live stream.

https://watch.sling.com/1/asset/a9f821f3629fd3f4955d56f96eaf45ce/watch

Try your luck with this from the terminal or some variation of it.

adb -s 192.168.1.171 shell am start -a android.intent.action.VIEW -d https://watch.sling.com/1/asset/a9f821f3629fd3f4955d56f96eaf45ce/watch

Change ip address to your own device of course

So that does work, although if recollection serves, that ID number will change once this movie is over. Also, perhaps this is expected, but I did get this message:

screenshot-htpc6-2023.08.19-12_46_54

I clicked, "Sling TV" and then "Always".