Giter Site home page Giter Site logo

googletv-socket.io's Introduction

setup

install and transpile

npm ci

start

npm start

then open :3000 in your browser, enter the hostname/ip of your googleTV and click init.

enter the code from the tv when prompted.

you can use the up/down/left/right/back/enter buttons to test the remote.

from here on out you can control the googletv over socket.io, it'll re-use the hostname and connection upon restart.

flow

  1. connect to socket
  2. (register event handler for secretCodeRequest - for setup)
  3. emit init with hostname/ip
  4. listen for init from server
  5. emit key event with key code
  6. go crazy

events

client to server

name args type description
init hostname string initialize the connection to the tv
code code string enter the code from the tv
key key number send a key to the tv (numeric format, see below)

server to client

name args type description
init tv is initialized, also emitted when reconnecting
secretCodeRequest code string tv requests a pairing code
power state boolean tv is turned on/off
currentApp app string tv changes app
volumeState state object tv changes volume
error error string error occurred
ready connection is ready¨
unpaired tv is unpaired

volume state object

interface VolumeState {
  current: number
  max: number
  isMuted: boolean
}

key codes

see here

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.