Skip to content

Commit 945ed28

Browse files
author
lijiahao
committed
feat: volume control enabled
1 parent 844f247 commit 945ed28

File tree

15 files changed

+118
-10
lines changed

15 files changed

+118
-10
lines changed

app/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15983,7 +15983,7 @@ module.exports = path.URL;
1598315983
/***/ ((module) => {
1598415984

1598515985
"use strict";
15986-
module.exports = /*#__PURE__*/JSON.parse('{"private":true,"name":"xstreaming","description":"xstreaming","version":"1.4.0","author":"Geocld <lijiahao5372@gmail.com>","main":"app/background.js","scripts":{"dev":"DEBUG=xstreaming:authenticationV2 nextron","build":"nextron build","lint":"eslint . --ext .ts && eslint renderer/ --ext .tsx","lint:fix":"eslint . --ext .ts --fix && eslint renderer/ --ext .tsx --fix","postinstall":"electron-builder install-app-deps","publish":"electron-builder -p onTag","flatpak-build":"nextron build --no-pack && electron-builder --dir"},"dependencies":{"@nextui-org/react":"^2.4.6","axios":"^1.7.7","compare-versions":"^6.1.0","debounce":"^2.1.1","debug":"^4.3.4","electron-serve":"^1.3.0","electron-store":"^8.0.1","express":"^4.18.3","express-http-proxy":"^2.0.0","express-ws":"^5.0.2","framer-motion":"^11.5.4","github-url-to-object":"^4.0.6","i18next":"23.14.0","ip-address":"^9.0.5","jose":"^5.1.0","moment":"^2.30.1","next-i18next":"^15.3.1","next-themes":"^0.3.0","react-i18next":"^15.0.1","react-query":"^3.39.3","semver":"^7.6.3","uplot":"^1.6.30","uuid-1345":"^1.0.2","xbox-webapi":"^1.4.1","xstreaming-player":"0.2.7","xvfb-maybe":"^0.2.1"},"devDependencies":{"@babel/core":"^7.24.4","@fortawesome/fontawesome-free":"^6.5.1","@next/eslint-plugin-next":"^14.2.2","@types/node":"^20.12.7","@types/react":"^18.2.47","@typescript-eslint/eslint-plugin":"^8.6.0","@typescript-eslint/parser":"^8.6.0","autoprefixer":"^10.4.20","babel-loader":"^9.1.3","electron":"33","electron-builder":"^24.13.3","eslint":"^8.57.0","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-refresh":"^0.4.12","next":"^13.5.6","nextron":"^8.13.0","node-loader":"^2.0.0","postcss":"^8.4.45","react":"^18.1.0","react-dom":"^18.1.0","sass":"^1.78.0","tailwindcss":"^3.4.10","typescript":"^5.3.3"},"packageManager":"yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"}');
15986+
module.exports = /*#__PURE__*/JSON.parse('{"private":true,"name":"xstreaming","description":"xstreaming","version":"1.6.0","author":"Geocld <lijiahao5372@gmail.com>","main":"app/background.js","scripts":{"dev":"DEBUG=xstreaming:authenticationV2 nextron","build":"nextron build","lint":"eslint . --ext .ts && eslint renderer/ --ext .tsx","lint:fix":"eslint . --ext .ts --fix && eslint renderer/ --ext .tsx --fix","postinstall":"electron-builder install-app-deps","publish":"electron-builder -p onTag","flatpak-build":"nextron build --no-pack && electron-builder --dir"},"dependencies":{"@nextui-org/react":"^2.4.6","axios":"^1.7.7","compare-versions":"^6.1.0","debounce":"^2.1.1","debug":"^4.3.4","electron-serve":"^1.3.0","electron-store":"^8.0.1","express":"^4.18.3","express-http-proxy":"^2.0.0","express-ws":"^5.0.2","framer-motion":"^11.5.4","github-url-to-object":"^4.0.6","i18next":"23.14.0","ip-address":"^9.0.5","jose":"^5.1.0","moment":"^2.30.1","next-i18next":"^15.3.1","next-themes":"^0.3.0","react-i18next":"^15.0.1","react-query":"^3.39.3","semver":"^7.6.3","uplot":"^1.6.30","uuid-1345":"^1.0.2","xbox-webapi":"^1.4.1","xstreaming-player":"0.2.7","xvfb-maybe":"^0.2.1"},"devDependencies":{"@babel/core":"^7.24.4","@fortawesome/fontawesome-free":"^6.5.1","@next/eslint-plugin-next":"^14.2.2","@types/node":"^20.12.7","@types/react":"^18.2.47","@typescript-eslint/eslint-plugin":"^8.6.0","@typescript-eslint/parser":"^8.6.0","autoprefixer":"^10.4.20","babel-loader":"^9.1.3","electron":"33","electron-builder":"^24.13.3","eslint":"^8.57.0","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-refresh":"^0.4.12","next":"^13.5.6","nextron":"^8.13.0","node-loader":"^2.0.0","postcss":"^8.4.45","react":"^18.1.0","react-dom":"^18.1.0","sass":"^1.78.0","tailwindcss":"^3.4.10","typescript":"^5.3.3"},"packageManager":"yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"}');
1598715987

1598815988
/***/ })
1598915989

