You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, I found that even not all the struct fields are implemented (sampleRate for example), but I found the solution (thanks to source code):
It's easy to write getter methods by yourself:
let settings = my_media_stream_track.get_settings();
let channel_count = ::js_sys::Reflect::get(&settings, &JsValue::from("channelCount")); // channel_count is Result<JsValue, JsValue>
let sample_rate = ::js_sys::Reflect::get(&settings, &JsValue::from("sampleRate"));
let sample_size = ::js_sys::Reflect::get(&settings, &JsValue::from("sampleSize"));
...
The only step is to add it to the crate page i think
As far as I have seen, with latest web_sys version (0.3.64), proper getter methods are still not implemented. The work-around you proposed is much better than nothing, but still quite cumbersome. So why closing the issue?
I'm not sure that it can be called a bug, but:
Due to MDN docs:
https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings
and
https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints#getting_the_current_settings_for_a_track
struct MediaTrackSettings must give me access to actual values of MediaStreamTrack's settings, but in web-sys only setter-methods are implemented. (I'm writing web-micro UI right now and I need to know the settings of client's micro. And I think MediaStreamTrack.getSettings is the only way, but it allows you only set, not get) Why is it write only, when it should be read only?
The text was updated successfully, but these errors were encountered: