Skip to content

Commit e4f1400

Browse files
author
lijiahao
committed
feat: micro supported
1 parent 98c2436 commit e4f1400

File tree

11 files changed

+86
-25
lines changed

11 files changed

+86
-25
lines changed

app/background.js

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

1606416064
"use strict";
16065-
module.exports = /*#__PURE__*/JSON.parse('{"private":true,"name":"xstreaming","description":"xstreaming","version":"1.6.4","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.12","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"}');
16065+
module.exports = /*#__PURE__*/JSON.parse('{"private":true,"name":"xstreaming","description":"xstreaming","version":"1.7.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.14","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"}');
1606616066

1606716067
/***/ })
1606816068

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.

flatpak/io.github.Geocld.XStreamingDesktop.metainfo.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
</screenshot>
3535
</screenshots>
3636
<releases>
37+
<release version="1.7.0" date="2025-05-28">
38+
<description>
39+
<ul>
40+
<li>Changes:</li>
41+
<li>Microphone supported</li>
42+
</ul>
43+
</description>
44+
</release>
3745
<release version="1.6.5" date="2025-05-15">
3846
<description>
3947
<ul>

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.6.5",
5+
"version": "1.7.0",
66
"author": "Geocld <lijiahao5372@gmail.com>",
77
"main": "app/background.js",
88
"scripts": {

renderer/components/ActionBar.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function ActionBar(props) {
3636
props.onAudio && props.onAudio();
3737
};
3838

39-
// const handleMic = () => {
40-
// props.onMic && props.onMic();
41-
// };
39+
const handleMic = () => {
40+
props.onMic && props.onMic();
41+
};
4242

4343
const handleText = () => {
4444
props.onText && props.onText();
@@ -89,13 +89,13 @@ function ActionBar(props) {
8989
)
9090
}
9191

92-
{/* {
92+
{
9393
props.connectState === CONNECTED && (
9494
<DropdownItem key="mic" onClick={handleMic}>
95-
{t("Toggle mic")}
95+
{props.openMicro ? t("Close Mic") : t("Open Mic")}
9696
</DropdownItem>
9797
)
98-
} */}
98+
}
9999

