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

Add chapter markings to video player slider #3745

Merged
merged 14 commits into from
Oct 6, 2022

Conversation

Viperinius
Copy link
Contributor

@Viperinius Viperinius commented Jul 3, 2022

Motivation
I wanted to be able to see when movie chapters start without moving the slider bubble through the whole timeline. Also inspired by this feature request.

Changes

  • Added container for chapter marks to the video OSD page.
  • Added functions to add and calculate the icon positions.
  • Those calculations are done in updateValues of the slider.
  • The markings are shown or hidden together with / the same way as the slider bubble.
  • When the chapter mark has been passed / watched, the colour changes to blue.
  • The icon is set with CSS and can thus be easily customised by the user.
  • Customisation is further possible by being able to use different icons depending on the chapter name (e. g. to use a special icon if the chapter name is something like "intro").

What it looks like
(shown with the Jungle Book from the demo server)
image

Possible next steps
The customisation "per-chapter" could define some default CSS values to use different icons for common chapter "types", e.g.:

.sliderChapterMark.scm-intro::before {
    content: "\e8da"; /* theaters */
}
.sliderChapterMark.scm-credits::before {
    content: "\ef42"; /* article */
}

Viperinius and others added 6 commits June 26, 2022 01:10
These labels show the start of each chapter when interacting with the
slider the same way that activates the slider bubble. They follow the
same color scheme as the slider (watched chapters turn blue).

Inspired by https://features.jellyfin.org/posts/397/chapter-markers-in-timeline
Allows easier customisation of what icon should be displayed.
In order to use different icons depending on the chapter name, the name
is provided as a class with the prefix scm-.
src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
Comment on lines 145 to 151
if (!bubbleTrackRect.width || !chapterMarkRect.width) {
// width is not set, most probably because the OSD is currently hidden
return;
}

let chapterMarkPos = (bubbleTrackRect.width * valueChapterMark / 100) - chapterMarkRect.width / 2;
chapterMarkPos = Math.min(Math.max(chapterMarkPos, - chapterMarkRect.width / 2), bubbleTrackRect.width - chapterMarkRect.width / 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that's why you did showOsd in getChapterFractions.
What about resizing?

Copy link
Contributor Author

@Viperinius Viperinius Jul 5, 2022

Choose a reason for hiding this comment

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

Well, the early return if the width is 0 was just meant to prevent recalculating the marker positions even if the OSD is hidden. This lead to noticeable jumps of the markers when the OSD is shown again and the width is correct again.

About the resizing: Could you elaborate?
Do you mean if the positioning can handle a resize during playback? If so, then yes, as long as updateValues is continued to be called.

src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Jul 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@thornbill thornbill added the feature New feature or request label Jul 11, 2022
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Sep 13, 2022
@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Sep 17, 2022
Copy link
Member

@thornbill thornbill left a comment

Choose a reason for hiding this comment

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

First off this is a really cool feature! 🎉

I did not finish reviewing the emby-slider.js changes, because I'm not a fan of how the hiding works currently. I think the markers should just be lines that show up inline with the slider that are just visible anytime the slider is shown. The large icons make me think I should be able to click them, and they are kind intrusive and difficult to get to display.

src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
src/controllers/playback/video/index.js Outdated Show resolved Hide resolved
@Viperinius
Copy link
Contributor Author

I think the markers should just be lines that show up inline with the slider that are just visible anytime the slider is shown. The large icons make me think I should be able to click them, and they are kind intrusive and difficult to get to display.

Yeah, I get that, especially being able to click them. I quickly experimented with the CSS a bit and got this:
image
Is this what you had in mind?

(As these are just CSS changes, the "icon way" can still be used with custom server CSS.)

@thornbill
Copy link
Member

That looks great!

Now, the markers are displayed as ticks instead of icons above the slider
@Viperinius
Copy link
Contributor Author

Alright, I added the changed CSS.

Concerning the hiding / positioning, I am open to any suggestions to improve it

@thornbill
Copy link
Member

The changes look great!

I think I would just leave the markers visible when the OSD is shown instead of requiring hover.

(Does not require hovering over the slider anymore.)
@Viperinius
Copy link
Contributor Author

Good suggestion, saves a bit of code... and done :)

Copy link
Member

@thornbill thornbill left a comment

Choose a reason for hiding this comment

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

This is looking great! I just had a couple naming suggestions.

src/elements/emby-slider/emby-slider.js Outdated Show resolved Hide resolved
src/elements/emby-slider/emby-slider.js Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Oct 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@thornbill thornbill merged commit 1ac326d into jellyfin:master Oct 6, 2022
@Viperinius Viperinius deleted the chapter-markers branch October 6, 2022 15:52
@DoTheSneedful
Copy link

I really want this feature but I noticed it's not in any release since being merged to master over a year ago, certainly not available in the 10.8 version I'm currently using. I am not familiar with Jellyfin's process, so I hope it's not too much trouble to ask what the ETA for something like this is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants