Youtube Watcher v.3 - a simple Youtube Turn-off Lights script

Post your working scripts, libraries and tools
gtaking
Posts: 4
Joined: 12 May 2016, 00:26
Contact:

Youtube Watcher v.3 - a simple Youtube Turn-off Lights script

12 Sep 2017, 17:25

i dont know whether it is the same for all the countries but Youtube changed its design altogether just after summer. i remember some of the pages were like this but now all of them are!

i was using simple version of this script (v.1) for the old site but now video frame changes size like crazy

tough job as it is, i managed to make my ahk generated window act like youtube video div manually xD maybe a brute-force-like video frame boundary pixel search would be a global solution but here it is...


usage

- open your youtube video in firefox, chrome, opera or vivaldi
- turn on youtube theater mode
- adjust size and screen placement of the video window
- open the script

Image

makes whole screen black while we only see the youtube video frame
only works for firefox, chrome, opera & vivaldi
when there is no menu and bookmarks toolbar in any browser
opera has no sidebar
vivaldi has left panel

when on different application (working / playing) you can use video timeskip keys (arrow keys) on firefox
they will be sent to browser

double click on black areas to close

works on multi monitors

works on win10

to start the script with a key combination anytime, you can write an always-working-script that resides in your windows Startup folder


limitations

fullscreen black background is optional, can be disabled from system tray menu

remote controls (arrow keys 5 sec video skip) only works on firefox (LoL firefox ftw)
ControlSend doesnt work on any chrome-like browser ahk_class Chrome_WidgetWin_1 even though we send to right control Chrome_RenderWidgetHostHWND1 (idk why)

( therefore if you do not want these 2 features like ever, you may just delete related lines from the code )

window you want script to work on should be active (on top of everything)
or it works (or returns error) for the active youtube window

script is designed only for standard browser window
any action which will change the browser window border sizes (maximized or full screen affects title bar size...) will cause script to not work properly


about fullscreen

script isnt compatible with any kind of fullscreen unless you manually expand window to whole screen in theater mode.

even if we understand the browser is filling whole screen and even if we can get current video start coordinate with brute force search (while youtube doesnt change that top color) to get some of the init values; it seems we need some new vars and if nodes because of the system non-visible area rule change that came with snapping edges on maximized / fullscreen. apparently we need to double the whole work and code lines to have this feature. therefore fullscreen support cant be added :)

20" and below monitor users may not even need the script since fullscreen video mode may cover their needs. they may never need black area on their screen.

i dont know about anyone but 21"+ monitors provide so large picture that from the day i bought i cant watch any video on fullscreen unless im meters away. i cant use fullscreen, i need blackness on my desktop when im writing, therefore the script is shaped around that fact.


numbers

since i dont think everyone would prefer using a shortcut for the job, numbers ive found can be used in any kind of language you will work on to generate more cinematic-mode-like view (inside browser page, with button on browser screen...) but i guess there are much easier ways to get page element coordinates on different platforms xD

differences on client window sizes or toolbar placements on other browsers directly effect this kind of tool so i only made it for my usage.

you may edit the code to get no background, no input listening etc... you may edit numbers to adjust it to your browsers but you need a solid plan and tools that will make your job much easier. still takes much time, i dont encourage you to do it.

right now its working perfect, hopefully youtube doesnt change those video size rules again :)

cheers


[Edit: Updated to v.3, now supports different browsers]

Code: [Select all] [Expand] [Download] (youtube watcher v.3.ahk)GeSHi © Codebox Plus

Last edited by gtaking on 16 Sep 2017, 11:22, edited 1 time in total.
User avatar
RUNIE
Posts: 227
Joined: 03 May 2014, 14:50
GitHub: Run1e

Re: Youtube Watcher v.2 - a simple Youtube Turn-off Lights script

12 Sep 2017, 19:21

kinda cool, however youtube has a dark theme built in. Also there's loads of plugins that do the same thing
User avatar
Exaskryz
Posts: 2218
Joined: 17 Oct 2015, 20:28

Re: Youtube Watcher v.2 - a simple Youtube Turn-off Lights script

12 Sep 2017, 23:04

