image capture and promises

This API could use promises, which would make it a lot clearer:

[Constructor(VideoStreamTrack track)]
interface ImageCapture : EventTarget {
    readonly    attribute PhotoOptions     photoOptions;
    readonly    attribute VideoStreamTrack videoStreamTrack;
    readonly    attribute MediaStream      previewStream;
    Promise<void> setOptions (PhotoSettings photoSettings);
    Promise<Blob> takePhoto ();
    Promise<Blob> grabFrame ();
};

I'm not sure if there is any sense in having the setter for options be
asynchronous, but the accessor synchronous.  I guess it means that
photoOptions is a snapshot of a recent state of the stream.

Note that I also removed the nullable flag on the argument to
setOptions, that seemed odd.

Also, it's not clear how previewStream actually helps here, over being
able to make a new MediaStream containing the video track (or using
the one that you would have extracted the track from).

Received on Sunday, 26 October 2014 22:19:38 UTC