Merge pull request #515 from Stremio/surround_sound_enabled

Surround sound setting
This commit is contained in:
Tim 2023-12-08 16:13:56 +01:00 committed by GitHub
commit 438f054718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 18 deletions

14
package-lock.json generated
View file

@ -36,7 +36,7 @@
"react-i18next": "^12.1.1", "react-i18next": "^12.1.1",
"react-is": "18.2.0", "react-is": "18.2.0",
"spatial-navigation-polyfill": "git+ssh://git@github.com/Stremio/spatial-navigation.git#64871b1422466f5f45d24ebc8bbd315b2ebab6a6", "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", "url": "0.11.0",
"use-long-press": "^3.1.5" "use-long-press": "^3.1.5"
}, },
@ -12878,9 +12878,9 @@
} }
}, },
"node_modules/stremio-translations": { "node_modules/stremio-translations": {
"version": "1.44.1", "version": "1.44.3",
"resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#9c91862cdf8f1f0fb54df870807cd6af18679a89", "resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7",
"integrity": "sha512-sOYmxXAVT5DwkIxFnateCQ+4rfe9xqWVTdnwc7Jdo7UCdnbtTUuHXIjyKFK2Vv11nWV5mBrizxAscdcxUpEImw==", "integrity": "sha512-E8UqbRzVQzDFQvKLTztrtA2V8xL8JeYfi+hI9IWx9kwIMQ34no2hxuualXH7A4U0s8xlM6BQW4bcQlVKwflhEg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/string_decoder": { "node_modules/string_decoder": {
@ -24576,9 +24576,9 @@
"dev": true "dev": true
}, },
"stremio-translations": { "stremio-translations": {
"version": "git+ssh://git@github.com/Stremio/stremio-translations.git#9c91862cdf8f1f0fb54df870807cd6af18679a89", "version": "git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7",
"integrity": "sha512-sOYmxXAVT5DwkIxFnateCQ+4rfe9xqWVTdnwc7Jdo7UCdnbtTUuHXIjyKFK2Vv11nWV5mBrizxAscdcxUpEImw==", "integrity": "sha512-E8UqbRzVQzDFQvKLTztrtA2V8xL8JeYfi+hI9IWx9kwIMQ34no2hxuualXH7A4U0s8xlM6BQW4bcQlVKwflhEg==",
"from": "stremio-translations@git+ssh://git@github.com/Stremio/stremio-translations.git#9c91862cdf8f1f0fb54df870807cd6af18679a89" "from": "stremio-translations@git+ssh://git@github.com/Stremio/stremio-translations.git#8e30d9961402a7389f1a6209d9dab5592f32c9d7"
}, },
"string_decoder": { "string_decoder": {
"version": "1.1.1", "version": "1.1.1",

View file

@ -39,7 +39,7 @@
"react-i18next": "^12.1.1", "react-i18next": "^12.1.1",
"react-is": "18.2.0", "react-is": "18.2.0",
"spatial-navigation-polyfill": "git+ssh://git@github.com/Stremio/spatial-navigation.git#64871b1422466f5f45d24ebc8bbd315b2ebab6a6", "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", "url": "0.11.0",
"use-long-press": "^3.1.5" "use-long-press": "^3.1.5"
}, },

View file

@ -27,11 +27,8 @@ const styles = require('./styles');
const Player = ({ urlParams, queryParams }) => { const Player = ({ urlParams, queryParams }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { chromecast, shell, core } = useServices(); const { chromecast, shell, core } = useServices();
const [forceTranscoding, maxAudioChannels] = React.useMemo(() => { const forceTranscoding = React.useMemo(() => {
return [ return queryParams.has('forceTranscoding');
queryParams.has('forceTranscoding'),
queryParams.has('maxAudioChannels') ? parseInt(queryParams.get('maxAudioChannels'), 10) : null
];
}, [queryParams]); }, [queryParams]);
const [player, videoParamsChanged, timeChanged, pausedChanged, ended, nextVideo] = usePlayer(urlParams); const [player, videoParamsChanged, timeChanged, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
const [settings, updateSettings] = useSettings(); const [settings, updateSettings] = useSettings();
@ -288,10 +285,7 @@ const Player = ({ urlParams, queryParams }) => {
: :
0, 0,
forceTranscoding: forceTranscoding || casting, forceTranscoding: forceTranscoding || casting,
maxAudioChannels: typeof maxAudioChannels === 'number' ? maxAudioChannels: settings.surroundSound ? 32 : 2,
maxAudioChannels
:
null,
streamingServerURL: streamingServer.baseUrl.type === 'Ready' ? streamingServerURL: streamingServer.baseUrl.type === 'Ready' ?
casting ? casting ?
streamingServer.baseUrl.content streamingServer.baseUrl.content
@ -306,7 +300,7 @@ const Player = ({ urlParams, queryParams }) => {
shellTransport: shell.active ? shell.transport : null, 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(() => { React.useEffect(() => {
if (videoState.stream !== null) { if (videoState.stream !== null) {
dispatch({ dispatch({

View file

@ -34,6 +34,7 @@ const Settings = () => {
subtitlesBackgroundColorInput, subtitlesBackgroundColorInput,
subtitlesOutlineColorInput, subtitlesOutlineColorInput,
audioLanguageSelect, audioLanguageSelect,
surroundSoundCheckbox,
seekTimeDurationSelect, seekTimeDurationSelect,
seekShortTimeDurationSelect, seekShortTimeDurationSelect,
escExitFullscreenCheckbox, escExitFullscreenCheckbox,
@ -405,6 +406,16 @@ const Settings = () => {
{...audioLanguageSelect} {...audioLanguageSelect}
/> />
</div> </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>
<div className={styles['section-container']}> <div className={styles['section-container']}>
<div className={styles['section-category-container']}> <div className={styles['section-category-container']}>

View file

@ -135,6 +135,21 @@ const useProfileSettingsInputs = (profile) => {
}); });
} }
}), [profile.settings]); }), [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(() => ({ const escExitFullscreenCheckbox = React.useMemo(() => ({
checked: profile.settings.escExitFullscreen, checked: profile.settings.escExitFullscreen,
onClick: () => { onClick: () => {
@ -307,6 +322,7 @@ const useProfileSettingsInputs = (profile) => {
subtitlesBackgroundColorInput, subtitlesBackgroundColorInput,
subtitlesOutlineColorInput, subtitlesOutlineColorInput,
audioLanguageSelect, audioLanguageSelect,
surroundSoundCheckbox,
escExitFullscreenCheckbox, escExitFullscreenCheckbox,
seekTimeDurationSelect, seekTimeDurationSelect,
seekShortTimeDurationSelect, seekShortTimeDurationSelect,

View file

@ -37,6 +37,7 @@ type Settings = {
subtitlesOutlineColor: string, subtitlesOutlineColor: string,
subtitlesSize: number, subtitlesSize: number,
subtitlesTextColor: string, subtitlesTextColor: string,
surroundSound: boolean,
}; };
type Profile = { type Profile = {