1

I´m using the camera git getUserMedia(), but I have a big issue, because, I just set the video and height to 1280 and 720:

  videoConstraints.width = { min: 1280, ideal: 1280, max: 1280};
  videoConstraints.height = { min: 720, ideal: 720, max: 720};

It works perfect in a computer, and in a phone too, but the width and height are swapped on mobile, I have to use the mobile on landscape mode, in portrait mode the height is 1280 and width 720, and when is in landscape is height 720 and width 1280 (as I want), so i was looking for information for this, but i really does not found a really solution.

Reference to get user media API: https://developer.mozilla.org/es/docs/Web/API/MediaDevices/getUserMedia

Reference to video constraints: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints/video

Jesús
  • 448
  • 1
  • 3
  • 14

2 Answers2

0

So, then of face this problem i didnt found the problem, what i did was make custom styles with media queries for style mobile.

Jesús
  • 448
  • 1
  • 3
  • 14
-1

Instead of assigning an absolute width value via a HTML attribute in the tag of an image, assign the CSS rule max-width that targets the image as a percentage relative width value, like this: img {max-width:100%}

Try and see what happens.

  • Mmmm, I think thats not going to work, because exists a diference between the size of a canvas in the tag, this is the number of pixels it is going to have, and in css the size is the area that it is going to occupe, anyway I am goint to try – Jesús Apr 20 '20 at 21:29