HDMI for Channels

Thanks. That did the trick showing the channel (NBC, for example) in the client (although it gives me generic guide data). When I try launching a channel on my iPhone, I get a "connection refused" error. I see you mentioned that issue in an earlier post, and Aman said you need to change "tune.sb" to "tune.sh", but I can't see where that was in the examples you posted.

Possibly unrelated, does the androidhdmi-for-channels program need to be installed within ADB's platform-tools directory? I realized that the commands to change channels only ran when I ran them after changing to that directory. I didn't install androidhdmi-for-channels there, but in its own directory.

Now manually map it to the real NBC:

main.go is the file where each "tuner" is listed. The default included two to start off with:

	tuners = []tuner{
		{
			url:   "http://10.0.1.172:80/main",
			pre:   "/Volumes/Channels-DVR/androidhdmi-for-channels/prebmitune.sh",
			start: "/Volumes/Channels-DVR/androidhdmi-for-channels/bmitune.sh",
			stop:  "/Volumes/Channels-DVR/androidhdmi-for-channels/stopbmitune.sh",
		},
		{
			url:   "http://10.0.1.171:80/main",
			pre:   "/Volumes/Channels-DVR/androidhdmi-for-channels/prebmituneb.sh",
			start: "/Volumes/Channels-DVR/androidhdmi-for-channels/bmituneb.sh",
			stop:  "/Volumes/Channels-DVR/androidhdmi-for-channels/stopbmituneb.sh",
		},
	}
)

When I started off I had removed the first one, leaving only the ___b.sh version, which mismatched the other files in the folder. Rookie mistake, lol. So leave yours be, or remove the second one. Just make sure it's matched up with a trio of .sh filenames that actually exist.

And, if you make corrections you will have to delete the previous .exe and rebuild it, for the changes to be reflected on next launch.

My androidhdmi-for-channels directory is on the same external hard drive as Channels DVR is. You can put it anywhere as long as the path is entered properly in main.go.

Yes!! It's all working. Need to tweak the adb commands a bit - I saw HULU get royally confused that required a Amazon Fire reboot.

Thanks everyone that has contributed to this thread!

Thanks. I'm making lots of rookie mistakes :slight_smile:

I recall an earlier post where Aman indicated whether the urls should be for the encoder or the actual streaming stick, but I can't find it. Any idea?

The URL's in the custom channel point to the android hdmi proxy go binary. In the go binary source code you will set the URL to the encoder device.

Inside the various stop, prei and bmitune files you will set the adb commands to point to the streaming stick. HTH.

1 Like

Thank you! I'm getting much closer now. Tuning a channel in the guide no longer gives me an error. I see the feed from the encoder, but it is the same feed I saw during testing that I got before the streaming stick was turned on. So for some reason, it isn't turning the stick on.

Here's the error in the androidhdmi-for-channels program: "[ERR] Failed to run pre script: fork/exec /opt/opendct/prebmitune.sh: no such file or directory"

1 Like

Double check the path's in the go source code pointing to the three shell scripts. In my case I hard coded the path to the local directory that the go binary lives in with ./

var (
tunerLock sync.Mutex

tuners = []tuner{
	{
		url:   "http://10.0.250.110/ts/1_0",
		pre:   "./prebmitune110.sh",
		start: "./bmitune110.sh",
		stop:  "./stopbmitune110.sh",
	},
	{
		url:   "http://10.0.250.111/main111.ts",
		pre:   "./prebmituneb111.sh",
		start: "./bmituneb111.sh",
		stop:  "./stopbmituneb111.sh",
	},
}

)

Thanks! Here's what I have in my main.go (my encoder's IP address is 192.168.7.168):

var (
	tunerLock sync.Mutex

	tuners = []tuner{
		{
			url:   "http://192.168.7.168/0.ts",
			pre:   "/opt/opendct/prebmitune.sh",
			start: "/opt/opendct/bmitune.sh",
			stop:  "/opt/opendct/stopbmitune.sh",
		},
		{
			url:   "http://192.168.7.168/main",
			pre:   "/opt/opendct/prebmituneb.sh",
			start: "/opt/opendct/bmituneb.sh",
			stop:  "/opt/opendct/stopbmituneb.sh",
		},
	}
)
1 Like

Make sure the shell scripts have execute permissions:
chmod a+x /opt/opendct/*.sh

Then try running the bmitune.sh while tuned into the encoder to see if the adb commands are kicking off correctly:

/opt/opendct/bmitune.sh nbc

Not sure what I'm doing here . . . Where do I type "chmod a+x /opt/opendct/*.sh"?

Just FYI and this may be only my area (Daytona) - the ONN 4K TV box is unobtainium at Walmart. Can't have it shipped and can't pick it up anywhere.

Not surprising given the features and the price for this little box, they massively underestimated demand I guess.

When I got one last week, searching on the WalMart site showed none available, and the product listing on WalMart's site showed it was out of stock. But if I did a Google search, and used the "shopping" tab in the Google results, it had a link to the WalMart product page, and if I followed that link to the WalMart product page, it showed some in stock (in-store, not online), even though it looked like the exact same page that showed none in stock if visited directly. Sure enough, when I went to a store, they had a few in stock.

1 Like

Mine arrived quickly from Amazon for $29:

Same place you are running the go android binary from. I am assuming you are running linux since you are using an /opt directory?

1 Like

On Mac, I use Terminal.app

And if it still doesn't work for you, maybe just move the androidhdmi-for-channels folder elsewhere and change the directory listed in the "pre," "start" and "stop" lines in main.go to match. Here's mine again:

Thank you. So when I run that in Terminal (after first using cd to go to the androidhdmi-for-channels directory), I get:

zsh: no matches found: /opt/opendct/*

Follow my next bit of advice, then... put the androidhdmi-for-channels folder elsewhere and start over.

1 Like

Thanks so much!

I'm showing my ignorance, but your post made me realize my lack of understanding of what parts I needed to configure — I didn't realize the "/opt/opendct/*" in main.go was supposed to be something I changed to reflect my environment (perhaps the original should be changed to "/your/path/here" to make this clear?) Changing that, and running the "chmod a+x" I no longer get the "no such file or directory" error. It still isn't changing the channel, though, and I get several errors, all similar to this:

/Users/cyberskier/androidhdmi-for-channels-main/prebmitune.sh: line 9: adb: command not found

Here is my prebmitune file:

#!/bin/bash
CONNECT="connect 192.168.7.168"
WAKE="input keyevent KEYCODE_WAKEUP"
HOME="input keyevent KEYCODE_HOME"

adb $CONNECT
adb $CONNECT
adb $CONNECT
adb shell $WAKE
adb shell $WAKE
#adb shell $WAKE
adb shell $HOME; sleep 2
#adb shell am start com.google.android.youtube.tvunplugged; sleep 2
#adb shell am force-stop com.google.android.youtube.tvunplugged

When I was testing this very early on in Terminal (before I even got to the Channels part), I had to replace any reference to "adb" to be "./adb". Do I need to do that here? Or I recall seeing people mention putting in some sort of reference to the exact local IP address after "adb". Maybe that's it?

No

You need to add the port at the end of this IP address, for example:

CONNECT="connect 192.168.7.168:5555"

2 Likes

You certainly can't trust the Walmart stock availability, I went to one near me yesterday that said it had some and they had none. Even had the gal in electronics check and she said there were none in the store.

So has anyone tried one of those HDMI to USB hardware encoders?