Re: Proposal on how to introduce constraints in getUserMedia()

One way forward could be to have the constraints dictionary as a member
of the existing MediaStreamOptions dictionary.

void getUserMedia (MediaStreamOptions? options,
                    NavigatorUserMediaSuccessCallback? successCb,
                    optional NavigatorUserMediaErrorCallback? errorCb);

dictionary MediaStreamOptions {
     boolean audio;
     boolean video;
     MediaStreamConstraints? constraints;
};


I wonder if this can be made even simpler: the presence of an attribute indicates the requested media type and its value indicates the constraint. An empty array [] indicates no constraint, i.e. equivalent to "true."

For example, {video: [], audio: []} is equivalent to {video: true, audio: true}; {video:[]} is equivalent to {video: true, audio: false}. This makes simple cases easy to represent and the expression extensible for further constraints/preferences. It also avoids potential mismatches between audio/video values and constraints, for example, {video: false, ['video-min-width': 300]}.

Thanks,
Li

Received on Wednesday, 28 March 2012 01:41:47 UTC