-
Notifications
You must be signed in to change notification settings - Fork 32
MediaTrackSettings binding does not account for unsupported values for a given device #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is going to ultimately be opinionated, but my 2c: From a compatibility perspective i.e. "some browsers don't support certain settings", I don't think we should let that affect the Dart nullability. Historically, having taken that approach in From a context perspective i.e. "under certain conditions, this attribute may or may not exist", I don't think the IDL exposes such details (besides stuff like These were both a bigger problem for |
I agree that this might be opinionated for many of the API's in the IDL. However, my specific use case was referring to the Considering your opinion, I think we have a few options:
But I wanted to see if there were other options. |
For this API, it looks like the spec is just assuming you check to see if the property is available (either through
Ehh, catching these kinds of errors are not great as it may mask another error, and I'd rather you do:
if you want to use the nullability to determine if a property exists. You can do this today FYI, by extending the type e.g. extension on MediaTrackSettings {
@JS('facingMode')
external String? get facingModeNullable;
} You can write your own interface too with
That's a good idea. The docs will mention the conflation of |
Do we close this issue then, in favor of #122 ? We have enough options to work around the problem today. |
Ah, my mistake, I thought #122 was dart-lang/site-www#5438. I think the docs on dart.dev are the best location to talk about null-checks. Either way, yes we should close this and document the limitations. Thanks for filing! |
Currently the
MediaTrackSettings
bindings define the properties as non-null.However, when retrieving the settings of a MediaStreamTrack, not all properties are available,
which results in an error when trying to retrieve these properties.
For example, when creating a MediaStreamTrack on my Macbook in Chrome, the settings do not have a facing mode,
despite the binding being a
String
.As an example, calling
objectKeys()
on the track settings object yields:We should probably make all these nullable?
The text was updated successfully, but these errors were encountered: