iina / iina

The modern video player for macOS.
https://iina.io
GNU General Public License v3.0
37.99k stars 2.56k forks source link

Doesn't work with Rectangle #3712

Open bnaman50 opened 2 years ago

bnaman50 commented 2 years ago

Hello,

I use Rectangle to resize my windows in Left/Right half or for FullScreen option (Rectangle terminology, different from original Maximise option). However, rectangle shortcuts don't work properly with it. I am not sure if this is an issue with Rectangle or IINA. I am just mentioning here to bring it to your notice. Hope you can figure it out.

Thanks, Naman

System and IINA version:

Steps to reproduce: Install Rectangle and IINA and try to set IINA window to left/right/fullscreen mode.

How often does this happen? Always

bnaman50 commented 2 years ago

Here is the response I got from Rectangle devs. Seems like an issue with IINA from their perspective.

bnaman50 commented 2 years ago

Here is a comparison with VLC, especially with the FullScreen option.

Here is how it is with VLC -- VLC

where as for IINA, there is empty space at the right -- IINA

Sometimes, this space in on the bottom depending on the video resolution (I guess). It would be awesome if you could fix it?

Thanks, Naman

svobs commented 2 years ago

I downloaded and installed Rectangle 0.56 on MacOS 12.3.1, and it seems to work perfectly with IINA.

Unfortunately I don't have easy access to a device running MacOS Mojave, so that makes it hard to test.

As far as I know, there's never been a 0.49 release of IINA. Did you mean that's the version of Rectangle you're using? If so, can you confirm you're running the latest (1.2.0) version of IINA?

bnaman50 commented 2 years ago

Hey @svobs ,

Thanks for your response.

I think I made a mistake with the version number. As you mentioned, I am also using the latest IINA build (as per brew cask).

image

Also, my rectangle version is 0.56.

image

However, the issue still persists. I'll check it on my friends mac who has latest mac version and see if this issue if specific to Mojave.

Thanks, Naman

bnaman50 commented 2 years ago

Hey @svobs,

I asked my friend who is also on MacOS 12.3.1. And he said, he also faced the same issue. Could you please check it out?

P.S. - I am not sure if he also uses Rectangle app or some other app. But this seems to be something related to IINA as per me. Thanks, Naman

bnaman50 commented 2 years ago

Hey @svobs ,

Here is a quick video I made showing the issue in IINA compared to VLC.

P.S. - The slight gap in the bottom you might notice in case of VLC is because of control strip which somehow did not get recorded in Quick Time, not sure why though. Whereas, this gap is huge in case of IINA even with no separate control strip.

svobs commented 2 years ago

I played the video but it's missing parts of the top and bottom so it's not clear where the borders of your screen are. I see that the video you were trying to play was 1280x720. Can you tell me the dimensions (width & height in pixels) of your screen at its current resolution? Go to the Apple menu > About This Mac > System Report, then find Hardware > Graphics/Displays, and just copy/paste whatever you find under "Displays" so it includes info like screen mirroring if multiple displays, etc.

bnaman50 commented 2 years ago

Hey @svobs ,

Thanks for your response. Here are the details you asked me to provide -

Displays:
Colour LCD:
  Display Type: Built-In Retina LCD
  Resolution:   2880x1800 Retina
  Framebuffer Depth:    24-Bit Colour (ARGB8888)
  Main Display: Yes
  Mirror:   Off
  Online:   Yes
  Rotation: Supported
  Automatically Adjust Brightness:  No

P.S. - With regards to the video, I am not sure how or why it did not capture the borders since I used the screen recording feature on Quick Time. Honestly, I am not that comfortable recording/editing videos at all.

Thanks, Naman

svobs commented 2 years ago

Hey @bnaman50,

I dug into this some more, and I should admit that I'm not one of the main contributors to IINA, but I reviewed the relevant code and it's calling the standard Apple APIs in a very straightforward way. I also dug into the Rectangle source code (did you know that you can Option-click on the Rectangle menu and there is an option, "View Logging", which will print the sizes it's calculating and sending to IINA? I played around with that with VLC and with IINA, for the most part I only saw a 1-pixel difference in width between the two. (Vertical was much less for IINA because VLC does not hide the title bar or its playback slider). However, occasionally for me VLC would display the behavior you were saying that IINA was displaying - sometimes it stopped short of filling the width of the screen by 15 pixels or so!

I dug into the VLC source code a bit, and it's using QT for its UI, so that's likely calling some pretty old APIs. My conclusion is that Apple's newer APIs are not well-tested for older versions of MacOS and ideally there should be some fallback to the older APIs. But given I can't reproduce the issue anyway, I'm afraid I'm going to have to throw this fish back in the water. Maybe someone else can figure it out.

Matt

Aaron-Rumpler commented 2 years ago

From my experimentation, VLC looks to keep the width and simply change the height to match the aspect ratio (this can most easily be seen by snapping to the top and bottom halves, where VLC isn't contained within the area you try to snap it to), whereas IINA seems to stay within the bounds of what Rectangle tries to resize it to, decreasing the width or height as appropriate to match the aspect ratio.

bnaman50 commented 2 years ago

Hey @Aaron-Rumpler ,

Would it be possible to provide us an option to mimic the vlc behaviour? I generally use the FullScreen option to watch a video and having empty space in the bottom is quite jarring and is the only thing stopping me to make the switch.

Thanks, Naman

Aaron-Rumpler commented 2 years ago

I'm not a developer on IINA, I just came here from rxhanson/Rectangle#809.

svobs commented 2 years ago

@bnaman50 As luck would have it, I think I found a clue. I use BetterTouchTool on my laptop with 2 external displays. I have "3 finger swipe up" mapped to "Maximize Window". And when I use that gesture, it doesn't smoothly grow to full size but instead rapidly cycles between small and large a couple times before getting to the correct size. I added some logging and I see windowWillResize() getting called 5 times:

2022-05-17 21:04:34.128980-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(2511.0, 1415.0)
2022-05-17 21:04:34.155520-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(256.0, 144.0)
2022-05-17 21:04:34.212346-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(2511.0, 1415.0)
2022-05-17 21:04:34.246117-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(256.0, 144.0)
2022-05-17 21:04:34.269024-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(2511.0, 1415.0)

But I've also enabled System Preferences > Dock > Double click a window's title bar to zoom. If I double-click on the titlebar of the window, the animation is smooth and I only see 1 call:

2022-05-17 21:06:18.377491-0700 IINA[14309:1643472] windowWillResize aspectRatio=(426.0, 240.0) frameSize=(2512.0, 1415.0)

Also, one of my displays is an ultra-wide, which means at maximize there will extra horizontal space. When I use the BetterTouchTool maximize, IINA always moves the window to the far left of the screen. Whereas the title bar maximize seems to retain the location well enough.

I think I can work off of this. Possibly there is logic in some other place which is getting activated. I've got a few other things going on right now but should get to this soon.