Mobile (and Desktop) Camera App Template (HTML, CSS, JS and WebRTC)
I like to experiment with Computer Vision and AI API's (like Azure Cognetive Services, Google Cloud Vision, IBM Watson) to see if I can utilise them for some ideas.
The most easy way to test those scripts and APIs them is by directly making a photo and sending image data to the API/script, instead of uploading files. I didn't find a fast mobile first camera template for HTML5 as a starting point for my prototypes, so I developed one myself. The interface setup is mainly inspired by the standard Android and iOS Cameras.
The template doesn't do anything with the image(canvas) data yet, I'll leave that up to you.
Feel free to use it in your next Computer Vision or AI project.
WebRTC is only supported on secure connections. So you need to serve it from https. You can test and debug in Chrome from localhost though (this doesn't work in Safari).
A recent OS and browser. It should work on recent Phones and OS-es. If it isn't, please let me know (issue) (including a suggestion to fix it). Also add the debugging info in the console.
- Fullscreen mode (not on Safari mobile (iOS))
- Take Photo
- Flip Camera (environment / user)
- Supports both portrait and landscape mode
Check the demo
- Fullscreen functionality: Screenfull.js
- Detect WebRTC support: DetectRTC.js
- WebRTC cross-browser: Adapter.js
- UI click sound: Howler.js
- "Basic Click Wooden" - by GameAudio
- Material Design Icons (camera front, camera rear, photo camera, fullscreen, fullscreen exit)
- Chrome Android 8.0 (Nokia 5)
- Chrome 65 - MacOs 10.12.6
- Safari 11.0.3 - MacOs 10.12.6
- Safari mobile - iOS 11