Yes, you need to use navigator.mediaDevices.enumerateDevices() to fetch a list of devices and then use deviceId in the constraints when granting access to the device.
Thanks for your reply
But we want the device change in after stream added.
which means the stream device should change while a stream is published and that stream still in the room.
then we need to change the device dynamically.