Hey, we have users complaining that they can't use...
# sdk-web
m
Hey, we have users complaining that they can't use our voice chat on iOS Safari. I was wondering if anyone else has ran into this and knows of workarounds? We migrated from Daily WebRTC, and this is the first time we've had a problem like this. Repro link (put in email, click get started, and it loads and blanks out): https://demo.alcamine.com/20-questions Versions we've seen reports from: • 18.3.2 • 17.6.1 I see some PRs around this: https://github.com/livekit/livekit/pull/3631 https://github.com/livekit/client-sdk-js/pull/1563/files Console tosses up two logs that seem useful
Copy code
[Error] Alcamine:
NotSupportedError: mimeType is not supported
MediaRecorder
kf — index-CvxFSaw0.js:53:20010
startPreConnectBuffer — index-CvxFSaw0.js:53:31148
(anonymous function) — index-CvxFSaw0.js:53:114149
a — index-CvxFSaw0.js:17:55944
	(anonymous function) (index-CvxFSaw0.js:92:10682)


[Error] Unknown DataChannel error on lossy
Object

event: RTCErrorEvent {isTrusted: true, error: OperationError: User-Initiated Abort, reason=, type: "error", target: RTCDataChannel, currentTarget: null, …}

pID: "PA_akW8ux4rXoK9"

participant: "voice_assistant_user_7813"

room: "session_zoweczhx3awrexxsbtqetstp__1753283671803"

roomID: ""

Object Prototype
	(anonymous function) (index-CvxFSaw0.js:53:54428)
d
looks like this is possibly a bug with one of our new features "instant connect". flagging this to the team
are you enabling this feature explicitly?
m
My callsite looks like this. The session.id is my system's not Livekits. Other than that I think it's mostly consistent with the docs
Copy code
this._roomManager[session.id] = new Room();
await Promise.all([
  this._roomManager[session.id].localParticipant.setMicrophoneEnabled(
    true,
    undefined,
    {
      preConnectBuffer: true,
    },
  ),
  this._roomManager[session.id].connect(
    connectionDetails.connection.serverUrl,
    connectionDetails.connection.participantToken,
  ),
]);

this._roomManager[session.id].registerRpcMethod(
  'changeBackgroundColor',
  async (data: RpcInvocationData) => {
    try {
      const { color } = JSON.parse(data.payload);
      document.body.style.backgroundColor = color ?? 'red';
      return 'ok'; // echoed back to the Agent coroutine
    } catch {
      throw new RpcError(1, 'Failed to set background color');
    }
  },
);
Thanks for the hint! Confirmed that it's
preConnectBuffer
that's causing issues. Here's the workaround code:
Copy code
import { getBrowser } from 'livekit-client';
Copy code
// Preconnect doesn't work on iOS safari < 18.5!
        browser?.name === 'Safari' && browser.os === 'iOS'
          ? undefined
          : {
              preConnectBuffer: true,
            },
👍 2
d
awesome, thanks for the report! we'll get this one fixed up
❤️ 1
v
Found this thread because I was getting this "error sending preconnect buffer {}" error. Is this related to my issue? Where exactly do I put this workaround?
I have "isPreConnectBufferEnabled: true," in my app-config.ts
m
Little update here. That code above won't work well.
browser.os
is undefined for certain iOS versions. Additionally, Chrome on iOS has the sam problem since it's all webkit under the hood. The only workaround I've found is to totally remove it but that costs a few seconds on every connection 💀