Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[videoplayer] Go to Chapter Start for "Previous Chapter" Past Grace Period #24066

Merged
merged 1 commit into from Nov 19, 2023

Conversation

CrystalP
Copy link
Contributor

@CrystalP CrystalP commented Nov 6, 2023

Description

Modify VP actions when a backwards chapter skip is requested ("previous chapter", "previous chapter or big step back" actions)

Skip requested within 5 seconds of chapter start: go to the beginning of the previous chapter (same as current behavior)
Skip requested past 5 seconds from chapter start: go to the beginning of the current chapter.

(5 seconds taken from similar code used for scenes, could be adjusted)

Motivation and context

I find the current behavior of going to the previous chapter regardless of the playing position in the current chapter unintuitive, even though it's technically correct.

For example in the situation below, skipping to previous chapter goes to the very beginning position 00:00, even though playback is almost at the end of chapter 2.
image

In addition, I didn't find a way to go back to the start of the currently playing chapter.

I think it's a nice improvement to extend the previous chapter action, and to make it go back to the start of the current chapter after a certain time has passed in the current chapter. It avoids the need to map another button on a remote or on keyboard for a "back to chapter start" function.

How has this been tested?

Windows, but platform is not relevant.
Files with / without chapters, skip backwards before 5 seconds of playback

What is the effect on users?

More intuitive behavior for chapter backwards skip / Down key for large step or chapter back.

Screenshots (if appropriate):

Initial situation:
image

Current master: "previous chapter"goes to the beginning of the file
image

With PR, "previous chapter" goes to start of the current chapter:
image
An additional "previous chapter" within 5 seconds of chapter start goes to the previous chapter (=beginning of the file here).
image

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@CrystalP CrystalP added Type: Improvement non-breaking change which improves existing functionality Component: Players For changed player parts within "./xbmc/cores" v21 Omega labels Nov 6, 2023
@CrystalP CrystalP added this to the Omega 21.0 Beta 2 milestone Nov 6, 2023
@CrystalP CrystalP changed the title [videoplayer] Go to Chapter Start When Skipping to Previous Chapter Past Grace Period [videoplayer] Go to Chapter Start for "Previous Chapter" Past Grace Period Nov 6, 2023
@thexai
Copy link
Member

thexai commented Nov 18, 2023

I like the change and I think improves usability as users surely expect skip to previous chapter allows skip to previous chapter mark. Is not intuitive skip two chapters mark back (although is technically correct).

But current change in PR only changes this for keyboard actions up / down and not if is used OSD playback menu. To maintain coherence same changes should be applied here:

m_messenger.Put(std::make_shared<CDVDMsgPlayerSeekChapter>(GetChapter() - 1));

and here

m_messenger.Put(std::make_shared<CDVDMsgPlayerSeekChapter>(GetChapter() - 1));

This allows OSD buttons has same behavior.

skip

@CrystalP
Copy link
Contributor Author

Good catch. Reimplemented as function GetPreviousChapter() used by the 3 callers.
Takes care of keyboard, OSD and remotes.

Tried testing the if (pMenus->IsInMenu()) branch of OnAction, but didn't find a menu that allows the condition if (pMenus->CanSeek() && GetChapterCount() > 0 && GetChapter() > 0)
A DVD returns false in CanSeek and the BR I had on hand returns CanSeek=true, GetChapterCount=1 but GetChapter=0. I think the change of the PR still makes sense for that case though.

@@ -323,6 +323,7 @@ class CVideoPlayer : public IPlayer, public CThread, public IVideoPlayer,
int GetChapter() const override;
void GetChapterName(std::string& strChapterName, int chapterIdx = -1) const override;
int64_t GetChapterPos(int chapterIdx = -1) const override;
int GetPreviousChapter();
Copy link
Member

@thexai thexai Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move to line 372 after void SetUpdateStreamDetails(); as all others are override and usually overrides are enumerated first (anyway is only personal preference).

Copy link
Contributor Author

@CrystalP CrystalP Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure. makes sense though, Also made it protected, we tend to make too much stuff public for no reason.

After a grace delay, a backwards chapter skip goes to the beginning of the current chapter instead of skipping to the beginning of the previous chapter.
@CrystalP CrystalP merged commit e7d78c5 into xbmc:master Nov 19, 2023
2 checks passed
@CrystalP CrystalP deleted the backwards-skip branch November 19, 2023 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Players For changed player parts within "./xbmc/cores" Type: Improvement non-breaking change which improves existing functionality v21 Omega
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants