From 72f35415009f10fa0295f34efc7a012150529560 Mon Sep 17 00:00:00 2001 From: tongxu-liu1 Date: Sun, 24 Apr 2022 23:08:54 +0800 Subject: [PATCH] Modify the camera.md Signed-off-by: tongxu-liu1 --- zh-cn/application-dev/media/camera.md | 58 +++++++++++++-------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/zh-cn/application-dev/media/camera.md b/zh-cn/application-dev/media/camera.md index 1eb7c19276..77e5450978 100644 --- a/zh-cn/application-dev/media/camera.md +++ b/zh-cn/application-dev/media/camera.md @@ -14,33 +14,7 @@ 包含流程:创建实例、参数设置、会话管理、拍照、录像、释放资源等。 -Xcomponent创建方法可参考:[XComponent创建方法] - -#### XComponent创建方法 -预览画面显示需要获取SurfaceId - -```js -mXComponentController: XComponentController = new XComponentController //创建XComponentController - -build() { - Flex() { - XComponent({ //创建XComponent - id: '', - type: 'surface', - libraryname: '', - controller: this.mXComponentController - }) - .onload(() => { //设置onload回调 - //设置Surface宽高(1920*1080) - this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}) - //获取Surface ID - globalThis.surfaceId = mXComponentController.getXComponentSurfaceId() - }) - .width('1920px') //设置XComponent宽度 - .height('1080px') //设置XComponent高度 - } -} -``` +Xcomponent创建方法可参考:[XComponent创建方法](#xcomponent创建方法) #### 创建实例 @@ -117,11 +91,7 @@ camera.createPhotoOutput((photoSurfaceId), (err, output) => { console.log('Callback returned with the PhotoOutput instance.'); photoOutput = output }); -//保存照片 -``` -照片保存方法可参考:[照片保存方法示例] -```js //创建视频录制的参数 let videoProfile = { audioBitrate : 48000, @@ -439,4 +409,30 @@ await captureSession.release((err) => { } console.log('Callback invoked to indicate that the CaptureSession instance is released successfully.'); }); +``` + +#### XComponent创建方法 +预览画面显示需要获取SurfaceId + +```js +mXComponentController: XComponentController = new XComponentController //创建XComponentController + +build() { + Flex() { + XComponent({ //创建XComponent + id: '', + type: 'surface', + libraryname: '', + controller: this.mXComponentController + }) + .onload(() => { //设置onload回调 + //设置Surface宽高(1920*1080) + this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}) + //获取Surface ID + globalThis.surfaceId = mXComponentController.getXComponentSurfaceId() + }) + .width('1920px') //设置XComponent宽度 + .height('1080px') //设置XComponent高度 + } +} ``` \ No newline at end of file -- GitLab