# Rendering the video from the ios camera is stuck

**URL:** https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958
**Category:** Questions
**Tags:** camera, ios
**Created:** [February 6, 2023, 2:43am UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958 "2023-02-06T02:43:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ERGOU](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ergou/32/27906_2.png) [@ERGOU](https://forum.babylonjs.com/u/ERGOU)
#### Post date: [February 6, 2023, 2:43am UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/1 "2023-02-06T02:43:55Z")

</div>

Please do not forget to add a link to a [Playground](https://playground.babylonjs.com/) to get a faster answer:

> **[Make the Best Use of the Forum | Babylon.js Documentation](https://doc.babylonjs.com/journey/forum)**
>
> Learn about the best place to get help, the Babylon.js forum.

```auto
  this.myPeer.on('call', (call: MediaConnection) => {
    const fromUserId: string = call.metadata.fromSessionId

    if (!this.onCalledPeers.has(call.peer)) {
      this.onCallList.push(call)
      console.log("收到call metadata", call.metadata)
      const fromUserId: string = call.metadata.fromSessionId
      const video = document.createElement('video');
      video.playsInline = true
      video.autoplay = false;
      video.preload = "none";
      video.controls = true;
      this.onCalledPeers.set(call.peer, { call, video });

      call.answer()
      call.on('stream', (userVideoStream: MediaStream) => {
        video.crossOrigin = "anonymous";
        video.srcObject = userVideoStream;
        const videoMaterial = new StandardMaterial('textVid', this.scene);
      videoMaterial.allowShaderHotSwapping = false;
      video.pause();
      video.addEventListener('loadedmetadata', () => {
        video.play();
        const scene = store.getState().room.rscene

        videoMaterial.specularColor = new Color3(0, 0, 0); // 设置让它不反光
        const videoTexture = new VideoTexture('video', video, scene, true, true);
        videoMaterial.diffuseTexture = videoTexture;
        store.getState().room.rscene!.getMeshByID("video-plane-" + userId)!.material = videoMaterial;
      });
      });
    }

  });

```

---

<div class="post-metadata">

### Author: ![ERGOU](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ergou/32/27906_2.png) [@ERGOU](https://forum.babylonjs.com/u/ERGOU)
#### Post date: [February 6, 2023, 2:45am UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/2 "2023-02-06T02:45:41Z")

</div>

Hello! I’m using webrct to fetch the user’s video and attach it next to the player in the scene, but the fps is significantly reduced when rendering videos from ios

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [February 6, 2023, 12:15pm UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/3 "2023-02-06T12:15:09Z")

</div>

cc @sebavan @bghgary who know more of iOS, but as many things in iOS I expect this to be their broken support for web standards 😕

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [February 6, 2023, 3:02pm UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/4 "2023-02-06T15:02:41Z")

</div>

Is the speed reduced ? or is the full video stuck ? (I am not able to repro locally)

---

<div class="post-metadata">

### Author: ![gunpowderfans](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gunpowderfans/32/37986_2.png) [@gunpowderfans](https://forum.babylonjs.com/u/gunpowderfans)
#### Post date: [February 7, 2023, 5:56am UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/5 "2023-02-07T05:56:08Z")

</div>

We work together, let me explain his problem:  
In a scene, there are planes showing real-time videoes from different users’ peers. For any user, if the camera saw the video plane by an iOS user, the frame rate reduces. This weird phenomenon happens for all platform’s browsers

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [February 7, 2023, 3:03pm UTC](https://forum.babylonjs.com/t/rendering-the-video-from-the-ios-camera-is-stuck/37958/6 "2023-02-07T15:03:22Z")

</div>

> [@gunpowderfans](#):
>
> For any user, if the camera saw the video plane by an iOS user, the frame rate reduces. This weird phenomenon happens for all platform’s browsers

Let me know if I understand correctly:

On IOS only, independently of the browser (makes sense as they are all webkit anyway), As soon as a video is displayed, the frame rate is dropping for the full 3d experience (not just the video). The video is created from a WebRTC remote feed ?

If the description is correct, can you try downresing the video you are capturing to see what happens ?
