Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
iPhone camera WebRTC with max resolution, correct zoom and required aspect ratio

I'm creating a web application for an iPhone. Basically I want to take a picture with my phone and have my logo overlay the image but I'm struggling getting the maximum resolution, the correct zoom or getting my chosen aspect ratio.

I want to end up with a saved image that is 1200px high x 630px wide however, if the camera allows a higher resolution I want the image 2x or 3x that size to get the maximum resolution possible while keeping the aspect ratio which I believe is 1.91:1 and I will down size it manually.

I've attached the code and here's the fiddle: https://jsfiddle.net/fn9tv6zb/10/

// Prefer camera resolution nearest to 1280x720.
var constraints = { 
    audio: false, 
  video: {
    facingMode: { 
      exact: "environment" // exact: "user"
    }
  }
  
}; 

navigator.mediaDevices.getUserMedia(constraints)
.then(function(mediaStream) {
  var video = document.querySelector('video');
  video.srcObject = mediaStream;
  video.onloadedmetadata = function(e) {
    video.play();
  };
})
.catch(function(err) { console.log(err.name + ": " + err.message); }); // always check for errors at the end.
* {
    margin: 0;
    padding: 0;
} 
<video playsinline autoplay style="object-fit:cover; width:630px; height:1200px"></video>

I only need it to work with IOS but I can't add anymore to what I've done, I'm going around in circles.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda