Skip to content

Commit

Permalink
Update to web-audio-api-rs 0.42 and add channelCount to media constra…
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
orottier committed Feb 5, 2024
1 parent c14f643 commit 3014dc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crate-type = ["cdylib"]
napi = {version="2.14", features=["napi9", "tokio_rt"]}
napi-derive = "2.14"
uuid = {version="1.6.1", features = ["v4","fast-rng"]}
web-audio-api = "0.41.1"
web-audio-api = "0.42"
# web-audio-api = { path = "../web-audio-api-rs" }

[target.'cfg(all(any(windows, unix), target_arch = "x86_64", not(target_env = "musl")))'.dependencies]
Expand Down
7 changes: 7 additions & 0 deletions src/media_devices/get_user_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ pub(crate) fn napi_get_user_media(ctx: CallContext) -> Result<JsObject> {
constraints.latency = Some(latency);
}

if let Ok(Some(js_channel_count)) =
js_constraints.get::<&str, JsNumber>("channelCount")
{
let channel_count = js_channel_count.get_uint32()?;
constraints.channel_count = Some(channel_count);
}

MediaStreamConstraints::AudioWithConstraints(constraints)
} else {
return Err(napi::Error::from_reason(
Expand Down

0 comments on commit 3014dc8

Please sign in to comment.