As RUNIE mentions, there are other solutions that might be more reliable for YouTube specifically.

I could see utility in this particular script if it wasn't limited to Firefox only, and especially so if it wasn't limited to YouTube only. I'm not sure how many users don't just full screen their videos and prefer to blacken the rest of the screen, but I imagine if you could get this generalized to work on other sites, it would be able to stand out.

My idea having read about this is if you could take the black border that fills the screen, and then adjust the width of the top, left, right, and bottom borders by dragging on the inside rectangle and aligning it to the video yourself. Of course, a way to automate that would be ideal, but I don't know if there is a good way to do that besides bruteforcing all the possible player sizes and positions across the popular video websites - and somehow being mindful of a browser's UI - and being able to keep up to date when UIs are changed on websites and browsers alike. Being able to save settings though would be a great compromise for that - let uses make a profile with their own specified widths and heights to each of the borders.
garry
Posts: 920
Joined: 22 Dec 2013, 12:50

Re: Youtube Watcher v.2 - a simple Youtube Turn-off Lights script

14 Sep 2017, 16:36

@gtaking , thank you works fine

can I modify :
- with hotkey toggle : close or add black background window
- didn't see how to modify video-height
- can't see tray

I watched youtube video in AHK-GUI ActiveX , but no more works
( ' Flash embedded videos are no more supported ' )
or watch youtube video in fullscreen mode

another example , start video from different sites and click Button 'CHECK-XY' and then click 'left top / right bottom' to get black background around the video .

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

gtaking
Posts: 4
Joined: 12 May 2016, 00:26
Contact:

Re: Youtube Watcher v.3 - a simple Youtube Turn-off Lights script

16 Sep 2017, 11:28

@RUNIE
ty.

its just that my 30 y.o. eyes cant handle any nonsense text / visual of any form anymore. pure black ftw. this script born from personal preferences (as the script file is portable across different machines, works after drive format...)


@Exaskryz
thank you for nice feedback. it seems with these constraints there isnt many options one can choose to do.

after crazy css3 update i got the feeling that in the future browsers will transform into a new kind of graphic ui platform in between simple os window and high end gpu graphic interface. and if thats whats gonna happen, we wont be getting any window control out of that.

in this case next step would be to find a simple rectangle edge finder algorithm from the sea of image processing algorithms. simplifying a known solution shouldnt be that hard but im not the guy ill pass. many sites use same solid bg color for edges near vid frame, should be relatively easy tho.

a gui.ahk asking toolbar preferences and saving into .ini idea was cool i admit it. but 3 files or 2 files + visible button or browser config file reader :D would be too complicated for my intent to keep things simplest. especially when forum users who can use that file arrangement are the same guys who can change initial values at the beginning of the code easily, no?

if i listen you guys it will transform into a real million-download release. this forum is good.

as for full browser support, ty for reminding me im the one who has to do it right now xD its been added


@garry
you can modify in any way you want bro, in any way it fit your needs

didnt add those modifications because they werent too common:

- a hotkey for AddingBlackBack: didnt really want to confuse people with a crazy key combo i found
- its automatic, related to browser-height in youtube theater mode (if ive understood your question right)
- thats a thing in win10 :) send-gui-to-back worked but taskbar missed it in the first time. you have to wait and send your gui to back again for workaround (duplicate send2back line and sleep between them). or we could activate tray. oh wait... =.=^ ok, thats been added in v.3 also.
gtaking
Posts: 4
Joined: 12 May 2016, 00:26
Contact:

Re: Youtube Watcher v.3 - a simple Youtube Turn-off Lights script

16 Sep 2017, 11:32

[v.3 is ready]

fixes (just when i thought this simple piece of code was perfect xD)

- columns were overflowing due to very small window
- when video stops getting larger top black space on render area was vanishing but our video frame didnt
- on script start and on tray menu usage black background was getting focus, hiding everything


added features (as always, adjusted to my toolbar preferences xD)

- Chrome Opera Vivaldi
- Safari still doesnt support new youtube xD

Return to “Scripts and Functions”

Who is online

Users browsing this forum: just me and 12 guests