{"id":18885149,"url":"https://github.com/bozaigao/react-native-camera-continued-shooting","last_synced_at":"2025-04-14T21:31:01.756Z","repository":{"id":34982017,"uuid":"194004446","full_name":"bozaigao/react-native-camera-continued-shooting","owner":"bozaigao","description":"基于react-native-camera修改后的前后摄像头切换续拍组件,iOS原生端封装了视频格式转换(mov转mp4)、多个切片视频旋转拼接合成正向画面展示,Android原生端依赖ffmpeg第三方库lansongsdk,通过获取摄像头预览的frame YUV原始数据然后再通过前置和后置摄像头旋转算法生成mp4文件,最后通过ffmpeg合成整个正向画面视频","archived":false,"fork":false,"pushed_at":"2022-12-07T16:26:13.000Z","size":25738,"stargazers_count":15,"open_issues_count":7,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-25T07:21:01.414Z","etag":null,"topics":["camera","face-detection","react-native","rncamera","shooting","video-continued-shooting"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bozaigao.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":"2019-06-27T01:54:08.000Z","updated_at":"2023-10-15T16:37:25.000Z","dependencies_parsed_at":"2023-01-15T11:30:43.961Z","dependency_job_id":null,"html_url":"https://github.com/bozaigao/react-native-camera-continued-shooting","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/bozaigao%2Freact-native-camera-continued-shooting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bozaigao%2Freact-native-camera-continued-shooting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bozaigao%2Freact-native-camera-continued-shooting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bozaigao%2Freact-native-camera-continued-shooting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bozaigao","download_url":"https://codeload.github.com/bozaigao/react-native-camera-continued-shooting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223634064,"owners_count":17176877,"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":["camera","face-detection","react-native","rncamera","shooting","video-continued-shooting"],"created_at":"2024-11-08T07:17:04.926Z","updated_at":"2024-11-08T07:17:05.404Z","avatar_url":"https://github.com/bozaigao.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-camera-continued-shooting\n本组件是基于react-native-camera@1.0.2版本修改而成，如果是依赖其他版本的react-native-camera直接将Android和iOS对应的原生\n代码和src/Camera.js代码移植过去就行了，本组件主要是为了解决react-native-camera前后摄像头拍摄后拼接后的视频旋转角度问题，\n### iOS端的修改:\n集成了视频自动转换（mov转mp4，react-native-camera录制视频默认是mov格式的），以及视频拼接旋转；\n### Android端的修改:\n解决了react-native-camera组件在Android端的前置摄像头拍摄后的画面旋转适配问题，Android端不能通过简单的前后摄像头视频分开旋转拼接，这样的话里面的metadata会丢失而导致旋转属性丢失，所以只能通过处理更底层的frame YUV视频原始数据旋转全部帧，然后对视频片进行合并得到正向视频播放画面,由于视频处理so依赖比较多相对于其他视频处理sdk动不动就增加\u003cfont color=red\u003e18、19M\u003c/font\u003e，集成本组件的视频续拍功能Android端的apk大小仅增加\u003cfont color=red\u003e7M\u003c/font\u003e左右；\n### js端的修改:\n对Android和iOS原生接口做了统一封装，在rn层不需要再分平台单独处理，开始录像和恢复继续录像只需要调用this.camera.capture(),暂停录像this.camera.pauseCapture(),重拍this.camera.resetCamera()，停止录像this.camera.stopCapture().then((path) =\u003e {}).catch(err =\u003e console.error(err)),然后在promise回调里面处理录制好的视频本地地址就行。\n### 安装方法\n执行npm i react-native-camera-continued-shooting --save安装组件\n\nreact-native link react-native-camera-continued-shooting链接Android和iOS原生模块\n\n#### Android端额外配置\n将react-native-camera-continued-shooting/android/lib目录下的lansongsdk第三方依赖库拷贝到自己项目android目录下，然后在项目settings.gradle做以下配置,然后clean build运行\n```java\ninclude ':lansongsdk'\n```\n#### iOS端额外配置\n直接进入ios目录执行pod install然后关闭Xcode重新打开项目完成所有依赖.\n### 使用方法，其他属性和方法参照1.0.2版本的[react-native-camera](https://github.com/react-native-community/react-native-camera),续拍api调用参照以下代码\n```javascript\n//@ts-ignore\nimport Camera from 'react-native-camera-continued-shooting';\n\nrender() {\n        let {cameraType} = this.state;\n\n        return (\n            \u003cCamera\n                ref={(cam) =\u003e {\n                    this.camera = cam;\n                }}\n                orientation={'portrait'}\n                type={cameraType}\n                style={styles.preview}\n                captureAudio\n                autoFocus={'on'}\n                captureMode={Camera.constants.CaptureMode.video}\n                captureTarget={Camera.constants.CaptureTarget.temp}\n                aspect={Camera.constants.Aspect.fill}\u003e\n                {this.renderContent()}\n            \u003c/Camera\u003e\n        );\n    }\n\n    //开始录制视频\n    this.camera.startCapture();\n    //暂停录制视频\n    this.camera.pauseCapture();\n    //继续录制视频\n    this.camera.startCapture();\n    //终止录制视频\n     this.camera.stopCapture().then((path) =\u003e {\n                console.log('视频录制本地路径',path);\n            }).catch(err =\u003e console.error(err));\n    //重新录制视频\n    this.camera.resetCamera();\n    this.camera.startCapture();\n```\n\n### 录制效果\n![录制效果](./效果展示.gif)\n\n相关链接阿里云视频点播组件[react-native-aliyun-playview](https://github.com/bozaigao/react-native-aliyun-playview)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbozaigao%2Freact-native-camera-continued-shooting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbozaigao%2Freact-native-camera-continued-shooting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbozaigao%2Freact-native-camera-continued-shooting/lists"}