1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // The <code>chrome.webrtcAudioPrivate</code> API allows enumeration
6 // of audio output (sink) devices as well as getting and setting the
7 // active device for a given tab.
9 // Note that device IDs as used in this API are opaque (i.e. they are
10 // not the hardware identifier of the device) and while they are
11 // unique and persistent across sessions, they are valid only to the
12 // extension calling this API (i.e. they cannot be shared between
15 // See http://goo.gl/8rOmgk for further documentation of this API.
17 [nodoc
] namespace webrtcAudioPrivate
{
20 // The opaque identifier of the audio sink device, which is unique
21 // and static for the extension calling the API but invalid for
24 // The user-friendly name (e.g. "Bose Amplifier").
26 // Current sample rate of the device, in Hz. Useful e.g. to know
27 // if the remote side should be asked to send a lower sampling
30 // True if the device is ready to play out audio. E.g. if it is a
31 // device that takes an audio jack, whether a jack is plugged in.
33 // TODO(joi): Do unplugged devices even get included in enumeration?
35 // True if this device is the default audio sink device on the
40 callback GetSinksCallback
= void(SinkInfo
[] sinkInfo
);
41 callback SinkIdCallback
= void(DOMString sinkId
);
42 callback CompletionCallback
= void();
45 // Retrieves a list of available audio sink devices.
46 static
void getSinks
(GetSinksCallback
callback);
48 // Retrieves the currently active audio sink for the given tab.
49 static
void getActiveSink
(long tabId
,
50 SinkIdCallback
callback);
52 // Sets the active audio sink device for the specified tab.
53 static
void setActiveSink
(long tabId
,
55 optional CompletionCallback
callback);
57 // Given a security origin and an input device ID valid for that
58 // security origin, retrieve an audio sink ID valid for the
59 // extension, or the empty string if there is no associated audio
62 // The associated sink ID can be used as a sink ID for
63 // setActiveSink. It is valid irrespective of which tab you are
64 // setting the active sink for.
65 static
void getAssociatedSink
(DOMString securityOrigin
,
66 DOMString sourceIdInOrigin
,
71 // Fired when audio sink devices are added or removed.
72 static
void onSinksChanged
();