camera-viewer's People
Forkers
nickcrabtree matthewdfleming simonmaris fgnoe namikiri letrungkien larry273 j-nagle ryanzoho9 dirtroadcosmos sreyemnayr ericandrechek gressus neilkrichi alanhella trevcancamera-viewer's Issues
No Camera Change iOS13.4.5
Can‘t change Camera (Front/Back) on iOS 13.4.5
Doesn't wait for prompt
Hey there.. love this little bit of code, super handy. One thing I noticed is that the code doesn't really wait for the getUserMedia()
call to complete before calling enumerateDevices()
.. so my phone wasn't enabling both cameras because I hadn't accepted the use prior to the looping over the enumeration.
I would have created a patch but was messing around so much that the code looks kinda horrible.. instead here's the relevant parts:
function successCallback(stream) {
currentStream = stream;
video.srcObject = stream;
video.play();
if (location.href.includes('&debug')) {
console.log(`stream: ${stream}`);
}
// PATCH: return the enumerate here as a promise..
return navigator.mediaDevices.enumerateDevices();
}
function errorCallback(error) {
window.alert('Error: ', error);
}
navigator.mediaDevices.getUserMedia({audio: false, video: true})
.then(successCallback)
// PATCH: so we can then after the prompt, enumerate the devices
.then(media_devices => {
media_devices.forEach(media_device => {
if (location.href.includes('&debug')) {
console.log(media_device);
}
if (media_device.kind === 'videoinput') {
cameras = cameras.concat(media_device.deviceId);
}
})
})
.catch(errorCallback);
Support rear camera
It would be great if there would be another site for the rear (non-selfie) camera.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.