imagecapture-polyfill: DOMException: setOptions failed on takePhoto()
Using your own Quick Start example in Chrome Version 64.0.3282.186 (Official Build) (64-bit), the error DOMException: setOptions failed
is thrown when takePhoto() is called:
function gotMedia(mediaStream) {
// Extract video track.
videoDevice = mediaStream.getVideoTracks()[0];
// Check if this device supports a picture mode...
let captureDevice = new ImageCapture(videoDevice);
if (captureDevice) {
captureDevice.takePhoto().then(processPhoto).catch(stopCamera);
captureDevice.grabFrame().then(processFrame).catch(stopCamera);
}
}
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 17
- Comments: 28 (1 by maintainers)
Hi everyone. While I’m the original creator of this library, I haven’t been with Google for 3 years.
Could anyone from @GoogleChromeLabs take a look? @PaulKinlan / @paulirish ?
Any update on the issue? Please don’t abandon us.
Not a fix for takePhoto or a reason why this happens but for those who only need to get an Image while this is not fixed or explained: I used
grabFrame
, since this error does not occur when calling this method and then reversed the polyfill video to canvas to image process a bit by drawing the resulting bitmap on a canvas and getting the Image as DataURL. If someone has a better way to convert the ImageBitmap to an Image, I would appreciate it very much. Samplecode:Does not solve that
takePhoto
always throws an error, but may be useful in a few situationsIn the current Version of Chrome, it seems to work again. Version: Version 80.0.3987.149 (Official Build) (64-Bit)
working code:
If problems still exist, they might be bound to a specific browser version. Close issue?
Does anybody know how to overcome this issue in Chrome 68? I’m getting the exact same error. Using the GrabFrame option isn’t really an option for me, because taking full-resolution images is a requirement for my project.
I already tried this approach from the video.js library, which doesn’t solve the problem and has been removed from their code in favor of the GrabFrame method as a workaround.
Does anybody know, which parameters are required in order to prevent the method from crashing?
@thijstriemstra Maybe you?
hi. i’m jan. same issue on my end. best regards
Looks like nobody is working on this issue.
looks like they will remove the method
ImageCapture.setOptions
in Chrome 66 (https://developers.google.com/web/updates/2018/03/chrome-66-deprecations):And adjusted the method signature (
takePhoto
now requires an options object) and released that change in Chrome 65: https://github.com/w3c/mediacapture-image/pull/150/files#diff-ec9cfa5f3f35ec1f84feb2e59686c34dL54