npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@potch/camera

v1.3.0

Published

getUserMedia powered camera helper class

Downloads

4

Readme

@potch/camera

a getUserMedia powered camera helper class

npm install @potch/camera

Camera Class

new Camera(options)

creates new Camera object.

options is an object with the following properties:

name | required? | type | default | description ---|---|---|---|--- selfie | no | Boolean | false | should the helper attempt to open the front-facing camera of the device first, if available? shape | no | String | auto | shape to crop images to. Accepts auto, 4:3, 3:4, and square constraints | no | Object | {} | additional constraints to request from the system when getting access to the camera.

Properties

.preview

The element that provides the camera viewfinder preview.

  let c = new Camera();
  document.body.appendChild(c.preview);

.selfie

Whether the camera preview is of the front-facing camera (true if it is). Read-only.

To change which camera is being previewed, use flip()

.paused

true/false Whether the camera preview is paused. Read-only.

Use pause() and resume() to change the preview status.

Methods

These are the intended public methods of the class. Other methods are available, but are subject to change.

init()

Starts the camera. Needs to be called in response to user action (like a click event) to avoid being blocked by the browser.

snap()

Returns a <canvas> containing the current frame as a still image.

flip()

Switches between the rear-facing and front-facing camera, if available.

Note: it's not possible to detect which cameras are available. If only one camera is available, flip will have no effect.

pause()

Pause the live camera preview.

resume()

Resume the live camera preview.

stop()

Pause the preview and fully close the getUserMedia session.