youtube-webos icon indicating copy to clipboard operation
youtube-webos copied to clipboard

Screen Off option disabled

Open rbaggio108 opened this issue 1 year ago • 14 comments

Is it possible to turn off tv screen during playing sth on youtube add free? When I press settings button, the screen off option is grayed out

rbaggio108 avatar Dec 28 '24 08:12 rbaggio108

Not reproduceable on my LG C1. Please re-open this issue when you supply your TV model, webOS version, and firmware version.

fire332 avatar Dec 29 '24 06:12 fire332

I have the same problem, LG disabled the display off button for the normal YouTube app, even if Premium is activated. I think this is done on the basis of the AppId because the ad-free app uses the same ID, the button is also grayed here.

Webos 24, but is since 23 LG C3

s0fax avatar May 31 '25 12:05 s0fax

I can confirm this, same issue on my device. LG C4 23.20.39 FW webOS 24 / 9.2.2-1805

Youtube Adfree v. 0.3.8

the4anoni avatar May 31 '25 12:05 the4anoni

I'm not aware of the mechanism that newer webOS versions uses to disable the screen off toggle.

fire332 avatar May 31 '25 13:05 fire332

I tried built the current main with changed ID "google.youtube.v4" (in appinfo.json). Then installed these in parallel to version 0.3.8 on my C3.

AppID mod: Button works normal 0.3.8: Button grayed out

Is there a reason that the appid of the original YouTube app was used?

Firmware: 23.20.69 webOS: 9.2.1

s0fax avatar Jun 01 '25 15:06 s0fax

The original app ID is used so you can cast to it.

fire332 avatar Jun 02 '25 11:06 fire332

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

the4anoni avatar Jun 03 '25 13:06 the4anoni

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Is there a chance then to have both Google Cast and screen off option available?

rbaggio108 avatar Jun 03 '25 13:06 rbaggio108

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Is there a chance then to have both Google Cast and screen off option available?

I think I have found workaround. Using LG Input Hook I mapped "Alexa" button on remote to execute this command instead:

luna-send -n 1 'luna://com.webos.settingsservice/setSystemSettings' '{"category":"option","settings":{"screenOff":"on"}}'

Here is another one if that above doesn't work: luna-send-pub -f -n 1 luna://org.webosbrew.hbchannel.service/exec '{"command":"luna-send -n 1 luna://com.webos.service.tvpower/power/turnOffScreen {}"}'

Credits go to user purplehaze915 on Discord for these commands.

Now I can turn off screen via button even with official package name.

the4anoni avatar Jun 13 '25 12:06 the4anoni

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Any chance on this ipk being shared?

Also what's to stop them both being installed, for example use one for casting and other for turning off screen, if you renamed them and used different appIDs

Ye it appears you could do what I suggested, having two apps installed, renamed the AppID anyway and got the screen off feature back, only issue I'm facing is I can't manage it in dev manager, built from another repo anyway, all seems to work, not sure if I can upload here but here if anyone wants it youtube.patchedscreenoff.v4_0.4.1_all.zip

the-redone avatar Jun 17 '25 23:06 the-redone

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Any chance on this ipk being shared?

Also what's to stop them both being installed, for example use one for casting and other for turning off screen, if you renamed them and used different appIDs

Ye it appears you could do what I suggested, having two apps installed, renamed the AppID anyway and got the screen off feature back, only issue I'm facing is I can't manage it in dev manager, built from another repo anyway, all seems to work, not sure if I can upload here but here if anyone wants it youtube.patchedscreenoff.v4_0.4.1_all.zip

Thanks for your .ipk. May I ask where is repo from?

fingers986 avatar Jun 29 '25 16:06 fingers986

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Any chance on this ipk being shared? Also what's to stop them both being installed, for example use one for casting and other for turning off screen, if you renamed them and used different appIDs Ye it appears you could do what I suggested, having two apps installed, renamed the AppID anyway and got the screen off feature back, only issue I'm facing is I can't manage it in dev manager, built from another repo anyway, all seems to work, not sure if I can upload here but here if anyone wants it youtube.patchedscreenoff.v4_0.4.1_all.zip

Thanks for your .ipk. May I ask where is repo from?

It's just a fork of this repo I think, has a few more features and seems to get updated a bit more regularly, whether it's better I'm not sure

https://github.com/NicholasBly/youtube-webos

the-redone avatar Jun 29 '25 19:06 the-redone

I think this is done on the basis of the AppId

I can confirm this, I made my own build with own AppID and now I can turn off my screen :) Personally I don't care about Google Cast, so this solution does trick for me.

Any chance on this ipk being shared? Also what's to stop them both being installed, for example use one for casting and other for turning off screen, if you renamed them and used different appIDs Ye it appears you could do what I suggested, having two apps installed, renamed the AppID anyway and got the screen off feature back, only issue I'm facing is I can't manage it in dev manager, built from another repo anyway, all seems to work, not sure if I can upload here but here if anyone wants it youtube.patchedscreenoff.v4_0.4.1_all.zip

Thanks for your .ipk. May I ask where is repo from?

It's just a fork of this repo I think, has a few more features and seems to get updated a bit more regularly, whether it's better I'm not sure

https://github.com/NicholasBly/youtube-webos

Thanh you for sharing

fingers986 avatar Jul 01 '25 06:07 fingers986

root@LGwebOSTV:~# cat /var/lib/webosbrew/init.d/99-ytdark
#!/usr/bin/python3

import os
import re
import sys

PROCESS_NAME       = "SettingsService"
TARGET_STRING      = b"youtube.leanback.v4"
REPLACEMENT_STRING = b"xxxxxxxxxxxxxxxxxxx"

spid = int(os.popen("pidof "+PROCESS_NAME).read())
memfile = open("/proc/%d/mem" % spid, "wb+")

for mapping in open("/proc/%d/maps" % spid, "r").readlines():
    start_addr, end_addr, perms = re.match(r"([0-9a-f]+)\-([0-9a-f]+)\s(\S+)\s", mapping).groups()
    if not perms.startswith("r"):
        continue
    start_addr = int(start_addr, 16)
    end_addr = int(end_addr, 16)
    map_size = end_addr - start_addr

    memfile.seek(start_addr)
    buf = memfile.read(map_size)

    if TARGET_STRING not in buf:
        continue
    idx = 0
    while True:
        idx = buf.find(TARGET_STRING, idx)
        if idx < 0:
            break
        addr = start_addr + idx
        idx += len(TARGET_STRING)
        memfile.seek(addr)
        memfile.write(REPLACEMENT_STRING)

This works, but is bruteforce. SettingsService binary itself probably reads out the value from some private settings provider elsewhere, may have luna api though nothing seems public. This one looks hopeful:

root@LGwebOSTV:/usr/sbin# strings performer |grep youtube
policy_tvstatus_get_youtube_app_info
policy_tvstatus_set_youtube_app_id
youtube
POLICY_TVSTATUS {"youtube_app_id":"%s"}
POLICY_TVSTATUS {"_g_youtube_app_info":"%s"}

But no idea how to poke this thing (ie set our own youtube app id).

upalse avatar Jul 02 '25 05:07 upalse