HDMI for Channels

OK I've got the hardware and software setup for the NBC channels, but I can't find in the thread how to launch the NBC app directly to a channel via adb. Everyone's doing it through YTTV but I know that Channels is doing it directly with the nbctve:// streamlinks, so how is Channels doing it and can it be done in adb without doing keypresses?

I've got direct streamlinks for live channels working fine, just need to figure out how to launch them with adb in the tune file. I think the package is com.nbcuni.nbc.androidtv on the Onn TV stick but don't know the intent (I'm guessing VIEW?) and URIs to get the app to launch a specific channel.

I think we have to get into apk hacking to see if we can't remove that stupid YouTube TV splash screen lol. That's a few seconds right there if the app isn't already open.

I have been going down this road this week. Already destroyed two onn boxes lmao. It's dark in these parts.

Maybe try something like this (complete guess, apologies if it doesn't work):

adb shell am start -a android.intent.action.VIEW -d nbctve://path/to/content

Yes please, lol. If not the whole splash screen, then maybe just that awful launch sound effect (some sort of scraping noise in outer space?) that I’ve grown sick of hearing :slight_smile:

1 Like

Thanks! I got it to work manually, still trying to figure out the go syntax to run the Windows batch files instead of bash shell scripts, go build is bombing out. Looks like I need to escape some chars.

Here's my bmitune.bat to launch NBC channels via the app:

@echo off
set p1=%1
set link=""
set IP=192.168.1.94:5555
set PKG=com.nbcuni.nbc.androidtv

if "%p1%"=="nbc" set link=nbctve://live/nbc
if "%p1%"=="msnbc" set link=nbctve://live/msnbc
if "%p1%"=="usa" set link=nbctve://live/usa
if "%p1%"=="syfy" set link=nbctve://live/syfy
if "%p1%"=="cnbc" set link=nbctve://live/cnbc
if "%p1%"=="golf" set link=nbctve://live/golf

c:\platform-tools\adb -s %IP% shell am start -a android.intent.action.VIEW -d %link% -n %PKG%/com.nbc.nbctvapp.ui.main.view.MainActivity

For anyone wondering how to get the Android default activity for an app (the -n param in the start command above), the command is:
adb shell cmd package resolve-activity --brief "pkgname"

where pkgname is the NBC package name here (com.nbcuni.nbc.androidtv), you get these by running:
adb shell pm list packages "filter"
where filter is nbc in this case to only show the NBC packages

1 Like

I might be miss-understanding what you are saying... but all you need to do is make sure the main.go file says the right names... mine has this

	tuners = []tuner{
		{
			url:   "http://192.168.1.168/0.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune.bat",
		},
		{
			url:   "http://192.168.1.168/4.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune2.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune2.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune2.bat",
		},
		{
			url:   "http://192.168.1.168/8.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune3.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune3.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune3.bat",
		},
	}

I see 2 big advantages for YTTV users to use the NBC app for the NBC channels: 1-the links appear to be more permanent and 2-it doesn't take up one of your 3 allowed streams

I am going to modify my bmitune.bat file when I get home to use a combination of NBC and YTTV (only for the non NBC channels, like BBCNews)

BTW - isn't Bravo an NBC channel?

Yeah had to figure out (again) that you need to escape the backslashes in Windows, ugh.

1 Like

I'd be interested to hear how this works out when launched this way. When using as Stream Links, I found the NBC app to be an unreliable train wreck, loading some times, not loading other times, and giving me errors at times.

1 Like

Looking over here at Stream Link URLs - have you all tried this format?

nbctve://live/$NETWORK

1 Like

Yay, got it all working with the Onn 4K and the Uray encoder! Pretty slow to wake and start the NBC app then have the app start the stream, from what I've seen it's about 20-25 secs total. That's fine for recording which is all need, don't care about live. I'm using H.265, 1920x1080@60fps, 8k VBR, MPEG-TS.

Here's my pre and post tune scripts for anyone curious, I force close the app and put the box to sleep after a tune which is why the app takes longer to startup I'm sure.

prebmitune.bat

@echo off
set IP=192.168.1.94:5555

c:\platform-tools\adb connect %IP%
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_WAKEUP
rem c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_HOME

stopbmitune.bat

@echo off
set IP=192.168.1.94:5555
c:\platform-tools\adb -s %IP% shell am force-stop com.nbcuni.nbc.androidtv
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_HOME
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_SLEEP
1 Like

Yeah if you look at my bmitune.bat script above I put those in as params for the NBC app and it worked. Thanks!

I'm hoping here that with the pre- and post- tune scripts that allow for stopping the app that it might work ok with a fresh start every time. Who knows, but I don't have much choice anyway since I'm not subbing to YTTV.

FWIW I went back and edited earlier posts that had wrong channel mappings to hopefully minimize any confusion. I also wanted to add, that the 14 channels I've got set up are still working fine for me, the links haven't changed, so the verdict may still be out on their relative (im)permanence.

This is good to keep in mind. Not just for folks who don't have YTTV's unlimited plan, but also for folks set up to be sharing the YTTV family subscription in other households.

Not a bad idea, I may mix-and-match too. Maybe just for a few channels. I'll experiment over the weekend.

Yeah, as interactive apps their UI's are pretty bad, but if we can launch straight to a live channel's stream reliably, and just use Channels UI for everything else, it seems like something to consider. That YTTV splash / outer space scraping sound is growing more annoying by the hour and this would cut down on that, at least...

Yes.

One thing to consider about H265 is that it makes comskip take a MUCH MUCH longer time to scan the files after recording stops. In my case it was quite excessive so I landed back on H264.

By the way, I came across this:

It appears to be a semi-automated way to get the channel links for YTTV - perhaps it could be the basis for a future way of keeping YTTV links refreshed...

2 Likes

Nice find. It's a bit out of date as the url and some other things have changed but it's generally the same.

That being said, if you are going to be in the dev console you might as well just scrape the page using JavaScript.

Paste in developer console on tv.youtube.com/live:

const channelRows = document.querySelectorAll("div.container.ytu-epg-row");
results = []
for (i = 0; i < channelRows.length; ++i) {
   var network = channelRows[i].querySelector(".network-title").innerHTML
   var targetLink = channelRows[i].querySelector(".tenx-thumb > a.yt-simple-endpoint.style-scope.ytu-endpoint").href
   if (network && targetLink && targetLink.includes("watch")) {
      results.push({
         networkName: network,
         targetLink: targetLink
      })
   }
}
console.table(results);

This will give you a nice table of data like this:

And if you want JSON data you can right click on the "array()" at the bottom and choose "copy object" to copy a JSON representation of the results to your clipboard.

It should be a pretty simple task to write a small script to take this JSON data and spit out a bmitune.sh file and an m3u playlist. I will do that tomorrow if someone doesn't beat me to it.

4 Likes

Has anyone been able to run the NBC app on the Onn TV 4K? I am getting "unable to connect" "please check your internet connection and try again" on two different boxes - one connected to the encoder and one to a TV.

Had some high strangeness this evening. My newer mecool device prompted for are you still there within 3 minutes after starting a recording?

At this point not sure what is going on as the stream just started. I am sticking with the original amazon fire tv 4k ultra until I can get this figured out. Will start testing random shows on my 2nd tuner with these new devices - more info to come!

EDIT: I have added checks to my tune in script and keep alive handler. I am now making note of what station is "tuned in" and during my keep alive checks if the stream is not playing it will attempt to recover by tuning in again.

Keep alive checker: Monitors streams and restarts if needed. Also attempt to keep the player thinking someone is hitting buttons. · GitHub
My tune in script: tmm1/androidhdmi-for-channels hulu tuner script · GitHub
My stop script: Stop playing media · GitHub

Hopefully this can give inspiration for anyone else wanting to make the process a bit more refined/robust.

1 Like