0

I am using AWS' Chime JavaScript SDK, and am running into an issue with the addDeviceChangeObserver method that lives on the AudioVideoFacade. Simply put, it doesn't appear to be firing any of the observer methods when my devices change. (i.e. when I unplug my headset, no observer methods fire - but I confirm my devices are no longer listed in the system settings.)

This is roughly how it looks when I set the observer:

import ChimeDeviceChangeObserver from '../chime/ChimeDeviceChangeObserver';
...
audioVideo.addDeviceChangeObserver(ChimeDeviceChangeObserver);

This is my ChimeDeviceChangeObserver class:

export default class ChimeDeviceChangeObserver {

  audioOutputsChanged(freshAudioOutputDeviceList) {
    console.log('Output list changed', freshAudioOutputDeviceList);
  }

  audioInputsChanged(freshAudioInputDeviceList) { 
    console.log('Input list changed', freshAudioInputDeviceList);
  }

  videoInputsChanged(freshVideoInputDeviceList) {
    console.log('Video list changed', freshVideoInputDeviceList);
  }

}

When I unplug/replug my device(s) none of the observer methods log as expected. I've doubled checked that my observer method names match the AWS SDK docs, and am at a loss what for to check next.

Thanks for any and all help!

Cow
  • 764
  • 5
  • 10
  • 25

1 Answers1

1

Well, embarrassingly, the answer is super straightforward!

Simply, I did not initiate the ChimeDeviceChangeObserver instance before passing it into audioVideo.addDeviceChangeObserver().

Before I had the line as: audioVideo.addDeviceChangeObserver(ChimeDeviceChangeObserver);

The fix being: audioVideo.addDeviceChangeObserver(new ChimeDeviceChangeObserver());

Instantiating the new class object correctly passed the observer class to Chime's sdk and the observer methods correctly fire now.

Cow
  • 764
  • 5
  • 10
  • 25