mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Workaround resume issues
This commit is contained in:
parent
cdd7995d34
commit
1c2d872e33
3 changed files with 27 additions and 20 deletions
|
@ -46,11 +46,8 @@ impl AudioContext {
|
|||
// servo-media takes care of setting the default sample rate of the output device
|
||||
// and of resampling the audio output if needed.
|
||||
|
||||
// Step 5.
|
||||
if context.is_allowed_to_start() {
|
||||
// Step 6.
|
||||
context.resume();
|
||||
}
|
||||
// Steps 5 and 6 of the construction algorithm will happen in `resume`,
|
||||
// after reflecting dom object.
|
||||
|
||||
AudioContext {
|
||||
context,
|
||||
|
@ -64,7 +61,9 @@ impl AudioContext {
|
|||
pub fn new(global: &GlobalScope,
|
||||
options: &AudioContextOptions) -> DomRoot<AudioContext> {
|
||||
let context = AudioContext::new_inherited(global, options);
|
||||
reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap)
|
||||
let context = reflect_dom_object(Box::new(context), global, AudioContextBinding::Wrap);
|
||||
context.resume();
|
||||
context
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#AudioContext-constructors
|
||||
|
@ -73,6 +72,14 @@ impl AudioContext {
|
|||
let global = window.upcast::<GlobalScope>();
|
||||
Ok(AudioContext::new(global, options))
|
||||
}
|
||||
|
||||
fn resume(&self) {
|
||||
// Step 5.
|
||||
if self.context.is_allowed_to_start() {
|
||||
// Step 6.
|
||||
self.context.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AudioContextMethods for AudioContext {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue