mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Pose landmarker running on IOS WKWebview returns an error: Creating a context with WebGL 2 failed: UNKNOWN: emscripten_webgl_create_context() returned error 0 (vision_wasm_internal.js, line 1087)

Open galharth opened this issue 2 years ago • 4 comments

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

No

OS Platform and Distribution

iOS 16.4.1

Mobile device if the issue happens on mobile device

Iphone

Browser and version if the issue happens on browser

No response

Programming Language and version

Javascript

MediaPipe version

No response

Bazel version

No response

Solution

Pose

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

No response

Xcode & Tulsi version (if issue is related to building for iOS)

No response

Describe the actual behavior

FilesetResolver.forVisionTasks(
      "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm"
    ).then((vision) => {


      poseLandmarker =  PoseLandmarker.createFromOptions(vision, {
        baseOptions: {
          modelAssetPath: `https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`,
          delegate: "CPU"
        },
        runningMode: "VIDEO",
        numPoses: 1
      }).then((poseLandmarker) => {

});

The code when running on WKWebview inside an iOS app returns:

[Warning] I0000 00:00:1685603814.329000       1 gl_context_webgl.cc:81] Couldn't create webGL 2 context. (vision_wasm_internal.js, line 1087)
[Warning] W0000 00:00:1685603814.337000       1 gl_context_webgl.cc:106] Creating a context with WebGL 2 failed: UNKNOWN: emscripten_webgl_create_context() returned error 0 (vision_wasm_internal.js, line 1087)
[Warning] === Source Location Trace: ===  (vision_wasm_internal.js, line 1087)
[Warning] third_party/mediapipe/gpu/gl_context_webgl.cc:82 (vision_wasm_internal.js, line 1087)
[Warning] W0000 00:00:1685603814.340000       1 gl_context_webgl.cc:107] Fall back on WebGL 1. (vision_wasm_internal.js, line 1087)
[Warning] I0000 00:00:1685603814.340000       1 gl_context_webgl.cc:81] Couldn't create webGL 1 context. (vision_wasm_internal.js, line 1087)
[Warning] W0000 00:00:1685603814.340000       1 gl_context.cc:1000] OpenGL error checking is disabled (vision_wasm_internal.js, line 1087)
[Warning] E0000 00:00:1685603814.340000       1 gl_graph_runner_internal.cc:252] StartGraph failed: INTERNAL: Service "kGpuService", required by node mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_detector_posedetectorgraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageCloneCalculator, was not provided and cannot be created: emscripten_webgl_create_context() returned error 0; StartRun failed (vision_wasm_internal.js, line 1087)
[Warning] === Source Location Trace: ===  (vision_wasm_internal.js, line 1087)
[Warning] third_party/mediapipe/framework/calculator_graph.cc:651 (vision_wasm_internal.js, line 1087)
[Warning] third_party/mediapipe/framework/calculator_graph.cc:682 (vision_wasm_internal.js, line 1087)
[Warning] third_party/mediapipe/framework/calculator_graph.cc:551 (vision_wasm_internal.js, line 1087)
[Warning] research/drishti/app/pursuit/wasm/graph_utils.cc:87 (vision_wasm_internal.js, line 1087)

Describe the expected behaviour

FilesetResolver.forVisionTasks(
      "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm"
    ).then((vision) => {


      poseLandmarker =  PoseLandmarker.createFromOptions(vision, {
        baseOptions: {
          modelAssetPath: `https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`,
          delegate: "CPU"
        },
        runningMode: "VIDEO",
        numPoses: 1
      }).then((poseLandmarker) => {

});

Should return poselandmarker object successfully

Standalone code/steps you may have used to try to get what you need

Try to run poselandmarker on WKWebview inside iOS app based on mediapipe codepen:
https://codepen.io/mediapipe-preview/pen/abRLMxN

Other info / Complete Logs

No response

galharth avatar Jun 01 '23 07:06 galharth

Adding an empty canvas to the html and referencing it in poselandmarker init solved the bug, don't really understand why (it's not written in the documentation as far as I know):

  poseLandmarker =  PoseLandmarker.createFromOptions(vision, {
    baseOptions: {
      modelAssetPath: `https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`,
      delegate: "GPU"
    },
    canvas: document.getElementById('canvas-test2'),
    runningMode: "VIDEO",
    numPoses: 1
  }).then((poseLandmarker) => {});

galharth avatar Jun 05 '23 08:06 galharth

@galharth,

Thanks for the confirmation, We are forwarding this issue to understand better and let you know the update on it.

kuaashish avatar Jun 26 '23 09:06 kuaashish

Hi @galharth,

Could you please inform us if the issue still persists on your end or if it has been resolved?

Thank you!!

kuaashish avatar Apr 23 '24 08:04 kuaashish

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar May 01 '24 01:05 github-actions[bot]

This issue was closed due to lack of activity after being marked stale for past 7 days.

github-actions[bot] avatar May 09 '24 01:05 github-actions[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar May 09 '24 01:05 google-ml-butler[bot]