PHtread Not Defined Error on Video Start or Render

Hi @vic.yang ,

Good day!

I consistently encountered this error, usually only on the “first” time I connect (accepted) a session, and when I activate the startVideo and renderVideo, causing a the Peer video not to display.

This is usually gone on my second and succeeding session.

Please have a look and let me know my best direction.

Regards,

eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1 Uncaught ReferenceError: PThread is not defined
    at Sr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:123315)
    at yr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:130967)
    at xr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:132211)
    at eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:162896
Sr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
yr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
xr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
(anonymous) @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1 Uncaught ReferenceError: PThread is not defined
    at Sr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:123315)
    at yr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:130967)
    at xr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:132211)
    at eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:162896
Sr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
yr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
xr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
(anonymous) @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1 Uncaught ReferenceError: PThread is not defined
    at Sr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:123315)
    at yr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:130967)
    at xr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:132211)
    at eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:162896
Sr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
yr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
xr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
(anonymous) @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1 Uncaught ReferenceError: PThread is not defined
    at Sr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:123315)
    at yr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:130967)
    at xr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:132211)
    at eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:162896
Sr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
yr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
xr @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
(anonymous) @ eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1
eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1 Uncaught ReferenceError: PThread is not defined
    at Sr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:123315)
    at yr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:130967)
    at xr (eb544e03-5ca1-4a4f-9aee-bcbdd1657752:1:132211)

Hey @neiloswald

Thanks for your feedback.

Could you please provide the OS, browser, and version info?

Thanks
Vic

Hi @vic.yang

I am using Zoom Video SDK v1.4.0 .

CHROME VERSION
104.0.5112.79
OS VERSION
Mac OS X: 12.5.0
cpu_arch
arm64

Hey @neiloswald

Could you share some code snippets that lead to the error? It’s very helpful in helping us to troubleshoot the issue.

Thanks
Vic

Thank you @vic.yang for attending my issue!

Here is my start / render video:

   myStartVideo: async function (
      canvasElem: HTMLCanvasElement,
      videoElem: HTMLVideoElement
    ) {
      console.log("=== PLATFORMS ===", getPlatforms());
      if (zoomClient.getCurrentUserInfo().bVideoOn == true) {
        console.log("=== DO NOTHING! Video Already On === ");
        return;
      }

      this.selfViewType = "canvas";

      console.log("=== myStartVideo ===", this.selfViewType as string);

      const cameras = zoomStream.getCameraList();
      console.log("=== CAMERAS ===", JSON.stringify(cameras));
      console.log(
        "=== ACTIVE CAMERA ===",
        JSON.stringify(zoomStream.getActiveCamera())
      );

      console.log(
        "=== BROWSER SUPPORTS OffscreenCanvas ===",
        this.isSupportOffscreenCanvas
      );
      console.log(
        "=== ZOOM STREAM SUPPORTS MultipleVideos ===",
        zoomStream.isSupportMultipleVideos()
      );

      const isUsingVideoElementToStartVideo =
        this.isSupportOffscreenCanvas && !zoomStream.isSupportMultipleVideos();
      const isRenderingSingleVideoOnCanvas =
        !this.isSupportOffscreenCanvas && !zoomStream.isSupportMultipleVideos();

      // if (typeof isVideoOn !== "boolean" || prevIsSelfVideoOn === isVideoOn) {
      //   return;
      // }

      const canvas = isRenderingSingleVideoOnCanvas
        ? this.selfCanvas
        : this.videoCanvas;

      if (isUsingVideoElementToStartVideo) {
        console.log("=== START VIDEO (USING VIDEO ELEMENT) ===");
        // this also renders the video
        videoElem.style.display = "block";
        videoElem.style.width = this.selfViewWidth.toString();
        // videoElem.style.left = "50%";
        await zoomStream.startVideo({ videoElement: videoElem });
      } else {
        console.log("=== START VIDEO ===");
        await zoomStream.startVideo().catch((error) => {
          console.error("=== START VIDEO (error) ===", JSON.stringify(error));
        });
        // render the video in canvas
        if (isRenderingSingleVideoOnCanvas) {
          // render self view in separate canvas
          const h = Math.round((this.canvasHeight * 0.2) / 1.2);
          const w = Math.round((h * 16) / 9);

          console.log("=== SELF VIEW SIZE (w,h)===", w, h, canvas);
          zoomStream.renderVideo(
            canvas,
            zoomClient.getCurrentUserInfo().userId,
            this.selfViewWidth,
            this.selfViewHeight,
            0,
            0,
            VideoQuality.Video_360P
          );
        } else {
          // render self view in main canvas
          const h = Math.round((this.canvasHeight * 0.2) / 1.2);
          const w = Math.round((h * 16) / 9);

          console.log("=== SELF VIEW SIZE (w,h)===", w, h, canvas);
          zoomStream.renderVideo(
            canvas,
            zoomClient.getCurrentUserInfo().userId,
            this.selfViewWidth,
            this.selfViewHeight,
            0,
            0,
            VideoQuality.Video_360P
          );
        }
      }

Hey @neiloswald

It seems the logic of the code is fine. Under what condition did you have the error? What is the result of window.crossOriginIsolated on the console?

By the way. Would you like to refer to our sample app? It’s a best practice of using the Video SDK Web.

Thanks
Vic

HI @vic.yang ,

window.crossOriginIsolated is false running on my local(?) .

=== COMMAND CHANNEL === {"senderId":"33555456","senderName":"木下 早苗","text":"COMMAND_READY","timestamp":1660569081875,"msgid":"5549F5D2-940B-9804-E246-943C17C9EA8C"}
call.ts?99b2:505 === COMMAND CHANNEL (now) ===  READY
index.js?e1de:192 === DISPATCH myToggleVideo === canvas
call.ts?99b2:1200 === PLATFORMS === ['desktop']
call.ts?99b2:1206 === CROSS ORIGIN ISOLATED === false
call.ts?99b2:1210 === myStartVideo === canvas
call.ts?99b2:1213 === CAMERAS === [{"deviceId":"f734ec2fd1c5027f30ec46842b44cd79112f0b62194a2ea8a2624258fe96a18f","label":"FaceTime HD Camera"}]
call.ts?99b2:1214 === ACTIVE CAMERA === "default"
call.ts?99b2:1219 === BROWSER SUPPORTS OffscreenCanvas === true
call.ts?99b2:1223 === ZOOM STREAM SUPPORTS MultipleVideos === true
call.ts?99b2:1249 === START VIDEO ===
call.ts?99b2:1274 === SELF VIEW SIZE (w,h)=== 107 60 <canvas id=​"video-canvas" class=​"video-canvas" width=​"640" height=​"360">​

Yes, we tried checking your sample.app and adopted important points.

Please share the Sample App, in case you are referring to a different app.

Thanks.

Hey @neiloswald

Sorry for forgetting to add the Sample App link in the post. Here is the link: videosdk-web-sample/purejs-demo at master · zoom/videosdk-web-sample · GitHub

Thanks
Vic

Hi @vic.yang,

We are actually utilizing this sample app. Thank you.

We will give further feedback, if we encountered major issues.

Regards,