Skip to content

setOutputDeviceAsync() doesn't return the Daily.co Promise #154

@reichhartd

Description

@reichhartd

setOutputDeviceAsync in vapi.ts doesn't return the promise from this.call?.setOutputDeviceAsync():

// vapi.ts:1020-1024
public setOutputDeviceAsync(
  options: Parameters<DailyCall['setOutputDeviceAsync']>[0],
) {
  this.call?.setOutputDeviceAsync(options);  // missing return
}

This means consumers can't catch errors from Daily.co's underlying setSinkId() call. await vapi.setOutputDeviceAsync(...) resolves immediately to undefined instead of waiting for the actual operation, so any rejection becomes an unhandled promise rejection.

We ran into this in production on Safari/WebKit browsers — Safari 18.4+ advertises setSinkId support but rejects with NotAllowedError outside a user gesture context, and there's no way to catch that through the Vapi wrapper right now. The only workaround is bypassing Vapi and calling getDailyCallObject()?.setOutputDeviceAsync() directly.

Fix is just adding return:

public setOutputDeviceAsync(
  options: Parameters<DailyCall['setOutputDeviceAsync']>[0],
) {
  return this.call?.setOutputDeviceAsync(options);
}

(Checked the other delegation methods too — setInputDevicesAsync already returns correctly via safeSetInputDevicesAsync, and startScreenShare/stopScreenShare are fire-and-forget so those are fine.)

I've got a fix ready, will open a PR.

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