{"id":19030505,"url":"https://github.com/sofish/recorder.js","last_synced_at":"2025-09-08T18:34:32.436Z","repository":{"id":5928901,"uuid":"7148821","full_name":"sofish/recorder.js","owner":"sofish","description":"Using HTML5 to capture photo / video via the camera of your device","archived":false,"fork":false,"pushed_at":"2013-08-19T06:34:09.000Z","size":75,"stargazers_count":29,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-14T16:45:39.774Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofish.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-13T13:42:26.000Z","updated_at":"2022-10-15T12:45:38.000Z","dependencies_parsed_at":"2022-09-11T05:52:19.707Z","dependency_job_id":null,"html_url":"https://github.com/sofish/recorder.js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sofish/recorder.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Frecorder.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Frecorder.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Frecorder.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Frecorder.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofish","download_url":"https://codeload.github.com/sofish/recorder.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Frecorder.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274229371,"owners_count":25245188,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-08T21:18:19.562Z","updated_at":"2025-09-08T18:34:32.410Z","avatar_url":"https://github.com/sofish.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Recorder.js\n\nUsing Capture API (HTML5) to capture video / photo via the camera of your device.\n\nDEMO: baixing/fabu [使用摄像头传图](http://shanghai.sofish.baixing.cn/fabu/zhengzu#id_images)\n\n![demo image](https://f.cloud.github.com/assets/153183/984367/4167f0b2-0899-11e3-84aa-d5ea3e8c5e77.png)\n\n\n```js\n// detect api support\nif(Recorder.isSupported) console.log('oh yeah!');\n```\n\n### 1. Run the demo\n\n```sh\ngit clone git@github.com:sofish/recorder.js.git\n// open the `testcase/` dir on your browser\n```\n\n### 2. API\n\nUsing the API to run your own instance.\n\n#### 2.1 Play the media\n\n```js\n/* play vedio|audio\n * @param el {DOM Element} video/audio element to capture the stream\n * @param type {String} media type, the value can be: 'video', 'audio', or 'both'\n * @param callback {Function} callback to run when the media's metadata is load\n */\nRecorder.play(el, type, callback)\n```\n\n#### 2.2 Take a snapshot\n\nCapture a snapshot of the current image of the media stream. a DataURL string of the snapshot will be set as the return value.\n\n```js\n/* take picture\n * @param video {DOM Element} the video element\n * @param type {String} specify a type, like 'image/png'\n * @return Image {String: DataURL}\n */\nRecorder.snapshot(video, [type]);\n```\n\n#### 2.3 Upload snapshot\n\nAllow u to send snapshot to server\n\n```js\n/* upload to server\n * @param url {String} request url\n * @param data {Object} data to send\n * @param callback {Function} the first argument is the response\n */\nR.upload(url, data, [callback])\n```\n\n#### 2.4 Read files from input\n\nAllow u to read image files from `input[type=\"file\"]`:\n\n```js\n/* 读取 input[type=file] 选中的文件\n * @param input {HTML Element} input[type=file]\n * @returns {Array: Blob} 返回是文件的二进制形式 Blob\n */\nR.read(input);\n```\n\n### 3. Demo Code\n\n[testcase/index.html](https://github.com/sofish/recorder.js/blob/master/testcase/index.html)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofish%2Frecorder.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofish%2Frecorder.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofish%2Frecorder.js/lists"}