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

Fix audio/subtitle index reset when switching episodes #6112

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

viown
Copy link
Member

@viown viown commented Sep 24, 2024

Based on the comment from here #5998 (comment).

Fixes audio/subtitle track not being set according to the UI's selected tracks.

I've tested this on a variety of different media with "Set audio/subtitle track based on previous item" on and off and it seems to work as expected, but any further testing would be appreciated.

Changes
Set audioStreamIndex & subtitleStreamIndex to match player.

Issues
Fixes #3994
Fixes #5873

@viown viown requested a review from a team as a code owner September 24, 2024 17:39
@viown viown force-pushed the fix-incorrect-index-on-next-track branch from eb0d790 to 3812791 Compare September 24, 2024 17:40
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
@viown viown force-pushed the fix-incorrect-index-on-next-track branch from 72787e1 to d671da9 Compare September 25, 2024 13:34
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.

src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
@viown viown marked this pull request as draft September 25, 2024 13:37
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.

@viown viown marked this pull request as ready for review September 25, 2024 14:22
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Outdated Show resolved Hide resolved
src/components/playback/playbackmanager.js Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.

src/components/playback/playbackmanager.js Show resolved Hide resolved
@dmitrylyzo dmitrylyzo added the bug Something isn't working label Sep 26, 2024
@dmitrylyzo dmitrylyzo added this to the v10.10.0 milestone Sep 26, 2024
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

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

Switching to the previous episode doesn't restore the last selected subtitles (it performs "auto set"). The previous behavior was the same.

According to the Item Details page, we should use DefaultSubtitleStreamIndex from the item, but it isn't populated.

We can probably skip autoSetNextTracks when switching back, the server will return the last selected streams. But we need some kind of "marker" in playOptions.
This doesn't fix secondary subtitles, though.

Let's assume for now that we fix the switching to the next episode and leave the switching to the previous episode for the next PR.

I think we need to squash commits. Other than that, LGTM.

@viown
Copy link
Member Author

viown commented Sep 27, 2024

We can probably skip autoSetNextTracks when switching back, the server will return the last selected streams. But we need some kind of "marker" in playOptions.

This should be as simple as passing a flag to previousTrack's playOptions, correct? If so, I could incorporate that here or in a separate PR.

@Shadowghost
Copy link
Contributor

I'd prefer if we could fix the inconsistencies together in one PR

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented Sep 27, 2024

This should be as simple as passing a flag to previousTrack's playOptions, correct?

From a quick look, yes. IMO, it is better to use isPreviousTrack.

I'd prefer if we could fix the inconsistencies together in one PR

I'd prefer to make one change per commit or even PR (if we are squashing PRs on merge).
Technically, this PR fixes the mismatch of selected tracks (original issue), not the track selection itself, and that's enough.
If we are also going to fix the track (re)selection when switching back (another issue), this should be done in a separate commit (current commits should be squashed). Then we should only use merge commit on this PR.

@viown viown force-pushed the fix-incorrect-index-on-next-track branch from 7d3487c to 4c31742 Compare September 27, 2024 10:54
Copy link

@jellyfin-bot
Copy link
Collaborator

Cloudflare Pages deployment

Latest commit 4c31742cc50c19702f2c1610c2bcfc0d6c4d210b
Status ✅ Deployed!
Preview URL https://28c05976.jellyfin-web.pages.dev
Type 🔀 Preview

@thornbill thornbill merged commit 6f2ebda into jellyfin:master Sep 27, 2024
12 checks passed
@viown
Copy link
Member Author

viown commented Sep 29, 2024

From a quick look, yes. IMO, it is better to use isPreviousTrack.

@dmitrylyzo Hey, sorry, I can't seem to find isPreviousTrack anywhere, what exactly are you referring to?

@dmitrylyzo
Copy link
Contributor

@dmitrylyzo Hey, sorry, I can't seem to find isPreviousTrack anywhere, what exactly are you referring to?

It doesn't exist. We need to introduce it here:

const newItemPlayOptions = newItem.playOptions || getDefaultPlayOptions();

Then, we can use it to skip "autoset".

@viown
Copy link
Member Author

viown commented Sep 30, 2024

@dmitrylyzo Hey, sorry, I can't seem to find isPreviousTrack anywhere, what exactly are you referring to?

It doesn't exist. We need to introduce it here:

const newItemPlayOptions = newItem.playOptions || getDefaultPlayOptions();

Then, we can use it to skip "autoset".

Apologies if this is not the right place to continue this discussion.

Skipping autoset when going back doesn't seem to always pick the previously selected tracks in my testing. I've tried it like this:

  1. Start Episode 1
  2. Select second audio track
  3. Go to Episode 2
  4. Select the first (default) audio track
  5. Go back to Episode 1
  6. First audio track is selected (confirmed autoset did not run)

Manually POSTing to PlaybackInfo also does not seem to return the previously specified stream indexes when omitted.

This is my branch https://github.com/viown/jellyfin-web/commits/keep-settings-on-previous-track/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
5 participants