Skip to content

Commit

Permalink
extend AudioContext webidl for output sink
Browse files Browse the repository at this point in the history
* added unstable AudioContext partial with audio sink types
* unrelated to sink, but I also added latencyHint to AudioContextOptions as it's stable
  • Loading branch information
tylerbarker committed Jun 12, 2023
1 parent 15ca11b commit cc6d2bf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/web-sys/webidls/enabled/AudioContext.webidl
Expand Up @@ -10,8 +10,15 @@
* liability, trademark and document use rules apply.
*/

enum AudioContextLatencyCategory {
"balanced",
"interactive",
"playback"
};

dictionary AudioContextOptions {
float sampleRate = 0;
(AudioContextLatencyCategory or double) latencyHint = "interactive";
float sampleRate = 0;
};

[Pref="dom.webaudio.enabled",
Expand Down
18 changes: 18 additions & 0 deletions crates/web-sys/webidls/unstable/AudioContext.webidl
@@ -0,0 +1,18 @@
enum AudioSinkType {
"none"
};

dictionary AudioSinkOptions {
required AudioSinkType type;
};

partial dictionary AudioContextOptions {
(DOMString or AudioSinkOptions) sinkId;
};

partial interface AudioContext {
[SecureContext] readonly attribute (DOMString or AudioSinkInfo) sinkId;

[SecureContext] Promise<undefined> setSinkId ((DOMString or AudioSinkOptions) sinkId);
attribute EventHandler onsinkchange;
};
4 changes: 4 additions & 0 deletions crates/web-sys/webidls/unstable/AudioSinkInfo.webidl
@@ -0,0 +1,4 @@
[Exposed=Window]
interface AudioSinkInfo {
readonly attribute AudioSinkType type;
};

0 comments on commit cc6d2bf

Please sign in to comment.