Skip to content

iOS/iPadOS getUserMedia fails with "not allowed by the user agent" — singlePeerConnection default changed from false to true in @elevenlabs/client 1.18.0 #960

Description

@sailod

Package

@elevenlabs/client (used by @elevenlabs/react)

Versions

  • @elevenlabs/react: 1.12.1
  • @elevenlabs/client: 1.18.0
  • livekit-client: 2.21.0

Environment

  • iOS Safari (iPhone + iPad)
  • Works on desktop Chrome and Android Chrome

Error

The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

Description

In @elevenlabs/client 1.9.0, WebRTCConnection.create() explicitly created the LiveKit Room with singlePeerConnection: false:

// @elevenlabs/client 1.9.0 — WebRTCConnection.js line 204-208
const room = new Room({
    // Force dual peer connection (v0) path to maintain compatibility
    // with LiveKit servers that don't support the v1 join protocol
    // (publisher offer bundled in JoinRequest). See #781.
    singlePeerConnection: false,
});

In @elevenlabs/client 1.18.0, this was changed to pass no config:

// @elevenlabs/client 1.18.0 — WebRTCConnection.js line 204
const room = new Room();

livekit-client 2.21.0 defaults to singlePeerConnection: true (the v1 join protocol — confirmed at livekit-client.esm.mjs:19201), which bundles the publisher offer in the JoinRequest. This changes the timing of when getUserMedia() is called during the connection lifecycle.

On iOS/iPad Safari, the v1 protocol's earlier getUserMedia() call triggers a NotAllowedError — the browser considers the call "not allowed in the current context" because the user gesture / permission context hasn't been fully established at that point in the WebRTC negotiation.

Regression

This worked in @elevenlabs/client 1.9.0 (which explicitly set singlePeerConnection: false). It broke after upgrading to 1.18.0. The change was introduced in the WebRTCConnection.js diff between the two versions — the singlePeerConnection: false config was removed without replacement.

Suggested fix

Restore the explicit singlePeerConnection: false in WebRTCConnection.create(), or expose a rtcConfig / roomOptions option in SessionConfig so callers can control this.

Reproduction

  1. Use @elevenlabs/react 1.12.1 with useConversation() on iOS Safari
  2. Call startSession({ agentId })
  3. Grant microphone permission when prompted
  4. Observe the error: "The request is not allowed by the user agent or the platform in the current context"

Workaround

We're using patch-package to restore singlePeerConnection: false in the bundled WebRTCConnection.js until an official fix is released.


Note: Originally filed at elevenlabs/elevenlabs-js#443, redirected here by @PaulAsjes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions