# Add image virtual background in client view

**URL:** <https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782>\
**Category:** Meeting SDK\
**Created:** [August 1, 2024, 4:08am UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782 "2024-08-01T04:08:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shafanaura48](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shafanaura48/32/61973_2.png) [@shafanaura48](https://devforum.zoom.us/u/shafanaura48)\
**Post date:** [August 1, 2024, 4:08am UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782/1 "2024-08-01T04:08:19Z")

</div>

**Ask**  
how to **add image virtual background option** in **client view** like on **desktop app**?

**Stack**  
Nextjs

**Screenshot**  
in down below (reply)

**Code**

```auto
"use client";

import config from "@/config/config";
import { buildQueryString } from "@/utils/string";
import { ZoomMtg } from "@zoom/meetingsdk";
import { useRouter, useSearchParams } from "next/navigation";
import { ChangeEvent, useEffect, useState } from "react";
import Button from "../Button";
import styles from "./style.module.css";

const { zoom } = config;

interface IMeetingData {
  name: string;
  mn: string;
  passcode: string;
}

interface ZoomSignatureResponse {
  signature: string;
}

const initializeZoomMeeting = (signature: string, data: IMeetingData) => {
  ZoomMtg.i18n.load(zoom.lang as any);
  ZoomMtg.init({
    leaveUrl: `${zoom.leaveUrl}?${buildQueryString(data)}`,
    disableRecord: true,
    isSupportChat: false,
    success: () => joinZoomMeeting(signature, data),
    error: (error: any) => console.error("Zoom initialization error:", error),
  });
};

const joinZoomMeeting = (signature: string, data: IMeetingData) => {
  ZoomMtg.join({
    sdkKey: zoom.clientId,
    signature,
    meetingNumber: data.mn,
    passWord: data.passcode,
    userName: data.name,
    success: (success: any) =>
      console.log("Successfully joined the meeting", success),
    error: (error: any) => console.error("Error joining the meeting:", error),
  });
};

const ZoomMeeting = () => {
  const [isLoading, setIsLoading] = useState(false);
  const [meetingData, setMeetingData] = useState<IMeetingData>({
    name: "",
    mn: "",
    passcode: "",
  });
  const [showForm, setShowForm] = useState(true);
  const searchParams = useSearchParams();
  const { replace } = useRouter();

  const getSignature = async (meetingNumber: string): Promise<string> => {
    try {
      const response = await fetch("/api/zoom", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ meetingNumber, role: 0 }),
      });

      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }

      const data: ZoomSignatureResponse = await response.json();
      if (!data.signature) {
        throw new Error("Failed to get signature");
      }

      return data.signature;
    } catch (error) {
      console.error("Error getting signature:", error);
      throw error;
    }
  };

  const handleMeetingSetup = async (data: IMeetingData) => {
    setIsLoading(true);
    try {
      replace(`?${buildQueryString(data)}`);
      const signature = await getSignature(data.mn);
      initializeZoomMeeting(signature, data);
    } catch (error) {
      console.error("Error setting up the meeting:", error);
    } finally {
      setIsLoading(false);
    }
  };

  const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
    const { name, value } = e.target;
    setMeetingData((prev) => ({ ...prev, [name]: value }));
  };

  useEffect(() => {
    const name = searchParams.get("name") || "";
    const mn = searchParams.get("mn") || "";
    const passcode = searchParams.get("passcode") || "";
    setMeetingData({ name, mn, passcode });

    if (name !== "" && mn !== "") {
      setShowForm(false);
      handleMeetingSetup({
        name,
        mn,
        passcode,
      });
    } else {
      setShowForm(true);
    }
  }, [searchParams]);

  if (!showForm) {
    return null;
  }

  return (
    <main className={styles.container}>
      <h1 className={styles.title}>Join Zoom Meeting</h1>
      <form
        onSubmit={(e) => {
          e.preventDefault();
          handleMeetingSetup(meetingData);
        }}
        className={styles.form}
      >
        {(["name", "mn", "passcode"] as const).map((field) => (
          <div key={field} className={styles.formGroup}>
            <label className={styles.label}>
              {field === "mn"
                ? "Meeting Number"
                : `${field.charAt(0).toUpperCase() + field.slice(1)}`}
            </label>
            <input
              className={styles.input}
              placeholder={`Enter ${field === "mn" ? "meeting number" : field}`}
              value={meetingData[field]}
              name={field}
              onChange={handleInputChange}
              required={field !== "passcode"}
            />
          </div>
        ))}
        <Button type="submit" disabled={isLoading}>
          {isLoading ? "Loading..." : "Join Meeting"}
        </Button>
      </form>
    </main>
  );
};

export default ZoomMeeting;

```

---

<div class="post-metadata">

**Author:** ![shafanaura48](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shafanaura48/32/61973_2.png) [@shafanaura48](https://devforum.zoom.us/u/shafanaura48)\
**Post date:** [August 1, 2024, 4:13am UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782/2 "2024-08-01T04:13:00Z")

</div>

**Screenshot**  
client view:

 ![screenshot-1722484985372](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/c/2/c273ee786747328b89ee89eafd8b417c78125bdc.png)  
desktop app: ![screenshot-1722485025666](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/4/0/40030a428378cf0acef4419c9fec09113c47a931.jpeg)

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [August 1, 2024, 8:02pm UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782/3 "2024-08-01T20:02:57Z")

</div>

Hey @shafanaura48  
Thanks for reaching out!  
I am happy to help here!  
there is a method available for the Zoom meeting SDK for web to setVirtualBackground

> **[setVirtualBackground | Zoom Meeting SDK for Web](https://marketplacefront.zoom.us/sdk/meeting/web/functions/ZoomMtg.setVirtualBackground.html)**
>
> Documentation for Zoom Meeting SDK for Web

---

<div class="post-metadata">

**Author:** ![vinjey](https://avatars.discourse-cdn.com/v4/letter/v/4bbf92/32.png) [@vinjey](https://devforum.zoom.us/u/vinjey)\
**Post date:** [September 5, 2024, 11:14am UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782/4 "2024-09-05T11:14:48Z")

</div>

Hello @elisa.zoom  
I am facing similar issue,

I am using Meeting SDK of latest version in my reactJS web to enable zoom meeting.  
I am using Client view component

Also SharedArrayBuffer is there to enable the virtual background and other features.

Everything is working fine but, I am not getting (+) button of add custom virtual background.  
Like i am not seeing option to upload a custom image for VB. Do i have to do any extra configuration in my code for this?

Can you please help me with that.  
Thanks.

Attached Screenshot for the reference.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/3/e394e05cd75dccab18710c0be8cf899bd60934c4.png)

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 13, 2024, 7:43pm UTC](https://devforum.zoom.us/t/add-image-virtual-background-in-client-view/114782/5 "2024-09-13T19:43:48Z")

</div>

Hi @vinjey and @shafanaura48  
Sorry for the late reply !  
This behavior is not available at the moment.  
you can set virtual background with a method I shared but the Add image button is not available at the moment
