-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
feat: Chapter additions #466
feat: Chapter additions #466
Conversation
@jarnedemeulemeester I think this is ready 😄 |
adaad0f
to
d921c83
Compare
Rebased with main PiP changes |
1d1d806
to
ffbc02d
Compare
First version crashed when skipping an episode, because it tried to load the chapters too early. |
Thanks for doing this. I don't know how helpful it can be but there is this player which also uses exoplayer and has chapter support. |
That's certainly better than nothing. |
Seems like a lot of work... He pulls the chapters from the media info he gets from FFmpeg library. I think the MPV player is mature enough to be preferred over ExoPlayer and thus it's not really a big deal. |
Oops, I didn't mean to merge this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Natanel-Shitrit
Thanks a lot for implementing this!
I do have a few suggestions.
I see you are using mpv to get the chapters from the item and that's the reason why it is only available when using mpv. But apparently Jellyfin already extracts the chapters from items as well.
You should be able to use the API to retrieve the chapters and display them in both Exoplayer and mpv 😄
It seems to be part of the BaseItem
so no need to call an extra API endpoint. You probably only need to add a few properties to some Findroid*
classes and maybe create a new FindroidChapter
class or something like that.
"Chapters": [
{
"StartPositionTicks": 0,
"Name": "string",
"ImagePath": "string",
"ImageDateModified": "2019-08-24T14:15:22Z",
"ImageTag": "string"
},
]
I think we can ignore the Image part of the chapter for now since this has to be manually enabled for each library anyway.
Also I recently merged a PR which add 2x playback speed on long press. That obviously conflicts with the skipping to next chapter on long press. So we have to change one or the other, but I don't really know which one yet and to what action.
I already mentioned this in the discord, but I think using the next/previous episode buttons for chapters would be a good option, since it feels like it's doing a similar thing. Another option might be the long-press on the fast forward button. I think long pressing the right of the screen is a very appropriate gesture for 2x so I'd prefer leaving that unchanged |
@jarnedemeulemeester Thanks for the detailed response! That's a nice surprise that Jellyfin already extracts the chapter info, this will make it easier for compatibility since it will not rely on the MPV functionality. I'll try and Implement a POC for the chapter extraction from Jellyfin. Regarding the skip chapter gesture I think giving the user the ability to customize it will be the best approach here - obviously this will take time and effort but I think the best way to implement this is to create a settings page for player gestures - list of default gestures, and give the ability to remove / modify / add from that list. Each gestures can be represented like this:
I'll open a feature request and try to implement this too. But probably only after this will be merged since it will probably something bigger. |
8be5fec
to
90099b7
Compare
@garvongithub @jarnedemeulemeester Now both players are supported! |
TODO:
|
- Missing comma - Unused import - Comment block
b8e7b87
to
b3e00fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work implementing the chapters from the Jellyfin API.
I just tested it out but there are still a few issues:
- App immediately crashes on launch because of database changes. A database version bump and automigration need to be added. But when I tried this it still crashed (I'm still investigating this)
- When seeking to chapters (using the long press gesture) it would display the name of the chapter I came from instead of the one I seeked to. This only happens when using mpv and seems to be a race condition issue. I'm working on a fix which would return the chapter when seeking to it so we always display the correct name.
- Maybe we should change the name of this PR and in the app to something more generic like "chapters" and not specific "MKV chapters" because this feature will also work for chapters in mp4 files.
Great work so far! I don't mind fixing up the last few issues 🙂
Thanks for testing! Feel free to fix / change anything you see fit! if you want - I can tackle the bugs on the weekend but I guess you can do that much faster and better than me😅 |
… than 5 seconds past start of chapter
The chapters feature also works for MP4 files so just make it generic
Still need to fix the database issue 😅 |
@jarnedemeulemeester I think I fixed it? |
@Natanel-Shitrit Yep, that fixed it! |
I will do one final check of everything. If nothing goes wrong I will merge it! |
c39bdce
into
jarnedemeulemeester:main
I think the only thing we forgot is to add the new feature in the |
* Add chapter markers and "skip chapter" on long press * Fix linting problems - Missing comma - Unused import - Comment block * Add preferences options * Drop chapter support for ExoPlayer * Fix linting * Remove Trailing spaces * Remove TODO from marker color * Move code to function * Optimize imports * Fix crash on episode skip * Disable player control view animation * Avoid crash when there are no chapters for media item * Skip to next episode when skipping last chapter * Load chapters from Jellyfin API instead of MPV Player * Remove chapter gesture * Fix build * Fix linting * Fix linting * Support chapters with offline media * Remove debug print * Add chapter skipping * Remove trailing spaces * fix(chapters): display correct chapter while seeking * refactor: faster and cleaner `getCurrentChapterIndex` * refactor: seek to start of current chapter if player position is more than 5 seconds past start of chapter * refactor: change "Matroska chapters" to just "Chapters" The chapters feature also works for MP4 files so just make it generic * Bump database version * Add auto-migration for database version bump * Save database schema * chore: clean up --------- Co-authored-by: Jarne Demeulemeester <[email protected]>
Summary
PR Additions:
Issues
TODO:
Implement chapter extraction from ExoPlayer. (StackOverflow)Dropped ExoPlayer because I couldn't find any way to get the metadata 😢ExoPlayer now supported, thanks @jarnedemeulemeester for pointing out Jellyfin API chapter info!
Implement app preference for turning off / on markers / gesture.Done.
Use system "Material You" theme for markers.This is probably fine as white (timebar contrast color)
Fix code reuse inPlayerGestureHelper.kt
.Would be better to refactor in a new PR with other changes to the same file.
Add chapter name in player title.I think I'll keep it simple without changing the title for now.
Credits: