Git Product home page Git Product logo

xremote-js's Introduction

XRemote JS

build codecov

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.

Usage

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);

Develop

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

Credit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.