Skip to content

Implement Theme Song Volume Control #6674

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NathanGrenier
Copy link

About

Implement basic input slider in "Display" settings menu to set theme song volume level during playback.

Changes

  • Add UI elements to change theme song volume level
  • Add settings to store theme song volume level
  • TODO: Set the theme song playback audio level using the settings value (without affecting the media playback volume in the process)

Issues

Fixes #3086

Details
Currently, I've only setup the ui and backend logic for setting and getting the theme song volume level.

I'm able to set the theme song's volume level quite easily in components/themeMediaPlayer.js, but doing that has the unintended side effect of also setting the volume level of all media playback. This is because there's only 1 shared media player for the application.

I tried a workaround involving storing the previous audio level then restoring it once the theme song playback ended, but couldn't get it to work perfectly without any issues / minor bugs.

I also wasn't able to test the changes made to src/apps/experimental/features/preferences/components/LibraryPreferences.tsx because I'm not sure where to access that UI.

@jellyfin-bot
Copy link
Collaborator

jellyfin-bot commented Mar 28, 2025

Cloudflare Pages deployment

Latest commit eec87d7
Status ✅ Deployed!
Preview URL https://fd93eb54.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs

@dmitrylyzo
Copy link
Contributor

This is because there's only 1 shared media player for the application.

The media element is not destroyed. If this is not on purpose, we should destroy it completely, as in the video player. But we can leave it as is for now.

I tried a workaround involving storing the previous audio level then restoring it once the theme song playback ended, but couldn't get it to work perfectly without any issues / minor bugs.

I think we can introduce a "volume mode" (primary and secondary) and make players use it to get/set the appropriate value.

// TODO: Move volume control to PlaybackManager. Player should just be a wrapper that translates commands into API calls.
if (!appHost.supports('physicalvolumecontrol')) {
elem.volume = htmlMediaHelper.getSavedVolume();
}

htmlMediaHelper.saveVolume(this.volume);

export function getSavedVolume() {
return appSettings.get('volume') || 1;
}
export function saveVolume(value) {
if (value) {
appSettings.set('volume', value);
}
}

We can use fullscreen from the options passed to play - for "theme players" is false.

We also need to move this to play.

I also wasn't able to test the changes made to src/apps/experimental/features/preferences/components/LibraryPreferences.tsx because I'm not sure where to access that UI.

User settings / Display / Display mode -> Experimental.

return this.set('themeSongsVolumeLevel', val.toString());
}

return parseInt(this.get('themeSongsVolumeLevel') || '100', 10);
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, it would be better to make the default volume lower.

Suggested change
return parseInt(this.get('themeSongsVolumeLevel') || '100', 10);
return parseInt(this.get('themeSongsVolumeLevel') || '50', 10);

@@ -9,6 +9,7 @@ export interface DisplaySettingsValues {
enableItemDetailsBanner: boolean;
enableLibraryBackdrops: boolean;
enableLibraryThemeSongs: boolean;
libraryThemeSongsVolumeLevel: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was supposed to be in alphabetical order.

@@ -87,6 +87,7 @@ async function loadDisplaySettings({
enableItemDetailsBanner: Boolean(settings.detailsBanner()),
enableLibraryBackdrops: Boolean(settings.enableBackdrops()),
enableLibraryThemeSongs: Boolean(settings.enableThemeSongs()),
libraryThemeSongsVolumeLevel: settings.themeSongsVolumeLevel(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was supposed to be in alphabetical order.

Comment on lines +43 to +55
const handleSliderChange = useCallback(() => (e: Event, newValue: number | number[]) => {
const target = e.target as HTMLInputElement;
const fieldName = target.name as keyof DisplaySettingsValues;
const value = Array.isArray(newValue) ? newValue[0] : newValue;

if (values?.[fieldName] !== value) {
updateField({
name: fieldName,
value: value.toString()
});
}
}, [updateField, values]);

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't handleFieldChange (onChange callback) enough?

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

Successfully merging this pull request may close these issues.

theme song / theme videos volume adjustments
3 participants