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

Surround sound setting #515

Merged
merged 11 commits into from
Dec 8, 2023
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"react-i18next": "^12.1.1",
"react-is": "18.2.0",
"spatial-navigation-polyfill": "git+ssh://git@github.com/Stremio/spatial-navigation.git#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
"stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#9c91862cdf8f1f0fb54df870807cd6af18679a89",
"stremio-translations": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7",
"url": "0.11.0",
"use-long-press": "^3.1.5"
},
Expand Down
14 changes: 4 additions & 10 deletions src/routes/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ const styles = require('./styles');
const Player = ({ urlParams, queryParams }) => {
const { t } = useTranslation();
const { chromecast, shell, core } = useServices();
const [forceTranscoding, maxAudioChannels] = React.useMemo(() => {
return [
queryParams.has('forceTranscoding'),
queryParams.has('maxAudioChannels') ? parseInt(queryParams.get('maxAudioChannels'), 10) : null
];
const forceTranscoding = React.useMemo(() => {
return queryParams.has('forceTranscoding');
}, [queryParams]);
const [player, videoParamsChanged, timeChanged, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
const [settings, updateSettings] = useSettings();
Expand Down Expand Up @@ -288,10 +285,7 @@ const Player = ({ urlParams, queryParams }) => {
:
0,
forceTranscoding: forceTranscoding || casting,
maxAudioChannels: typeof maxAudioChannels === 'number' ?
maxAudioChannels
:
null,
maxAudioChannels: settings.surroundSound ? 32 : 2,
streamingServerURL: streamingServer.baseUrl.type === 'Ready' ?
casting ?
streamingServer.baseUrl.content
Expand All @@ -306,7 +300,7 @@ const Player = ({ urlParams, queryParams }) => {
shellTransport: shell.active ? shell.transport : null,
});
}
}, [streamingServer.baseUrl, player.selected, player.metaItem, forceTranscoding, maxAudioChannels, casting]);
}, [streamingServer.baseUrl, player.selected, player.metaItem, forceTranscoding, casting]);
React.useEffect(() => {
if (videoState.stream !== null) {
dispatch({
Expand Down
11 changes: 11 additions & 0 deletions src/routes/Settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Settings = () => {
subtitlesBackgroundColorInput,
subtitlesOutlineColorInput,
audioLanguageSelect,
surroundSoundCheckbox,
seekTimeDurationSelect,
seekShortTimeDurationSelect,
escExitFullscreenCheckbox,
Expand Down Expand Up @@ -405,6 +406,16 @@ const Settings = () => {
{...audioLanguageSelect}
/>
</div>
<div className={styles['option-container']}>
<div className={styles['option-name-container']}>
<div className={styles['label']}>{ t('SETTINGS_SURROUND_SOUND') }</div>
</div>
<Checkbox
className={classnames(styles['option-input-container'], styles['checkbox-container'])}
tabIndex={-1}
{...surroundSoundCheckbox}
/>
</div>
</div>
<div className={styles['section-container']}>
<div className={styles['section-category-container']}>
Expand Down
16 changes: 16 additions & 0 deletions src/routes/Settings/useProfileSettingsInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ const useProfileSettingsInputs = (profile) => {
});
}
}), [profile.settings]);
const surroundSoundCheckbox = React.useMemo(() => ({
checked: profile.settings.surroundSound,
onClick: () => {
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'UpdateSettings',
args: {
...profile.settings,
surroundSound: !profile.settings.surroundSound
}
}
});
}
}), [profile.settings]);
const escExitFullscreenCheckbox = React.useMemo(() => ({
checked: profile.settings.escExitFullscreen,
onClick: () => {
Expand Down Expand Up @@ -307,6 +322,7 @@ const useProfileSettingsInputs = (profile) => {
subtitlesBackgroundColorInput,
subtitlesOutlineColorInput,
audioLanguageSelect,
surroundSoundCheckbox,
escExitFullscreenCheckbox,
seekTimeDurationSelect,
seekShortTimeDurationSelect,
Expand Down
1 change: 1 addition & 0 deletions src/types/models/Ctx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Settings = {
subtitlesOutlineColor: string,
subtitlesSize: number,
subtitlesTextColor: string,
surroundSound: boolean,
};

type Profile = {
Expand Down
Loading