# How to get image Data from recipient video canvas?

**URL:** <https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101>\
**Category:** Web\
**Created:** [October 1, 2019, 3:53pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101 "2019-10-01T15:53:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeepv](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sandeepv](https://devforum.zoom.us/u/sandeepv)\
**Post date:** [October 1, 2019, 3:53pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/1 "2019-10-01T15:53:35Z")

</div>

I am using zoom web sdk for video conferencing feature. i am able do video call with sample-app-web.  
Now i want to integration a third-party AI tool to analyse user emotions during call. For this, i need access to recipient(peer2) video frames(image data of canvas) during video conferencing. which is required as input to AI tool.

I am able query Peer1(canvas[id=“suspension-my-canvas”]) to get the image Data. but not able to get image data from peer2 in the same way. it seems canvas context type is different for peer1 and peer2. Please see the attach screenshot for reference.

AI tool : [https://knowledge.affectiva.com/v3.2/docs/analyze-a-video-frame-stream-4](https://knowledge.affectiva.com/v3.2/docs/analyze-a-video-frame-stream-4)

**To Reproduce(If applicable)**  
Please refer to screenshot

**Screenshots**

 ![46%20PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/9/9d90c869ea48be2c0f4d07db48e790c2cf018947.jpeg)

Anyone could help me to get the image data of Peer2 either from video tag or canvas.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 2, 2019, 4:06pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/2 "2019-10-02T16:06:51Z")

</div>

Hey @sandeepv, thanks for posting and using Zoom!

I was able to get the canvas for the attendee with `canvas[id=sv-active-video]`

 ![50%20AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/8/8e33508ccba6fe2b1bbe89182e19a0ab35594c83.jpeg)

Let me know if that helps!

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![sandeepv](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sandeepv](https://devforum.zoom.us/u/sandeepv)\
**Post date:** [October 3, 2019, 2:46pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/3 "2019-10-03T14:46:01Z")

</div>

> [@tommy](#):
>
> sv-active-video

Thanks @tommy, I can also get the canvas by querying the DOM but i am not able to get the canvas[‘sv-active-video’] context. it returns null as below

```
const myCanvas = document.getElementById('sv-active-video');
const context = myCanvas.getContext('2d') //context value is null now. 

```

but with peer1 canvas[id=“suspension-my-canvas”], i can get the context and able to get the image data out of it.

```
const myCanvas = document.getElementById('suspension-my-canvas');
const context = myCanvas.getContext('2d')  

```

` //console.log context output`

 ![48%20PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/1/1ff277d99fe63cd967b875e4e210bed9347db23c.png)

`context.getImageData(0, 0, context.canvas.width, context.canvas.height);`

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 3, 2019, 4:30pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/4 "2019-10-03T16:30:00Z")

</div>

Hey @sandeepv,

Seems this is not Zoom specific. I am guessing you are requesting `document.getElementById('sv-active-video').getContext('2d')` before the page has loaded. Have you tried googling this issue?

> <https://stackoverflow.com/questions/6796194/canvas-getcontext2d-returns-null>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![sandeepv](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sandeepv](https://devforum.zoom.us/u/sandeepv)\
**Post date:** [October 4, 2019, 3:19pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/5 "2019-10-04T15:19:06Z")

</div>

@tommy, NO i am not requesting before DOM load. i am doing after call started. in console.  
`document.getElementById('sv-active-video').getContext('2d')`

you can try sample web app, create a meeting and open application in two tabs to join the meeting and try to access `document.getElementById('sv-active-video').getContext('2d')`. you will get null

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 4, 2019, 4:28pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/6 "2019-10-04T16:28:05Z")

</div>

Hey @sandeepv,

Yes I can reproduce the `null`.

This is not a bug on Zooms end, I would suggest trying an alternative way to get the canvas or trying in a different browser.

> <https://stackoverflow.com/questions/40482586/getcontext2d-returns-null-in-safari-10/43482153#43482153>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![sandeepv](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sandeepv](https://devforum.zoom.us/u/sandeepv)\
**Post date:** [October 5, 2019, 8:04am UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/7 "2019-10-05T08:04:15Z")

</div>

@tommy, i didn’t say. it’s zoom sdk bug. i asked how to get imagedata from canvas[id=sv-active-video] since it’s returning null with getContext(‘2d’). there can be other context type like webgl, 3d… Do you know which type of context canvas[id=sv-active-video] has?

At least my i know how zoom sdk draw image on canvas[id=sv-active-video]?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 7, 2019, 3:38pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/8 "2019-10-07T15:38:06Z")

</div>

Hey @sandeepv,

I tried with `webgl` and it worked! 🙂

`document.getElementById('sv-active-video').getContext('webgl')`

![29%20AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/1/1cb27f10354657c503ea5c8b389c6661ea2b9053.png)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![sandeepv](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sandeepv](https://devforum.zoom.us/u/sandeepv)\
**Post date:** [October 11, 2019, 6:15pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/9 "2019-10-11T18:15:39Z")

</div>

Hi @tommy, Thanks for the response but now context instance giving getImageData is not a function

document.getElementById(‘sv-active-video’).getContext(‘webgl’)  
context.getImageData(0, 0, context.canvas.width, context.canvas.height);  
**context.getImageData is not a function**

So my original question still open **"how to get image data from ‘sv-active-video’ canvas?**

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 11, 2019, 11:34pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/10 "2019-10-11T23:34:21Z")

</div>

Hey @sandeepv,

Unfortunately getting the image data is not a feature we support or have documented.

My best suggestion is to reach out to [https://knowledge.affectiva.com](https://knowledge.affectiva.com) to have them help.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![ke-kudo](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@ke-kudo](https://devforum.zoom.us/u/ke-kudo)\
**Post date:** [February 18, 2020, 5:50am UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/11 "2020-02-18T05:50:10Z")

</div>

I need a snapshot.  
Are there any plans for implementation?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [February 18, 2020, 5:02pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/12 "2020-02-18T17:02:54Z")

</div>

Hey @ke-kudo,

We are working on something like this, but do not have a timeline.

You can stay updated here: [https://marketplace.zoom.us/docs/changelog](https://marketplace.zoom.us/docs/changelog)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 7:24pm UTC](https://devforum.zoom.us/t/how-to-get-image-data-from-recipient-video-canvas/6101/13 "2020-08-21T19:24:39Z")

</div>

Closed on August 21, 2020, 7:24pm UTC


