Need H.

asked • 06/12/20

Video mediaDevices.getUserMedia zoom is not working in iOS

I'm implementing zxing-js to scan QR Code. My task is to enable zoom while using the camera. It works well in Chrome on Android devices, but when I try to use it on iOS it doesn't work.


Below is my code:

navigator.mediaDevices.getUserMedia(environment).then(async mediaStream => {
document.querySelector('video').srcObject = mediaStream;

await sleep(1000);

const track = mediaStream.getVideoTracks()[0];const capabilities = track.getCapabilities();const settings = track.getSettings();

const input = document.querySelector('input[type="range"]');

// Check whether zoom is supported or not.if (!('zoom' in capabilities)) {return $(log).html('Zoom is not supported by ' + track.label);}

// Map zoom to a slider element.
input.min = capabilities.zoom.min;
input.max = capabilities.zoom.max;
input.step = capabilities.zoom.step;
input.value = settings.zoom;
input.oninput = function(event) {
track.applyConstraints({advanced: [ {zoom: event.target.value} ]});}
input.hidden = false;
});


When I check inside the capabilities using iOS device, the zoom attribute is not on the list. Any ideas on how can I solve this problem?


Thank you so much!



1 Expert Answer

By:

Kevin W. answered • 04/07/25

Tutor
New to Wyzant

Math, Stats, Piano & Language Tutor – Learn with Confidence!

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.