DescriptionImplement suspend/resume for AudioContext
WebAudio is adding a suspend()/resume() API:
https://github.com/WebAudio/web-audio-api/issues/361
https://github.com/WebAudio/web-audio-api/issues/317
In more detail, here is the proposed additions to the spec:
New attribute "state" with values:
paused
Currently paused (time is not proceeding, audio hardware may be powered down/released).
running
Audio is being processed.
released
AudioContext has been released, and can no longer be used to process audio. All system resources should be released.
void suspend()
Suspends the progression of time in the audio context, allows any current buffer contents to be played to the destination and then allows the system to power down and/or release audio hardware. If the context has been released, an InvalidStateError MUST be thrown. This is generally useful when the application knows it will not need the AudioContext for some time, and wishes to let the audio hardware power down.
While the system is suspend, MediaStreams will have their output ignored; that is, data will be lost by the real time nature of media streams. HTMLMediaElements will similarly have their output ignored until the system is resumed. Audio Workers and ScriptProcessorNodes will simply not fire their onaudioprocess events while suspended, but will resume when resumed. For the purpose of AnalyserNode window functions, the data is considered as a continuous stream - i.e. the resume()/suspend() does not cause silence to appear in the AnalyserNode's stream of data.
Promise resume()
Resumes the progression of time in the audio context, which may involve re-priming the frame buffer contents. The promise resolves when the system has re-acquired (if necessary) access to audio hardware and has begun streaming to the destination, or immediately (with no other effect) if the context is already running. The promise is rejected if the context has been released.
BUG=420106
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183916
Patch Set 1 #Patch Set 2 : Handle OfflineAudioContexts #Patch Set 3 : #
Total comments: 6
Patch Set 4 : Rebase (only) #Patch Set 5 : Update according to spec #Patch Set 6 : Fix typos in comments. #Patch Set 7 : #Patch Set 8 : Fix typo caught by bots but not locally #
Total comments: 29
Patch Set 9 : Address review comments #Patch Set 10 : Address more review comments #Patch Set 11 : Rename setState to setContextState #Patch Set 12 : Fix build error. #
Total comments: 6
Patch Set 13 : Address review comments. #Patch Set 14 : Update according to new webaudio spec #Messages
Total messages: 29 (6 generated)
|