100100
{
101101
(props.connectState === CONNECTED && props.type !== 'cloud') && (
@@ -121,9 +121,9 @@ function ActionBar(props) {
121121
)
122122
}
123123

124-
<DropdownItem key="fullscreen" onClick={handleToggleFullscreen}>
124+
{/* <DropdownItem key="fullscreen" onClick={handleToggleFullscreen}>
125125
{t("Toggle fullscreen")}
126-
</DropdownItem>
126+
</DropdownItem> */}
127127

128128
{
129129
(props.connectState === CONNECTED && settings.power_on && props.type !== 'cloud') && (

renderer/pages/[locale]/stream.tsx

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ import TextModal from "../../components/TextModal";
1414
import { useSettings } from "../../context/userContext";
1515
import { getStaticPaths, makeStaticProperties } from "../../lib/get-static";
1616
import Ipc from "../../lib/ipc";
17+
import { DISPLAY_KEY } from "../../common/constans";
1718

1819
const XCLOUD_PREFIX = "xcloud_";
1920

21+
const DEFAULT_OPTIONS = {
22+
sharpness: 5,
23+
saturation: 100,
24+
contrast: 100,
25+
brightness: 100,
26+
};
27+
2028
function format(source: string, ...args: string[]): string {
2129
let n = 0
2230
return source.replace(/%(s)/, function() {
@@ -42,6 +50,7 @@ function Stream() {
4250
const [showTextModal, setShowTextModal] = useState(false);
4351
const [showActionbar, setShowActionbar] = useState(false);
4452
const [volume, setVolume] = useState(1);
53+
const [openMicro, setOpenMicro] = useState(false);
4554
const [streamingType, setStreamingType] = useState('');
4655
const [consoleId, setConsoleId] = useState('');
4756
const connectStateRef = useRef("");
@@ -251,6 +260,12 @@ function Stream() {
251260

252261
xPlayer.getEventBus().on("connectionstate", (event) => {
253262
console.log("connectionstate changed:", event);
263+
264+
// Toggle microphone
265+
if (connectStateRef.current === "connected" && (event.state === "new" || event.state === "connecting")) {
266+
return;
267+
}
268+
254269
setConnectState(event.state);
255270
connectStateRef.current = event.state;
256271

@@ -284,9 +299,32 @@ function Stream() {
284299
}
285300

286301
// Refresh video player
287-
if (settings.display_options) {
288-
refreshPlayer(settings.display_options)
289-
}
302+
setTimeout(() => {
303+
const _displayOptions = window.localStorage.getItem(DISPLAY_KEY);
304+
305+
let displayOptions: any = DEFAULT_OPTIONS;
306+
if (_displayOptions) {
307+
try {
308+
displayOptions = JSON.parse(_displayOptions);
309+
} catch {
310+
displayOptions = DEFAULT_OPTIONS;
311+
}
312+
}
313+
314+
const videoStyle = document.getElementById("video-css");
315+
console.log('Refresh video player:', displayOptions)
316+
const filters = getVideoPlayerFilterStyle(displayOptions);
317+
let videoCss = "";
318+
if (filters) {
319+
videoCss += `filter: ${filters} !important;`;
320+
}
321+
let css = "";
322+
if (videoCss) {
323+
css = `#videoHolder video { ${videoCss} }`;
324+
}
325+
326+
videoStyle!.textContent = css;
327+
}, 1000);
290328

291329
// const xboxTitleId = window._xboxTitleId || ''
292330
// // inputConfigs
@@ -554,16 +592,23 @@ function Stream() {
554592

555593
setTimeout(() => {
556594
console.log("stopStream:", sessionId);
595+
const timer = setTimeout(() => {
596+
setLoading(false);
597+
router.back();
598+
}, 20 * 1000);
599+
557600
Ipc.send("streaming", "stopStream", {
558601
sessionId: sessionId,
559602
})
560603
.then((result) => {
561604
console.log("Stream stopped:", result);
605+
clearTimeout(timer)
562606
setLoading(false);
563607
router.back();
564608
})
565609
.catch((e) => {
566610
console.log(e);
611+
clearTimeout(timer)
567612
setLoading(false);
568613
router.back();
569614
});
@@ -591,9 +636,11 @@ function Stream() {
591636
const handleToggleMic = () => {
592637
if (!xPlayer) return
593638
if(xPlayer.getChannelProcessor('chat').isPaused === true){
594-
xPlayer.getChannelProcessor('chat').startMic()
639+
xPlayer.getChannelProcessor('chat').startMic();
640+
setOpenMicro(true);
595641
} else {
596-
xPlayer.getChannelProcessor('chat').stopMic()
642+
xPlayer.getChannelProcessor('chat').stopMic();
643+
setOpenMicro(false);
597644
}
598645
};
599646

@@ -616,6 +663,7 @@ function Stream() {
616663
<ActionBar
617664
connectState={connectState}
618665
type={streamingType}
666+
openMicro={openMicro}
619667
onDisconnect={onDisconnect}
620668
onDisconnectPowerOff={onDisconnectPowerOff}
621669
onTogglePerformance={() => {
@@ -668,16 +716,16 @@ function Stream() {
668716
showTextModal && (
669717
<TextModal
670718
onClose={() => {
671-
setShowTextModal(false)
672-
xPlayer.setKeyboardInput(true)
719+
setShowTextModal(false);
720+
xPlayer.setKeyboardInput(true);
673721
}}
674722
onConfirm={value => {
675-
let text = value.trim()
723+
let text = value.trim();
676724
if (!text) return
677725
if (text.length > 150) {
678726
text = text.substring(0, 150);
679727
}
680-
handleSendText(text)
728+
handleSendText(text);
681729
}}
682730
/>
683731
)

renderer/public/locales/en/cloud.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
"Volume": "Volume",
4242
"Audio settings": "Audio settings",
4343
"Send text": "Send text",
44-
"Toggle mic": "Toggle mic"
44+
"Open Mic": "Open Mic",
45+
"Close Mic": "Close Mic"
4546
}

renderer/public/locales/jp/cloud.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
"Volume": "Volume",
4242
"Audio settings": "Audio settings",
4343
"Send text": "Send text",
44-
"Toggle mic": "Toggle mic"
44+
"Open Mic": "Open Mic",
45+
"Close Mic": "Close Mic"
4546
}

renderer/public/locales/pt/cloud.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
"Volume": "Volume",
5151
"Audio settings": "Audio settings",
5252
"Send text": "Send text",
53-
"Toggle mic": "Toggle mic"
53+
"Open Mic": "Open Mic",
54+
"Close Mic": "Close Mic"
5455
}

renderer/public/locales/zh/cloud.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
"Volume": "音量",
5252
"Audio settings": "声音设置",
5353
"Send text": "发送文字",
54-
"Toggle mic": "开启/关闭音麦"
54+
"Open Mic": "开启音麦",
55+
"Close Mic": "关闭音麦"
5556
}

0 commit comments

Comments
 (0)