Skip to content

[bug] setVideoInputDevice does not work #863

@phr4fh

Description

@phr4fh

Hi, we are recently experiencing a weird issue and I can't wrap my head around it what this code should do.

Changing the camera via setVideoInputDevice does not work. There are no errors thrown, the camera just stays the same.

During debugging I had the following in lib/src/core/room.dart:

Image
  • we start with the new device=aae9
  • then we notice the currentDeviceId=2125
  • then we update the roomOptions in L1106
  • then we check if selectedVideoInputDeviceId != device.deviceId
    • but as L1106 updated the roomOptions to have the new device, the following code returns the new device, so that the if in L1112 is always false and the device does not change
  String? get selectedVideoInputDeviceId =>
      roomOptions.defaultCameraCaptureOptions.deviceId ??
      Hardware.instance.selectedVideoInput?.deviceId;

In short: roomOptions.defaultCameraCaptureOptions already has the new value, and the camera would be only switched if it had NOT the new value

Was it maybe intended to check for currentDeviceId != device.deviceId? That would make more sense to me.


To Reproduce
Use the example and try to change the camera. Nothing changes.

Expected behavior
The camera should change.

Platform information

  • Flutter version: 3.35.2
  • Plugin version: 2.5.0+hotfix.3
  • Flutter target OS: Web and Windows

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