HarmonyOS 使用createPixelMapFromSurface一直报错62980178?

使用XComponent播放视频,Xcomponent无论是设置 Surface、Texture类型,在使用image.createPixelMapFromSurface创建pixMap时候一直报错。

let region: image.Region =
  { size: { height: 100, width: 120 }, x: 0, y: 0 };
image.createPixelMapFromSurface(surfaceid, region).then((pixmap) => {
  this.pix_map = pixmap
  LogUtils.LOGI(this.TAG, "Success to create pixelmap.")
}).catch((res: string) => {
  LogUtils.LOGI(this.TAG,
    "Failed to create pixelmap. code is " + res) // 一直报错 62980178
});
阅读 460
1 个回答

传的surfaceid存在问题,所传的let surfaceid = this.dataArray[0].id建议更改为surfaceid=this.xcomponentController.getXComponentSurfaceId(); 是没有问题的。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进