# Unable to render more than 4 videos with SAB enabled on Chrome

**URL:** <https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371>\
**Category:** Video SDK\
**Tags:** video-sdk\
**Created:** [April 7, 2024, 4:11am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371 "2024-04-07T04:11:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 7, 2024, 4:11am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/1 "2024-04-07T04:11:31Z")

</div>

**Video SDK Type and Version**  
Video SDK 1.10.8 for Web

**Description**  
I am unable to render more than 4 videos in my Chrome (123.0.6312.106) browser.  
It works fine for Firefox 124.0.2

I have enabled SAB like the below in my SvelteKit server

```auto
response.headers.set('Cross-Origin-Embedder-Policy', 'require-corp');
response.headers.set('Cross-Origin-Opener-Policy', 'same-origin');

```

SAB Verification:

`self.crossOriginIsolated` is true in the console

Still, I am unable to subscribe to more than 4 videos. I have also set `enforceMultipleVideos: false`.

**Error?**  
`subscribe video counts greater than maximum size (4)`

**Troubleshooting Routes**  
Referencing sample app ([GitHub - zoom/videosdk-web-sample: Zoom Video SDK web sample](https://github.com/zoom/videosdk-web-sample)) ,  
I am using the same headers method for enabling SAB. And using the same canvas to render all videos. I don’t see what am I missing here.

**How To Reproduce**

Windows, Chrome 123.0.6312.106

1. Enable SAB like this

```auto
export async function handle({ event, resolve }) {
	const cookieString = event.request.headers.get('cookie');
	const user = await getAPIClient(fetch).getUser(cookieString);
	event.locals = { user, token: getTokenFromCookie(cookieString) };
	if (!canAccessEndpoint(user, event.url.pathname)) {
		error(403, 'Unauthorized access for server endpoint');
	}

	const response = await resolve(event);

	setCMIdCookie(event, response);

	response.headers.set('Cross-Origin-Embedder-Policy', 'require-corp');
	response.headers.set('Cross-Origin-Opener-Policy', 'same-origin');

	return response;
}

```

1. Create a canvas to paint all videos

```auto
<canvas id="participant-videos-canvas" width="1692" height="1285"></canvas>

<style>
	#participant-videos-canvas {
		width: 100%;
		height: auto;
	}
</style>

```

1. Init zoom using this function

```auto
async init() {
		await this.client.init('en-US', 'Global', { patchJsMedia: true, enforceMultipleVideos: false });
	}

```

1. Render all videos on an event

```auto
attachEventListeners() {
		this.client.on('peer-video-state-change', async () => {
			function sleep(ms) {
				return new Promise((resolve) => setTimeout(resolve, ms));
			}

			await sleep(5000); // Sleep for 5 seconds

			const participants = this.client.getAllUser();
			const layout = getVideoLayout(1692, 1285, participants.length);

			layout.forEach((cell, index) => {
				this.stream.renderVideo(
					document.querySelector('#participant-videos-canvas'),
					participants[index].userId,
					cell.width,
					cell.height,
					cell.x,
					cell.y,
					cell.quality
				);
			});
		});

```

1. Error on console “subscribe video counts greater than maximum size (4)”

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 7, 2024, 7:59am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/2 "2024-04-07T07:59:42Z")

</div>

Just checked that I am able to render more than 4 videos on Firefox 124.0.2.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 9, 2024, 2:59am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/3 "2024-04-09T02:59:45Z")

</div>

Hey @harshit.bhatt

Thanks for your feedback.

Could you share some problematic session ID with us for troubleshooting purposes?

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 9, 2024, 3:11am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/4 "2024-04-09T03:11:16Z")

</div>

Where do I find the session ID? @vic.yang

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 9, 2024, 4:06am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/5 "2024-04-09T04:06:07Z")

</div>

Hey @harshit.bhatt

You can locate it in your web account dashboard. Alternatively, if the session is ongoing, you can retrieve it by calling `client.getSessionInfo().sessionId` .

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 9, 2024, 6:37am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/6 "2024-04-09T06:37:07Z")

</div>

`6WZqakvFS3KANqv22zT3Vg==`  
@vic.yang

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 9, 2024, 7:24am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/7 "2024-04-09T07:24:56Z")

</div>

Hey @harshit.bhatt

> 6WZqakvFS3KANqv22zT3Vg==

Are you experiencing this issue while using Android Chrome?

For performance reasons, we limit the maximum number of videos to 4 on mobile devices.

In the next release, we’ll include an option in the `client.init` method to remove this limit.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 9, 2024, 9:50am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/8 "2024-04-09T09:50:50Z")

</div>

No, the issue is on Google Chrome DESKTOP. @vic.yang

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 10, 2024, 4:42am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/9 "2024-04-10T04:42:42Z")

</div>

@vic.yang need your help here. It is becoming urgent now.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 10, 2024, 6:31am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/10 "2024-04-10T06:31:02Z")

</div>

Hey @harshit.bhatt

I have checked all the logs, and only found the error related to video rendering on desktop Chrome.

> ‘INVALID\_PARAMETERS, reason: user is not sending video’

The error message typically indicates that the user being rendered either hasn’t started their video or is not present in the session.

This situation often arises when a user experiences a disconnection and reconnection or performs a page refresh, resulting in a change in the `userId` . To address this, please ensure that you listen for the `peer-video-state-change` or `user-updated` events to obtain the latest user who is currently sending video. This will help ensure the accuracy of the user’s video state.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 10, 2024, 7:38am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/11 "2024-04-10T07:38:18Z")

</div>

It seems to be working now. I’m able to render more than 4 videos on a page.

Session ID: `+rWnRXfuTzKBhLhX57c3DQ==`  
Browser: Chrome 123.0.6312.106 (Desktop)

To prevent same error from coming again, can you please check for `subscribe video counts greater than maximum size (4)` error log across all my sessions (including past sessions)?

@vic.yang

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [April 10, 2024, 7:59am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/12 "2024-04-10T07:59:35Z")

</div>

Hey @harshit.bhatt

I apologize, but we don’t have permission to query your sessions or view logs from your past sessions.

If you encounter any issues, please record the Session ID, and we can analyze them individually.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![harshit.bhatt](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/harshit.bhatt/32/58396_2.png) [@harshit.bhatt](https://devforum.zoom.us/u/harshit.bhatt)\
**Post date:** [April 21, 2024, 7:11am UTC](https://devforum.zoom.us/t/unable-to-render-more-than-4-videos-with-sab-enabled-on-chrome/107371/13 "2024-04-21T07:11:47Z")

</div>

My headers were not being set on client side routing (CSR) and hence SAB was not getting enabled.

Thanks for the support anyways @vic.yang
