Samsung Internet does not preserve media device IDs over sessions

When using getUserMedia and related methods to access the devices cameras, the devices are identified by device IDs. Most smartphones contain multiple cameras, and applications can display controls to select an appropriate camera via the enumerateDevices API.

In some apps, e.g. barcode/QR Code scanning apps, it is useful to store the ID of a user-selected camera preference in localStorage, and provide it as a constraint to getUserMedia, so the user only has to select the preferred camera once, and in the future the app will automatically always select the preferred one.

In Chrome and Safari, the device IDs stay the same across page refreshes, but on Samsung Internet, the device IDs change on every page load, making such a mechanism harder to implement.

MDN quote on device ID:

A string whose value is an origin-unique identifier for the track’s source. This ID is valid across multiple browsing sessions for the same origin and is guaranteed to be different for all other origins, so you can safely use it to request the same source be used for multiple sessions, for example.

The behavior can be easily reproduced by accessing this page that calls enumerateDevices and displays the IDs.