LookForwardPersistence / mediadevices-camera-selection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mediaDevices Camera Selection

An example of using the mediaDevices API to choose a user's camera.

đź“– Read about how the code works in this blog post on choosing cameras in JavaScript with the mediaDevices API.

See it in action

You can test this project by visiting it online here.

Run the project yourself

You should run this project on a local web server. I like to use serve for this, but you can do so as you choose.

Clone or download the repo, then change into the directory and host the files.

git clone https://github.com/philnash/mediadevices-camera-selection.git
cd mediadevices-camera-selection

If you want to use serve, you can install and use it with npm like so:

npm install
npm start

The page will be available at localhost:5000/index.html.

Viewing on a mobile device.

If you want to test this on a mobile device, you will need to make a tunnel to your local machine. I recommend you use ngrok for this. You can download and install ngrok from ngrok.com. Once you have it installed, run

ngrok http 5000

This will open a tunnel to the locally hosted project. You will get two randomly generated URLs, enter the HTTPS version into the browser in your mobile device.

About

License:MIT License


Languages

Language:JavaScript 53.9%Language:HTML 25.6%Language:CSS 20.5%