TL;DR: swap webcam width and height
On several mobile devices / operating systems webcam video width and height may be flipped.
E.g you request specific input video width and height:
const width = 360
const height = 540
player.use(
new Webcam({
width,
height,
}),
)
Dom.render(player, "#web-ar")
But get output video width and height flipped:
$("#web-ar").width() // 540
$("#web-ar").height() // 360
It's a known platform-specific webcam bug.
To deal with it you have to swap webcam width and height:
const width = 360
const height = 540
player.use(
new Webcam({
width: height,
height: width,
}),
)
Dom.render(player, "#web-ar")
// ...
$("#web-ar").width() // 360
$("#web-ar").height() // 540