From 8f0023b6ed4599ce0710faa4c61d71578a89faf8 Mon Sep 17 00:00:00 2001 From: zhang-xiaobo1997 Date: Wed, 8 Jun 2022 11:17:21 +0800 Subject: [PATCH] add imageReceiver use Signed-off-by: zhang-xiaobo1997 --- zh-cn/application-dev/media/image.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/zh-cn/application-dev/media/image.md b/zh-cn/application-dev/media/image.md index 9a9d03e87e..03ef5662e9 100644 --- a/zh-cn/application-dev/media/image.md +++ b/zh-cn/application-dev/media/image.md @@ -258,16 +258,36 @@ imagePackerApi.packing(imageSourceApi, packOpts) //编码完成,释放imagepacker imagePackerApi.release(); - + //用于获取imagesource信息 imageSourceApi.getImageInfo(imageInfo => { console.info('TC_045 imageInfo'); expect(imageInfo !== null).assertTrue(); done(); }) - + //用于更新增量数据 imageSourceIncrementalSApi.updateData(array, false, 0, 10,(error,data )=> {}) ``` +### ImageReceivert的使用 + +```js +//创建ImageReceiver +var receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1); + +//获取Surface ID +var surfaceId = await receiver.getReceivingSurfaceId(); + +receiver.on('imageArrival', () => { + //去获取Surface中的buffer的方法 + receiver.readNextImage((err, img) => { + img.getComponent(4, (err, componet) => { + //操作componet.byteBuffer + }) + }) +}) + +//调用方法将surfaceId传递给消费端。 +``` \ No newline at end of file -- GitLab