XRemote is a web implementation for the Xbox One/Series streaming protocol.
The package provides API to access and collect stream data of your Xbox console.
You can install @yowari/xremote
package using npm:
npm install @yowari/xremote
After install finishes, you can use the provided API to connect to your Xbox console:
import { Buttons, Client, VIDEO_CHANNEL } from '@yowari/xremote';
const OAUTH_TOKEN = 'secret-token'; // retrieve your token from https://www.xbox.com/en-US/play
const client = new Client();
await client.login(OAUTH_TOKEN);
const consoles = await client.getConsoles();
const session = await client.createSession(consoles.results[0].serverId);
await client.startStream(session.sessionId);
// Get video stream
const videoChannel = client.getChannel(VIDEO_CHANNEL);
videoChannel.addEventListener('frame', (event) => {
// render(event.frame)
});
// Control the gamepad
const gamepadManager = client.getGamepadManager();
gamepadManager.pressButton(0, Buttons.Nexus);
setTimeout(() => gamepadManager.releaseButton(0, Buttons.Nexus), 25);
For easy environment setup, use nvm
with the command bellow
nvm use
This will set the appropriate node version defined in .nvmrc
.
The project source code is written in TypeScript. To transpile the code and build the production bundle, run the following command:
npm run build
The project uses Jest for tests. Use the command bellow to run the tests:
npm run test
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。