Envek / obs-studio-node-example

Learn how to use OBS Studio from your Electron app for screen video recording
GNU General Public License v2.0
105 stars 19 forks source link

Added preview window #6

Closed hrueger closed 4 years ago

hrueger commented 4 years ago

OK, I fixed issue 1 by making the preview window a child window of the main window. That way it is automatically closed once the main window is closed. And I fixed 2 and 3.

However, I wasn't able to get the scaling working, it always cut off some parts (the taskbar) and I didn't want to just add a random value because this can't be the correct way.

Envek commented 4 years ago

Thank you!

Envek commented 4 years ago

Cutted pixels was caused by window title bar and borders being accounted in window width and height. Fixed this by specifying useContentSize window option. See https://github.com/Envek/obs-studio-node-example/commit/64c2f861e732d27946c523591a6ffa31185b77bf

Envek commented 4 years ago

Also I moved preview right into main window (with some dirty hacks) in https://github.com/Envek/obs-studio-node-example/commit/5149f39935c5b3c55bc31502e832d8c86da8fd88

@hrueger, can you please check how it works on your machine? That there is no scaling issues or similar?

hrueger commented 4 years ago

It's working great @Envek ! On a scaled screen it works, too. I just found two problems:

  1. When I move the window from a scaled to a secondary non-scaled screen, the preview overflows the rest of the window. But I don't know how to detect when the scaling changed... problem_01

  2. I have some small black bars around my screen in the preview window, as shown here: problem_02

Envek commented 4 years ago

Oh, nice, thank you very much for testing it!

  1. Created separate issue about scaling.

  2. I have some small black bars around my screen in the preview window

    I think that's because preview window is a bit wider than video itself and OBS fills it with some color. I've seen a function to change this background color somewhere in obs-studio-node.

Envek commented 4 years ago

Fixed in https://github.com/Envek/obs-studio-node-example/commit/30925a19764c777085c23096bc51e670ff6cf5b8