├── logo ├── logo.psd └── remote-control.jpg ├── .gitignore ├── sample └── index.html ├── packge.json ├── remote-control.js ├── app.js ├── README.md ├── README-pt.md └── index.html /logo/logo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braziljs/remote-control/HEAD/logo/logo.psd -------------------------------------------------------------------------------- /logo/remote-control.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braziljs/remote-control/HEAD/logo/remote-control.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject/private/ 2 | /node_modules/ 3 | ## 4 | ## Development meta files 5 | ## 6 | *.*~* 7 | *.*~ 8 | .project 9 | .DS_Store 10 | ./nbproject 11 | .buildpath 12 | .project 13 | nbproject 14 | nbproject/* 15 | ./.settings/ 16 | /projects/demo-pt/.mind/ 17 | -------------------------------------------------------------------------------- /sample/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packge.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remote-control", 3 | "version": "0.0.1", 4 | "description": "Remote Control is a remote slide tool", 5 | "main": "app.js", 6 | "directories": { 7 | 8 | }, 9 | "dependencies": { 10 | "socket.io" : "0.9.10" 11 | }, 12 | "engines": { 13 | "node": ">=0.6.0" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/braziljs/remote-control.git" 18 | }, 19 | "keywords": [ 20 | "slides", 21 | "html5", 22 | "presentation", 23 | "tool", 24 | "remote" 25 | ], 26 | "author": "Jaydson Gomes", 27 | "license": "MIT" 28 | } -------------------------------------------------------------------------------- /remote-control.js: -------------------------------------------------------------------------------- 1 | /*global window*/ 2 | if (!window.io) { 3 | throw 'Socket.io library is required. Make sure that node server is up'; 4 | } 5 | 6 | (function (io) { 7 | 8 | 'use strict'; 9 | 10 | var RemoteControl = function () {}, 11 | 12 | priv = { 13 | socket : null, 14 | connected : false, 15 | 16 | setAction : function (action, fn) { 17 | priv.socket.on(action, fn); 18 | }, 19 | 20 | getHash : function (str) { 21 | var hash = 0, 22 | i = 0, 23 | strLen = str.length, 24 | ch = null; 25 | 26 | if (strLen === 0) { 27 | return hash; 28 | } 29 | 30 | for (i; i < strLen; i++) { 31 | ch = str.charCodeAt(i); 32 | hash = ((hash << 5) - hash) + ch; 33 | hash = hash & hash; 34 | } 35 | 36 | return Math.abs(hash); 37 | } 38 | }; 39 | 40 | RemoteControl.prototype.connect = function (socketserver) { 41 | if (priv.connected === false) { 42 | priv.socket = io.connect(socketserver); 43 | priv.connected = true; 44 | } 45 | }; 46 | 47 | RemoteControl.prototype.on = function (action, fn) { 48 | if (priv.connected) { 49 | priv.setAction(action, fn); 50 | } else { 51 | throw '#RemoteControl - You must to connect before!'; 52 | } 53 | }; 54 | 55 | RemoteControl.prototype.sync = function (pattern) { 56 | pattern = priv.getHash((pattern || window.location.href)); 57 | priv.socket.emit('requestSync', pattern); 58 | return pattern; 59 | }; 60 | 61 | window.RemoteControl = RemoteControl; 62 | }(window.io)); -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var app = require('http').createServer(handler) 2 | , io = require('socket.io').listen(app) 3 | , fs = require('fs') 4 | , hash = false; 5 | 6 | app.listen(81); 7 | 8 | function handler (req, res) { 9 | fs.readFile(__dirname + '/index.html', 10 | function (err, data) { 11 | if (err) { 12 | res.writeHead(500); 13 | return res.end('Error loading index.html'); 14 | } 15 | res.writeHead(200); 16 | res.end(data); 17 | }); 18 | } 19 | 20 | io.sockets.on('connection', function (socket) { 21 | 22 | socket.on('message', function(type, data) { 23 | 24 | if(hash){ 25 | socket.broadcast.to(hash).emit(data); 26 | }else{ 27 | socket.broadcast.send(data); 28 | } 29 | 30 | }); 31 | 32 | socket.on('next', function(){ 33 | io.sockets.in(hash).emit('next'); 34 | }); 35 | socket.on('prev', function(){ 36 | io.sockets.in(hash).emit('prev'); 37 | }); 38 | socket.on('camera', function(){ 39 | io.sockets.in(hash).emit('camera'); 40 | }); 41 | socket.on('start', function(){ 42 | io.sockets.in(hash).emit('start'); 43 | }); 44 | 45 | socket.on('point', function(data){ 46 | io.sockets.in(hash).emit('point', data); 47 | }); 48 | 49 | socket.on('laserpoint', function(data){ 50 | io.sockets.in(hash).emit('laserpoint', data); 51 | }); 52 | 53 | socket.on('holofote', function(data){ 54 | io.sockets.in(hash).emit('holofote', data); 55 | }); 56 | 57 | socket.on('requestSync', function(key) { 58 | socket.join(key); 59 | hash= key; 60 | socket.broadcast.to(hash).emit('sync'); 61 | io.sockets.in(hash).emit('sync'); 62 | }); 63 | 64 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *[Leia a documentação em Português](https://github.com/braziljs/remote-control/blob/master/README-pt.md)* 2 | 3 | --- 4 | 5 | # Remote Control 6 | 7 |  8 | 9 | A tool to control the slides of your HTML5 presentation through a cell phone. 10 | 11 | > **Maintainer:** [Jaydson Gomes](https://github.com/jaydson) 12 | 13 | * [How it works](#how-it-works) 14 | * [Dependencies](#dependencies) 15 | * [How to install](#how-to-install) 16 | * [How to use](#how-to-use) 17 | * [Get involved](#get-involved) 18 | 19 | ## How it works 20 | Remote Control is based on [WebSockets](https://developer.mozilla.org/en-US/docs/WebSockets), so you may have a good and modern browser, like Firefox, Chrome or Opera. 21 | 22 | The phone send a message through WebSockets to the server. 23 | The server receive the message as an action that must be executed, like 'next' or 'previous'. 24 | This action are emited to the HTML5 presentation. 25 | 26 | ## Dependencies 27 | * [nodejs](http://nodejs.org) 28 | * [socket.io](http://socket.io) 29 | * A modern Web Browser with WebSockets support in your desktop [can i use websockets?](http://caniuse.com/#search=websockets) 30 | * A modern Web Browser with WebSockets support in your phone [can i use websockets?](http://caniuse.com/#search=websockets) 31 | 32 | ## How to install 33 | For while, you need to install manually :( 34 | 35 | First, if you don't have node, you must to install. Google it, if you don't know how. 36 | Install socket.io: 37 | ```cli 38 | npm install socket.io 39 | ``` 40 | 41 | ## How to use 42 | Run app.js: 43 | ```cli 44 | node app.js 45 | ``` 46 | The server will be available at port 81 [http:localhost:81](http:localhost:81), but you can change if you want. 47 | 48 | Now, you need to add 2 JavaScript libraries to your HTML5 presentation: 49 | ```html 50 | 51 | 52 | ``` 53 | 54 | You're almost ready to start the presentation! 55 | Add this code to your presentation file: 56 | ```javascript 57 | var remote = new RemoteControl(); 58 | remote.connect('http://localhost:81'); 59 | remote.on('next', function() { 60 | // Your method to move to the next slide 61 | }); 62 | 63 | remote.on('previous', function() { 64 | // Your method to move to the previous slide 65 | }); 66 | ``` 67 | Now point your phone browser to your IP address on port 81. 68 | You must see a ugly(i'm working on that) page with 3 buttons. 69 | If everything is ok, now you are able to control your HTML5 presentation with your phone. 70 | 71 | ## Get involved 72 | - Fork, run Remote Control in your enviroment, rate all features and send us your feedback through the [mail list](https://groups.google.com/forum/?fromgroups#!forum/braziljs-foundation) 73 | - [Become a bug hunter!](https://github.com/braziljs/remote-control/issues?state=open) 74 | - If you find some bug, [add an issue](https://github.com/braziljs/remote-control/issues/new) with the label "bug" 75 | - If you want to fix the bug by yourself(wow!), make a fix in your enviroment and [make one pull-request](https://github.com/braziljs/remote-control/pulls) 76 | - If you had an great idea of feature, [add an issue](https://github.com/braziljs/remote-control/issues/new) with the label "enhancement" 77 | - If you want to implement the feature by yourself(wow! wow!), do it and [make one pull-request](https://github.com/braziljs/remote-control/pulls) 78 | 79 | ## License 80 | 81 | [MIT License](http://braziljs.mit-license.org/) © BrazilJS Foundation 82 | -------------------------------------------------------------------------------- /README-pt.md: -------------------------------------------------------------------------------- 1 | # Remote Control 2 | 3 |  4 | 5 | Remote Control é uma ferramenta para controlar suas apresentações HTML5 remotamente(Duh). 6 | 7 | > **Mantenedor:** [Jaydson Gomes](https://github.com/jaydson) 8 | 9 | * [Como funciona](#como-funciona) 10 | * [Dependências](#dependências) 11 | * [Como instalar](#como-instalar) 12 | * [Como usar](#como-usar) 13 | * [Envolva-se com o projet](#envolva-se-com--projeto) 14 | 15 | ## Como funciona 16 | O Remote Control é baseado em [WebSockets](https://developer.mozilla.org/en-US/docs/WebSockets), então, você deve ter um Browser moderno, como o Firefox, Chrome ou Opera. 17 | O celular envia uma mensagem via WebSockets para o servidor. 18 | O servidor recebe esta mensagem como uma ação que deve ser executada, como por exemplo: 'next' ou 'previous'. 19 | Esta ação é emitida para a apresentação HTML5. 20 | 21 | ## Dependências 22 | * [nodejs](http://nodejs.org) 23 | * [socket.io](http://socket.io) 24 | * Um Browser moderno com suporte à WebSockets no seu pc [can i use websockets?](http://caniuse.com/#search=websockets) 25 | * Um Browser moderno com suporte à WebSockets no seu celular [can i use websockets?](http://caniuse.com/#search=websockets) 26 | 27 | ## Como instalar 28 | Por enquanto, você deve instalar manulamente :( 29 | 30 | Primeiro, se você não possui o node, instale-o. 31 | Pesquise do Google, caso você não saiba como fazer isso. 32 | Instale o socket.io: 33 | ```cli 34 | npm install socket.io 35 | ``` 36 | 37 | ## Como usar 38 | Rode o arquivo app.js: 39 | ```cli 40 | node app.js 41 | ``` 42 | O servidor ficará disponível na porta 81 [http:localhost:81](http:localhost:81), mas você pode mudar isso se preferir. 43 | Agora, você precisa adicionar 2 biblioteca JavaScript na sua apresentação HTML5: 44 | ```html 45 | 46 | 47 | ``` 48 | 49 | Você está quase pronto para iniciar a apresentação! 50 | Adicione o código abaixo: 51 | ```javascript 52 | var remote = new RemoteControl(); 53 | remote.connect('http://localhost:81'); 54 | remote.on('next', function() { 55 | // Próximo Slide 56 | }); 57 | 58 | remote.on('previous', function() { 59 | // Slide anterior 60 | }); 61 | ``` 62 | Agora acesse do seu celular o seu IP na porta 81. 63 | Você deverá ver uma página feia(estamos trabalhando nisso) com 3 botões. 64 | Se tudo estiver ok, agora você já pode controlar suas apresentações HTML5 com o seu celular. 65 | 66 | ## Envolva-se com o projeto 67 | - Faça um fork, rode o Remote Control no seu ambiente, avalie todas as funcionalidades e nos envie o seu feedback pela [lista de email](https://groups.google.com/forum/?fromgroups#!forum/braziljs-foundation) 68 | - [Seja um caçador de bugs!](https://github.com/braziljs/remote-control/issues?state=open) 69 | - Se você achou algum bug, [crie uma issue](https://github.com/braziljs/remote-control/issues/new) com a label "bug" 70 | - Se você mesmo quer corrigir este bug(wow!), faça a correção no seu ambiente e [faça um pull-request](https://github.com/braziljs/remote-control/pulls) 71 | - Se você teve uma grande ideia de funcionalidade, [crie uma issue](https://github.com/braziljs/remote-control/issues/new) com a label "enhancement" 72 | - Se você mesmo quer implementar esta funcionalidade (wow! wow!), implemente e [faça um pull-request](https://github.com/braziljs/remote-control/pulls) 73 | 74 | ## Quem está por trás disso? 75 | **Líderes do projeto**: 76 | [Jaydson Gomes](http://github.com/jaydson) 77 | [Felipe N. Moura](http://github.com/felipenmoura) 78 | 79 | ## Licença 80 | [MIT License](http://braziljs.mit-license.org/) © BrazilJS Foundation 81 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 56 | 57 | 104 | 105 | 106 | 107 | 108 | 109 | 114 | 191 | 192 | --------------------------------------------------------------------------------