[mediacapture-image] Optional MIME type as argument for takePhoto() (#278)

anonmos has just created a new issue for https://github.com/w3c/mediacapture-image:

== Optional MIME type as argument for takePhoto() ==
## Problem
MIME types cannot be specified as part of the [takePhoto()](https://www.w3.org/TR/image-capture/#dom-imagecapture-takephoto) method.  The Blob that is returned is the browser default MIME type.

## Description
I'm currently using the imagecapture-polyfill library, but find myself having to fork it and use it as a separate library because the [takePhoto()](https://github.com/GoogleChromeLabs/imagecapture-polyfill/blob/master/src/imagecapture.js#L113) method doesn't allow for the specification of a MIME type in its blob creation.

It also appears that the [takePhoto()](https://www.w3.org/TR/image-capture/#dom-imagecapture-takephoto) w3c specification does take an argument for PhotoSettings, but that seems like it would be an inappropriate place to shoehorn the MIME type.

## Proposal
Update the [takePhoto()](https://www.w3.org/TR/image-capture/#dom-imagecapture-takephoto) method within the Media Capture Image spec to include the following function signature:
```
takePhoto(optional PhotoSettings photoSettings = {}, optional String mimeType)
```

Pass this MIME type as part of the [canvasElement.toBlob()](https://github.com/GoogleChromeLabs/imagecapture-polyfill/blob/master/src/imagecapture.js#L126) call within the `takePhoto()` method so that the Blob can have the [proper MIME type prepended](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#parameters).

Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/278 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 7 April 2021 23:32:21 UTC