# An issue with screen sharing in Safari 17.4

**URL:** <https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [June 19, 2024, 3:24pm UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227 "2024-06-19T15:24:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [June 19, 2024, 3:24pm UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/1 "2024-06-19T15:24:46Z")

</div>

An issue with screen sharing in Safari.  
The issue occurs **only in Safari**.  
Screen sharing works fine in all other browsers.

When using screen sharing in Safari, a WebSocket connection failure occurs:  
**In “socket.io-client” we get the ‘disconnect’ event** , and in Zoom, we also get the **‘network-quality-change’ event with a level value of 0**. This happens after about 30 seconds of using screen sharing in Safari

```auto
    const onScreenShareClick = useCallback(async () => {
        if (isScreenSharing) return;

        const selfShareCanvas = document.getElementById(mediaStream.isStartShareScreenWithVideoElement() ? SELF_SHARE_VIDEO : SELF_SHARE_CANVAS);
        if (mediaStream?.getShareStatus() === ShareStatus.End && selfShareCanvas) {
            await mediaStream?.startShareScreen(selfShareCanvas, {
                optimizedForSharedVideo: true,
            });
        }
        closeControl();
    }, [mediaStream, isScreenSharing]);

```

```auto
import { io } from "socket.io-client";
...

    const socket = io(url, {
        secure: !isLocalhost,
        transports: ['websocket', 'polling', 'flashsocket']
    });

    socket.on('disconnect', (reason) => {
        console.info(`Socket was disconnected because ${reason}`);
    });

```

> Socket was disconnected because ping timeout

```auto
zmClient.on('network-quality-change', onNetworkChange);

const onNetworkChange = useCallback((payload) => {
        const { userId, type, level } = payload;
        const currentUserId = zmClient.getSessionInfo().userId;

        if (currentUserId === userId) {
            const data = {
                date: Date.now(),
                networkQualityLevel: level
            };

            if (level === 0) {
                store.dispatch(sendZoomStatistics({
                    networkQualityLevelData: data,
                    method: 'FE useParticipantNetworkQualityLevel',
                    message: 'NetworkQualityLevel is equal to 0',
                }, 'Network Quality Level'));
            }

            networkQualityLevelDataRef.current = [
                ...networkQualityLevelDataRef.current,
                data
            ];
        }
...
    }, [zmClient]);

```

SharedArrayBuffer is disabled  
Zoom Video SDK 1.11.6  
React 17.0.2  
socket.io-client: 4.7.5

OS: macOS Sonoma 14.4  
Browser: Safari Version 17.4

---

<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:** [June 20, 2024, 2:27am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/2 "2024-06-20T02:27:10Z")

</div>

Hey @sergey77

Thanks for your feedback.

We tested in our network environment and haven’t found network disconnection issues.

Could you share some problematic Session IDs with us for troubleshooting purposes?

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [June 20, 2024, 9:23am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/3 "2024-06-20T09:23:07Z")

</div>

Hi @vic.yang ,  
Thanks for the answer.

While re-running the test, I managed to reproduce the network disconnection issues in Safari without using screen sharing :

```auto
sessionId: “TMAAyBWrRg2GSHpSBoEklA==”
topic: “newtest20062024-4”
userId: 16779264
userName: “Test706 Test706”

```

or

```auto
sessionId: "4B7ZeYUURb6I9QEbStQtJw=="
topic: "newtest20062024-7"
userId: 16778240
userName: "Test706 Test706"

```

---

<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:** [June 20, 2024, 10:18am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/4 "2024-06-20T10:18:35Z")

</div>

Hey @sergey77

Thanks for sharing the session IDs with us.

> TMAAyBWrRg2GSHpSBoEklA==  
> 4B7ZeYUURb6I9QEbStQtJw==

After analyzing the logs, we found some issues.

- Video SDK will load WASM files to process the media stream. In the logs, we found an issue with the MIME settings of the wasm file. The expected Content-Type is `application/wasm`, but it is actually returning `application/octet-stream`.

- Regarding the disconnection issue. We leverage the heartbeat packets to maintain the connection with the media server. If no messages are returned within 30 seconds, we assume there is an issue with the connection to the server and will disconnect and attempt to establish a new connection.  
Can you check the network conditions at the time? Alternatively, you can inspect it in the dev tools network panel to see if there are any sent or received WebSocket messages.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [June 20, 2024, 7:49pm UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/5 "2024-06-20T19:49:25Z")

</div>

Hi @vic.yang ,

Regarding the network conditions during the test, there were no issues with the network.  
I conducted tests in different browsers and only Safari had problems connecting to the network while using the Video SDK in our application.

In the dev tools panel, I see the message “WebSocket connection to ‘wss://\*\*\*\*.com/socket.io/?EIO=4&transport=websocket’ failed: WebSocket is closed before the connection is established.”

The application is disconnecting the websocket due to “ping timeout”.

At the same time, we are receiving the **‘network-quality-change’** event from Zoom:

```auto
{
    type: "downlink", 
    level: 0
}

```

```auto
{
    type: "uplink", 
    level: 0
}

```

---

<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:** [June 21, 2024, 1:25am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/6 "2024-06-21T01:25:57Z")

</div>

Hey @sergey77

Could you inspect for any \*.zoom.us related websocket connections? See if there are long periods without message transmission.

If that’s the case, it indicates a network issue, possibly due to a proxy server configuration or other reasons.

Or could you try WebSocket Echo Server to do a verification test?

> **[WebSocket Echo Server](https://websocket.org/tools/websocket-echo-server/)**
>
> Public free endpoint used for testing Websockets, SSE and HTTP

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [June 21, 2024, 8:32am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/7 "2024-06-21T08:32:58Z")

</div>

Hi @vic.yang ,

While starting Zoom VIdeoSDK in Safari, I ran a test in Chrome and Safari, splitting the screen into three parts.  
The test on [websocket](https://echo.websocket.org/.ws) worked correctly without failures.  
However, when starting screen sharing in Safari, I got all the errors that I mentioned above.  
At the same time, in the dev tools panel in Safari, \*.zoom.us related websocket connections look working - their “Transfer Size” indicator continues to increase.

Yesterday I got the specified errors simply when starting a Zoom room in Safari.  
Today, however, if the user is simply in a Zoom room without using screen sharing, everything works, but when starting screen sharing by a user who uses Safari, I get the specified issue again

 ![Screenshot 2024-06-21 at 16.20.23](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/4/c/4cae204486186909fdf080f6b0bd1bbb8fa56e71.png)

---

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [June 22, 2024, 4:42pm UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/8 "2024-06-22T16:42:59Z")

</div>

Hi @vic.yang ,

I made an additional investigation and managed to find out what exactly breaks Safari’s work and leads to disconnection issues - this is **“enforceMultipleVideos: true”** in the client’s initialization. Here is the code:

```auto
    const zmClient = ZoomVideo.createClient();
    await ZoomVideo.preloadDependentAssets(`${window.location.origin}/lib`);
    await zmClient.init("en-US", `${window.location.origin}/lib`, {
        webEndpoint: window?.webEndpoint ?? "zoom.us",
        stayAwake: true,
        patchJsMedia: true,
        leaveOnPageUnload: true,
        enforceVirtualBackground: true,
        enforceMultipleVideos: true,
    })

```

Please note that our app uses **“SharedArrayBuffer is disabled”**.

I’m sure this is the bug on Zoom’s side. I really hope it will be fixed as soon as possible.

---

<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:** [June 24, 2024, 2:34am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/9 "2024-06-24T02:34:12Z")

</div>

Hey @sergey77

Can I confirm if starting screen sharing on Safari affects the websocket connection for [socket.io](http://socket.io)?

I tested this on the Video SDK web sample app with the same `client.init` configuration and couldn’t reproduce the issue.

Could you test our sample app to see if you can reproduce the issue? Alternatively, could you provide a simple example that consistently reproduces the issue? This would help us troubleshoot the issue more effectively.

> **[GitHub - zoom/videosdk-web-sample: Zoom Video SDK web sample](https://github.com/zoom/videosdk-web-sample/)**
>
> Zoom Video SDK web sample. Contribute to zoom/videosdk-web-sample development by creating an account on GitHub.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![sergey77](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sergey77/32/50255_2.png) [@sergey77](https://devforum.zoom.us/u/sergey77)\
**Post date:** [July 1, 2024, 9:42am UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/10 "2024-07-01T09:42:21Z")

</div>

Hi @vic.yang, thanks for your support.

> Can I confirm if starting screen sharing on Safari affects the websocket connection for [socket.io](http://socket.io/)?

Yes, that’s right.  
I think this is a consequence of the issue. Also, in addition to the issue with [socket.io](http://socket.io) in Safari, the user receives a ‘network-quality-change’ event from Zoom with “level: 0”

* * *

Today I updated “@zoom/videosdk” to the latest version (1.11.10) and it seems to have fixed the issue.  
I can’t reproduce this issue at the moment

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 31, 2024, 7:43pm UTC](https://devforum.zoom.us/t/an-issue-with-screen-sharing-in-safari-17-4/112227/11 "2024-07-31T19:43:14Z")

</div>

Closed on July 31, 2024, 7:43pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
