Code Monkey home page Code Monkey logo

networked-qrcode-pairing's Introduction

Networked QRCode Pairing

It all started by this tweet

IDEA: to pair 2 phones with webrtc, we could display a qrcode on one phone 
and scan it with the other. Thus the two phones will know each other and 
establish the connection ๐Ÿ˜Ž

I wanted to pair 2 phones together and have them play a game together. It would be nice if say 2 persons in the same room could play a game.

So i did this proof of concept.

Here is the repository networked-qrcode-pairing repository on github

Here is a running example on glitch

Principles

It is all done within the browser. So we leverage the url. The principles are simple:

  • If the url of the page contains ?roomName=fooBar, then it will join the room fooBar.
  • if the url doesn't contain any roomName parameters, we assume it is the first player to join and we create a new room with a random roomName. Other players will have to scan his qrCode to join his room.

Implementation Details

The implementation is quite straight forward. It is just an assembly of the proper piece of software.

networked-aframe is doing most of the work. It is a very nice project done by the excelent @HaydenLee37.

It is the Getting Started example from networked-aframe. Then i just added qrcode generated from jquery.qrcode. Then i deployed it on glitch.

It went rather smoothly.

How to use the demo

First you install all dependancies

npm install

Then you run the local server

npm start

Deploy on glitch

Issue with AR

For this sharing mechanism to work, we need a qrcode reader able to launch the proper browser for our URL. Usually it launch the default browser: chrome on android, safari on ios. But here we would need to launch WebARonARCore/WebARonARKit.

Maybe it would be fixed with a url scheme.

networked-qrcode-pairing's People

Contributors

jeromeetienne avatar

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.