Skip to content
Snippets Groups Projects

Compact Overlay: auto aspect ratio, remember size, auto switch (Issue #278)

3 unresolved threads

Implemented these features (Issue #278):

  • Open the compact overlay window with the correct aspect ratio
  • Save the size of the compact overlay window, so I don’t have to resize it every time I switch
  • Auto toggle to compact overlay when the app window loses focus, so I can switch to another app while I still watching a video very fast

Also, fixed issue #255

Edited by Massimiliano Cristarella

Merge request reports

Approval is optional
Merge blocked: 2 checks failed
Merge conflicts must be resolved.
Merge request must be rebased, because a fast-forward merge is not possible.

Merge details

  • The source branch is 93 commits behind the target branch.
  • 6 commits will be added to master.
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Martin Finkel
  • added 2 commits

    • 307aa87f - Auto switch to PiP now visible only where it's supported
    • 1b4e2fa6 - Constants put in constant variables

    Compare with previous version

  • Massimiliano Cristarella resolved all discussions

    resolved all discussions

  • added 1 commit

    Compare with previous version

  • Martin Finkel
  • 347 int currVideoWidth = 16;
    348 int currVideoHeight = 9;
    349 if (CurrentVideo != null)
    350 {
    351 currVideoWidth = (int)CurrentVideo.Width;
    352 currVideoHeight = (int)CurrentVideo.Height;
    353 }
    354
    355 //Calculate aspect ratio
    356 int gcd = GCD(currVideoWidth, currVideoHeight);
    357 int ratioWidth = currVideoWidth / gcd;
    358 int ratioHeight = currVideoHeight / gcd;
    359
    360 int expectedHeight = (desideredWidth / ratioWidth) * ratioHeight;
    361
    362 expectedHeight = expectedHeight < COMPACT_OVERLAY_MIN_HEIGHT ? COMPACT_OVERLAY_MIN_HEIGHT : expectedHeight;
    • This line isn't really used, as expectedHeight is always reset on the next line. Is that behavior intended?

    • Sometimes (depending on the video aspect ratio and the desidered width of the compact overlay window) the expected height is below the minimum supported height or above the maximum supported height, so with lines 362 and 363 I do these checks and then I calculate again the expected width with those limits in mind. I did plenty of tests of this code before so it's all intended behavior.

    • Please register or sign in to reply
  • Martin Finkel
  • 336 338 {
    337 339 PlayerControlVisibilityExtendCurrentRequested?.Invoke(this, EventArgs.Empty);
    338 340 }
    341
    342 public Size CalculateCompactOverlaySize(int desideredWidth)
    343 {
    344 const int COMPACT_OVERLAY_MIN_HEIGHT = 181;
    345 const int COMPACT_OVERLAY_MAX_HEIGHT = 500;
    346
    347 int currVideoWidth = 16;
    348 int currVideoHeight = 9;
  • added 1 commit

    • ab60827f - Switched from int to double variables when calculating sizes for more accuracy

    Compare with previous version

  • So, there are any other issues? I personally think it's ready

  • 236
    237 return _autoSwitchToCompactOverlayPiP;
    238 }
    239 set
    240 {
    241 SetProperty(ref _autoSwitchToCompactOverlayPiP, value);
    242 ApplicationSettingsHelper.SaveSettingsValue(nameof(AutoSwitchToCompactOverlayPiP), value);
    243 }
    244 }
    245
    246 public int SavedCompactOverlayPiPWidth
    247 {
    248 get
    249 {
    250 var savedWidth = ApplicationSettingsHelper.ReadSettingsValue(nameof(SavedCompactOverlayPiPWidth));
    251 _savedCompactOverlayPiPWidth = (int)(savedWidth ?? 400);
  • Auto toggle to compact overlay when the app window loses focus, so I can switch to another app while I still watching a video very fast

    What's the default for this feature? opt-in or opt-out? Why?

  • It's off by default as we discussed in issue #278, now I'm putting that default value in a constant too.

  • added 1 commit

    • 0b4f97cc - More constants put in constant variables

    Compare with previous version

  • Please register or sign in to reply
    Loading