app/preload.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "xstreaming",
44
"description": "xstreaming",
5-
"version": "1.5.0",
5+
"version": "1.6.0",
66
"author": "Geocld <lijiahao5372@gmail.com>",
77
"main": "app/background.js",
88
"scripts": {

renderer/components/ActionBar.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ function ActionBar(props) {
7474
props.onDisplay && props.onDisplay();
7575
};
7676

77+
const handleAudio = () => {
78+
props.onAudio && props.onAudio();
79+
};
80+
7781
const handlePressNexus = () => {
7882
props.onPressNexus && props.onPressNexus();
7983
};
@@ -111,6 +115,14 @@ function ActionBar(props) {
111115
)
112116
}
113117

118+
{
119+
props.connectState === CONNECTED && (
120+
<DropdownItem key="display" onClick={handleAudio}>
121+
{t("Audio settings")}
122+
</DropdownItem>
123+
)
124+
}
125+
114126
{
115127
props.connectState === CONNECTED && (
116128
<DropdownItem key="pressNexus" onClick={handlePressNexus}>

renderer/components/Audio.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {
2+
Modal,
3+
ModalContent,
4+
ModalHeader,
5+
ModalBody,
6+
Slider,
7+
} from "@nextui-org/react";
8+
import { useTranslation } from "next-i18next";
9+
10+
function Audio(props) {
11+
const { t } = useTranslation('cloud');
12+
13+
const handleClose = () => {
14+
props.onClose && props.onClose();
15+
};
16+
17+
const handleValueChange = value => {
18+
props.onValueChange && props.onValueChange(value);
19+
};
20+
21+
return (
22+
<Modal isOpen={true} className="z-100" onClose={handleClose}>
23+
<ModalContent>
24+
<>
25+
<ModalHeader className="flex flex-col gap-1">{t('Audio')}</ModalHeader>
26+
<ModalBody>
27+
<Slider
28+
label={t("Volume")}
29+
step={1}
30+
maxValue={10}
31+
minValue={1}
32+
value={props.volume}
33+
className="max-w-md"
34+
onChange={value => {
35+
handleValueChange(value);
36+
}}
37+
/>
38+
</ModalBody>
39+
</>
40+
</ModalContent>
41+
</Modal>
42+
);
43+
}
44+
45+
export default Audio;

renderer/pages/[locale]/achivements.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ function Achivements() {
2929
setLoading(true);
3030
setLoadingText(t("Loading..."));
3131

32+
const localFontSize = localStorage.getItem('fontSize');
33+
if (localFontSize && localFontSize !== '16') {
34+
document.documentElement.style.fontSize = localFontSize + 'px';
35+
}
36+
3237
Ipc.send("xCloud", "getHistoryAchivements").then(data => {
3338
setAchivements(data);
3439
setLoading(false);

renderer/pages/[locale]/home.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ function Home() {
6161

6262
useEffect(() => {
6363
const localTheme = localStorage.getItem('theme');
64-
console.log('localTheme:', localTheme)
6564
if (localTheme === 'xbox-light') {
6665
setTheme(localTheme)
6766
}
6867

6968
const localFontSize = localStorage.getItem('fontSize');
70-
if (localFontSize !== '16') {
69+
if (localFontSize && localFontSize !== '16') {
7170
document.documentElement.style.fontSize = localFontSize + 'px';
7271
}
7372

renderer/pages/[locale]/settings.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ function Settings() {
4444
setIsLogined(true);
4545
}
4646

47+
const localFontSize = localStorage.getItem('fontSize');
48+
if (localFontSize && localFontSize !== '16') {
49+
document.documentElement.style.fontSize = localFontSize + 'px';
50+
}
51+
4752
const _settings = getSettingsMetas(t);
4853
setSettings(_settings);
4954

renderer/pages/[locale]/stream.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from "react";
55
import xStreamingPlayer from "xstreaming-player";
66
import ActionBar from "../../components/ActionBar";
77
import Display from "../../components/Display";
8+
import Audio from "../../components/Audio";
89
import FailedModal from "../../components/FailedModal";
910
import Loading from "../../components/Loading";
1011
import Perform from "../../components/Perform";
@@ -36,6 +37,8 @@ function Stream() {
3637
const [showFailed, setShowFailed] = useState(false);
3738
const [showWarning, setShowWarning] = useState(false);
3839
const [showDisplay, setShowDisplay] = useState(false);
40+
const [showAudio, setShowAudio] = useState(false);
41+
const [volume, setVolume] = useState(1);
3942
const [streamingType, setStreamingType] = useState('');
4043
const [consoleId, setConsoleId] = useState('');
4144
const connectStateRef = useRef("");
@@ -46,6 +49,11 @@ function Stream() {
4649
let streamType = "home";
4750
let serverId = router.query.serverid as string;
4851

52+
const localFontSize = localStorage.getItem('fontSize');
53+
if (localFontSize && localFontSize !== '16') {
54+
document.documentElement.style.fontSize = localFontSize + 'px';
55+
}
56+
4957
if (serverId.startsWith(XCLOUD_PREFIX)) {
5058
streamType = "cloud";
5159
serverId = serverId.split("_")[1];
@@ -549,6 +557,7 @@ function Stream() {
549557
setShowPerformance(!showPerformance);
550558
}}
551559
onDisplay={() => setShowDisplay(true)}
560+
onAudio={() => setShowAudio(true)}
552561
onPressNexus={handlePressNexus}
553562
onLongPressNexus={handleLongPressNexus}
554563
/>
@@ -583,6 +592,19 @@ function Stream() {
583592
/>
584593
)}
585594

595+
{showAudio && (
596+
<Audio
597+
volume={volume}
598+
onClose={() => setShowAudio(false)}
599+
onValueChange={value => {
600+
setVolume(value)
601+
if (xPlayer) {
602+
xPlayer.setAudioVolumeDirect(value)
603+
}
604+
}}
605+
/>
606+
)}
607+
586608
{loading && <Loading loadingText={loadingText} />}
587609

588610
<div id="videoHolder" style={videoHolderStyle}>

renderer/pages/[locale]/xcloud.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ function Xcloud() {
3636
setLoadingText(t("Loading..."));
3737
focusable.current = document.querySelectorAll(FOCUS_ELEMS);
3838

39+
const localFontSize = localStorage.getItem('fontSize');
40+
if (localFontSize && localFontSize !== '16') {
41+
document.documentElement.style.fontSize = localFontSize + 'px';
42+
}
43+
3944
function nextItem(index) {
4045
index++;
4146
currentIndex.current = index % focusable.current.length;

0 commit comments

Comments
 (0)