HarmonyOS Camera kit 自定义相机,每次开启录像都会session.stop,再session.start。这个过程预览流会中断
await this.capSession.stop();
this.capSession.beginConfig();
if (this.photoOutput) {
this.capSession.removeOutput(this.photoOutput); // 移除拍照流
this.photoOutput = undefined
}
if (this.videoOutput) {
this.capSession.removeOutput(this.videoOutput) // 移除录像流
}
await this.createRecordOutput() // 创建拍照流
this.capSession.addOutput(this.videoOutput);
await this.capSession.commitConfig();
await this.capSession.start();
await this.videoOutput?.start();
await this.avRecorder?.start();
如上面代码,每次的开启录像,都会先session.stop,重新配置videoOutput,最后再session.start。这个过程预览流也会被短暂的终止,导致出现短暂的黑屏,影响用户体验。有没有办法,删除和添加videoOutput的过程不会终止预览流的输出。
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
自定义相机预览,切回后台再切换回来预览黑屏
1513浏览 • 1回复 待解决
【求助】自定义相机Camera2焦距异常
7707浏览 • 1回复 待解决
HarmonyOS Camera kit 双路预览方案频繁开关相机底层崩溃
141浏览 • 1回复 待解决
录像实现,如何自定义录像功能的实现
423浏览 • 1回复 待解决
Session Storage和Local Storage有什么异同?
135浏览 • 1回复 待解决
HarmonyOS 三方自定义相机在使用Camera kit时,拍摄获取的照片分辨率希望能够持平系统原生相机
182浏览 • 1回复 待解决
HarmonyOS camera预览退后台,不输出相机数据
132浏览 • 1回复 待解决
HarmonyOS 自定义相机拍照后数据展示
223浏览 • 1回复 待解决
能够提供HarmonyOS自定义相机案例吗?
92浏览 • 1回复 待解决
相机预览,相机预览是启动相机后看见的画面,通常在拍照和录像前执行。
638浏览 • 1回复 待解决
自定义界面扫码预览画面出现拉伸
1627浏览 • 1回复 待解决
Camera相机预览黑屏,拍照photoOutPut capture catch code:"7400104"
1474浏览 • 1回复 待解决
HarmonyOS PersistentStorage每次用IDE run都会被清除?
90浏览 • 1回复 待解决
Page里通过XComponent显示相机预览,应用切到后台再切到前台,相机预览画面变成黑色了
1306浏览 • 1回复 待解决
自定义弹窗自定义转场动画
664浏览 • 1回复 待解决
HarmonyOS 对于相机开发,是否有对应自定义组件,比如相机框,身份证框
174浏览 • 1回复 待解决
为什么我每次编译系统都会停在某处10分钟左右再执行?
4773浏览 • 1回复 已解决
HarmonyOS 使用 Camera kit 开发拍照页面, 正常预览状态进入后台后, 再回到应用, 页面不展示预览页面
106浏览 • 1回复 待解决
基于Camera Kit,获取相机流数据传递给native,进行压缩编码
614浏览 • 1回复 待解决
HarmonyOS 如何自定义BuildMode?
112浏览 • 1回复 待解决
HarmonyOS 有没有相对完整的自定义相机,拍照,保存图片的demo
146浏览 • 1回复 待解决
HarmonyOS自定义相机横向拍照,摄像头方向差了90度
156浏览 • 1回复 待解决
camera 获取预览数据
1456浏览 • 1回复 待解决
可以参考一下系统相机的实现方式:源码链接:https://gitee.com/openharmony/applications_camera
参考:common\src\main\ets\default\camera\CameraService.ts createSession StartRecording stopRecording