Skip to content
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

Fix firefox screenshare #135

Merged
merged 8 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ All user visible changes to this project will be documented in this file. This p



## [0.4.1] · 2023-??-??
[0.4.1]: /../../tree/medea-jason-0.4.1

[Diff](https://github.com/instrumentisto/medea-jason/compare/medea-jason-0.4.0...medea-jason-0.4.1)

### Fixed

- Screen sharing in Firefox ([#135]).

[#135]: /../../pull/135




## [0.4.0] · 2023-07-11
[0.4.0]: /../../tree/medea-jason-0.4.0

Expand Down
73 changes: 41 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions src/media/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,10 +997,7 @@ impl AudioTrackConstraints {
) -> bool {
let track = track.as_ref();
satisfies_track(track, MediaKind::Audio).await
&& ConstrainString::satisfies(
&self.device_id,
&Some(track.device_id()),
)
&& ConstrainString::satisfies(&self.device_id, &track.device_id())
// TODO returns Result<bool, Error>
}

Expand Down Expand Up @@ -1213,10 +1210,7 @@ impl DeviceVideoTrackConstraints {
) -> bool {
let track = track.as_ref();
satisfies_track(track, MediaKind::Video).await
&& ConstrainString::satisfies(
&self.device_id,
&Some(track.device_id()),
)
&& ConstrainString::satisfies(&self.device_id, &track.device_id())
&& ConstrainString::satisfies(
&self.facing_mode,
&track.facing_mode(),
Expand Down Expand Up @@ -1301,10 +1295,7 @@ impl DisplayVideoTrackConstraints {
) -> bool {
let track = track.as_ref();
satisfies_track(track, MediaKind::Video).await
&& ConstrainString::satisfies(
&self.device_id,
&Some(track.device_id()),
)
&& ConstrainString::satisfies(&self.device_id, &track.device_id())
&& ConstrainU32::satisfies(self.height, track.height())
&& ConstrainU32::satisfies(self.width, track.width())
&& track.guess_is_from_display()
Expand Down
4 changes: 2 additions & 2 deletions src/platform/dart/media_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ impl MediaStreamTrack {
/// [1]: https://w3.org/TR/mediacapture-streams#dfn-deviceid
#[inline]
#[must_use]
pub fn device_id(&self) -> String {
pub fn device_id(&self) -> Option<String> {
let device_id =
unsafe { media_stream_track::device_id(self.inner.get()) };
unsafe { dart_string_into_rust(device_id) }
Some(unsafe { dart_string_into_rust(device_id) })
}

/// Returns [kind][1] of this [`MediaStreamTrack`].
Expand Down
3 changes: 1 addition & 2 deletions src/platform/wasm/media_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ impl MediaStreamTrack {
/// [1]: https://tinyurl.com/w3-streams#dom-mediatracksettings-deviceid
/// [2]: https://w3.org/TR/mediacapture-streams#mediastreamtrack
#[must_use]
pub fn device_id(&self) -> String {
pub fn device_id(&self) -> Option<String> {
#[allow(clippy::unwrap_used)]
get_property_by_name(&self.sys_track.get_settings(), "deviceId", |v| {
v.as_string()
})
.unwrap()
}

/// Return a [`facingMode`][1] of the underlying [MediaStreamTrack][2].
Expand Down
Loading