mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Expose BaseAudioContext.state
This commit is contained in:
parent
db52d1f65c
commit
7e04031a95
2 changed files with 8 additions and 1 deletions
|
@ -49,7 +49,9 @@ impl BaseAudioContext {
|
||||||
BaseAudioContextOptions::AudioContext(options) => options,
|
BaseAudioContextOptions::AudioContext(options) => options,
|
||||||
BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(),
|
BaseAudioContextOptions::OfflineAudioContext(_) => unimplemented!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let sample_rate = options.sample_rate;
|
let sample_rate = options.sample_rate;
|
||||||
|
|
||||||
let mut context = BaseAudioContext {
|
let mut context = BaseAudioContext {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())),
|
audio_graph: ServoMedia::get().unwrap().create_audio_graph(Some(options.into())),
|
||||||
|
@ -85,6 +87,11 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
||||||
Finite::wrap(self.current_time)
|
Finite::wrap(self.current_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state
|
||||||
|
fn State(&self) -> AudioContextState {
|
||||||
|
self.state
|
||||||
|
}
|
||||||
|
|
||||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume
|
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn Resume(&self) -> Rc<Promise> {
|
fn Resume(&self) -> Rc<Promise> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface BaseAudioContext : EventTarget {
|
||||||
readonly attribute float sampleRate;
|
readonly attribute float sampleRate;
|
||||||
readonly attribute double currentTime;
|
readonly attribute double currentTime;
|
||||||
// readonly attribute AudioListener listener;
|
// readonly attribute AudioListener listener;
|
||||||
// readonly attribute AudioContextState state;
|
readonly attribute AudioContextState state;
|
||||||
Promise<void> resume();
|
Promise<void> resume();
|
||||||
attribute EventHandler onstatechange;
|
attribute EventHandler onstatechange;
|
||||||
// AudioBuffer createBuffer(unsigned long numberOfChannels,
|
// AudioBuffer createBuffer(unsigned long numberOfChannels,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue