File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ extern crate js_sys;
22extern crate wasm_bindgen;
33extern crate web_sys;
44
5- use self :: js_sys:: eval;
65use self :: wasm_bindgen:: prelude:: * ;
76use self :: wasm_bindgen:: JsCast ;
87use self :: web_sys:: { AudioContext , AudioContextOptions } ;
@@ -493,11 +492,9 @@ fn default_output_device() -> Option<Device> {
493492
494493// Detects whether the `AudioContext` global variable is available.
495494fn is_webaudio_available ( ) -> bool {
496- if let Ok ( audio_context_is_defined) = eval ( "typeof AudioContext !== 'undefined'" ) {
497- audio_context_is_defined. as_bool ( ) . unwrap ( )
498- } else {
499- false
500- }
495+ js_sys:: Reflect :: get ( & js_sys:: global ( ) , & JsValue :: from ( "AudioContext" ) )
496+ . unwrap ( )
497+ . is_truthy ( )
501498}
502499
503500// Whether or not the given stream configuration is valid for building a stream.
Original file line number Diff line number Diff line change 3333//! ```
3434//!
3535//! Before we can create a stream, we must decide what the configuration of the audio stream is
36- //! going to be.
36+ //! going to be.
3737//! You can query all the supported configurations with the
3838//! [`supported_input_configs()`] and [`supported_output_configs()`] methods.
3939//! These produce a list of [`SupportedStreamConfigRange`] structs which can later be turned into
@@ -225,7 +225,7 @@ pub type FrameCount = u32;
225225/// behavior of the given host. Note, the default buffer size may be surprisingly
226226/// large, leading to latency issues. If low latency is desired, [`Fixed(FrameCount)`]
227227/// should be used in accordance with the [`SupportedBufferSize`] range produced by
228- /// the [`SupportedStreamConfig`] API.
228+ /// the [`SupportedStreamConfig`] API.
229229///
230230/// [`Default`]: BufferSize::Default
231231/// [`Fixed(FrameCount)`]: BufferSize::Fixed
@@ -243,7 +243,8 @@ impl wasm_bindgen::describe::WasmDescribe for BufferSize {
243243
244244#[ cfg( target_os = "emscripten" ) ]
245245impl wasm_bindgen:: convert:: IntoWasmAbi for BufferSize {
246- type Abi = Option < u32 > ;
246+ type Abi = <Option < FrameCount > as wasm_bindgen:: convert:: IntoWasmAbi >:: Abi ;
247+
247248 fn into_abi ( self ) -> Self :: Abi {
248249 match self {
249250 Self :: Default => None ,
You can’t perform that action at this time.
0 commit comments