{"id":13431646,"url":"https://github.com/ccwukong/react-cam","last_synced_at":"2025-03-18T01:17:43.795Z","repository":{"id":32780431,"uuid":"142387170","full_name":"ccwukong/react-cam","owner":"ccwukong","description":"HTML5 Web/Mobile camera for ReactJS","archived":false,"fork":false,"pushed_at":"2022-12-10T20:35:02.000Z","size":1199,"stargazers_count":29,"open_issues_count":10,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-20T04:03:09.893Z","etag":null,"topics":["hybrid-app","pwa","react","reactjs","webcam","webcam-capture"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccwukong.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-26T04:07:33.000Z","updated_at":"2024-08-12T19:40:21.000Z","dependencies_parsed_at":"2023-01-14T22:15:34.355Z","dependency_job_id":null,"html_url":"https://github.com/ccwukong/react-cam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccwukong%2Freact-cam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccwukong%2Freact-cam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccwukong%2Freact-cam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccwukong%2Freact-cam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccwukong","download_url":"https://codeload.github.com/ccwukong/react-cam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243869178,"owners_count":20360967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hybrid-app","pwa","react","reactjs","webcam","webcam-capture"],"created_at":"2024-07-31T02:01:04.776Z","updated_at":"2025-03-18T01:17:43.772Z","avatar_url":"https://github.com/ccwukong.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-cam\n\n![npm](https://img.shields.io/npm/dw/react-cam.svg)\n\nHTML5 Web/Mobile camera for ReactJS\n\n# Installation\n\n## NPM\n\n```console\nnpm install react-cam\n```\n\n## Yarn\n\n```console\nyarn add react-cam\n```\n\n# How to use it?\n\n## props\n\n| Prop name   | Optional | Default   | Description                                                                    |\n| ----------- | -------- | --------- | ------------------------------------------------------------------------------ |\n| showFocus   | Yes      | false     | show/hide the blue focus box, basically useless...                             |\n| front       | Yes      | false     | true: front camera, false: rear camera                                         |\n| capture     | No       | None      | A function to handle base64 string image                                       |\n| width       | No       | 480       | Camera pixel width, percentage or absolute value                               |\n| height      | No       | 320       | Camera pixel height, percentage or absolute value                              |\n| focusWidth  | Yes      | 80%       | Camera focus box width, percentage or absolute value                           |\n| focusHeight | Yes      | 50%       | Camera focus box height, percentage or absolute value                          |\n| btnColor    | Yes      | '#2acef5' | Set color of the capture button                                                |\n| onError     | No       |           | Handles camera error, the error object will be passed as the function argument |\n\n## example\n\n```javascript\nimport React, { Fragment, useRef } from 'react';\nimport ReactDOM from 'react-dom';\nimport { Camera } from 'react-cam';\n\nfunction capture(imgSrc) {\n  console.log(imgSrc);\n}\n\nconst App = () =\u003e {\n  const cam = useRef(null);\n  return (\n    \u003cFragment\u003e\n      \u003cCamera\n        showFocus={true}\n        front={false}\n        capture={capture}\n        ref={cam}\n        width=\"80%\"\n        height=\"auto\"\n        focusWidth=\"80%\"\n        focusHeight=\"60%\"\n        btnColor=\"white\"\n      /\u003e\n      \u003cbutton onClick={img =\u003e cam.current.capture(img)}\u003eTake image\u003c/button\u003e\n    \u003c/Fragment\u003e\n  );\n};\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccwukong%2Freact-cam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccwukong%2Freact-cam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccwukong%2Freact-cam/lists"}