From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/audiochannels_api/index.html | 121 ++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 files/ko/web/api/audiochannels_api/index.html (limited to 'files/ko/web/api/audiochannels_api/index.html') diff --git a/files/ko/web/api/audiochannels_api/index.html b/files/ko/web/api/audiochannels_api/index.html new file mode 100644 index 0000000000..de4d98de42 --- /dev/null +++ b/files/ko/web/api/audiochannels_api/index.html @@ -0,0 +1,121 @@ +--- +title: Audio Channels API +slug: Web/API/AudioChannels_API +tags: + - API + - Audio + - AudioChannels + - Firefox OS + - Non-standard + - Obsolete + - Reference +translation_of: Archive/B2G_OS/API/Audio_Channels_API +--- +

{{DefaultAPISidebar("Audio Channels API")}}

+ +
+

Non-standard
+ This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

+
+ +

The Audio Channels API is a Firefox OS-only feature allowing you to place your app audio content into a hierarchy of importance, which dictates when the audio will be paused and resumed in response to other audio playing and actions occurring and allows you to control the volume of different types of audio independently from one another.

+ +

Use case examples:

+ + + +
+

Note: Since the AudioChannels API is non-standard and requires permissions, for many simple use cases such as pausing game music when the app/web page goes into the background you would be better off using the standard Page Visibility API, or perhaps window.onfocus/window.onblur. AudioChannels are mainly useful for more complex phone uses cases involving telephony, etc.

+
+ +

Concepts and usage

+ +

The AudioChannels API extends the HTMLMediaElement and AudioContext interfaces with (among other things) a mozAudioChannelType property that can be set to the channel you want your audio to be played in. The  <audio> and <video> elements can also be used to set this value via the mozaudiochannel attribute. When your audio is placed into a channel, it is generally paused (or interrupted) by audio in a higher priority channel being played. Audio in the least important channel — normal — is also paused by its app being put into the background (this is not the case with the other channels). The audio channels are as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Channel nameimportanceUsed forApp permission level
normal1UI sounds, app and web contentNormal
content2Music, radio, videoNormal
notification3New email, incoming SMSPrivileged
alarm4Alarm clock, calendar alarmsPrivileged
ringer5Incoming phone callsCertified
telephony6Ongoing phone calls, VOIP callsCertified
publicnotification7Forced camera shutter soundsCertified
+ +

Each channel has a separate mute and volume setting, to provide more granular control over the different parts of audio on your device. These are accessed using the mozAudioChannelManager object via the navigator.mozAudioChannelManager property.

+ +
+

Note: If you have two apps playing audio in the content channel, only the one in the foreground can play audio, while the other is interrupted. When the foreground app is put into the background with audio playing, it will not be muted, as per normal "content" behaviour.

+
+ +
+

Note: Find more out about how to use the AudioChannels API in our Using the AudioChannels API guide.

+
+ +

AudioChannels interfaces

+ +
+
AudioChannelManager
+
Includes some features for managing your device's audio channels, including setting what channel's volume to affect when the volume buttons are pressed inside a particular app.
+
HTMLMediaElement and AudioContext extensions
+
HTMLMediaElement and AudioContext are extended with some proprietary features for controlling audio channels, including setting what audio channel the media is in, and events that fire when the audio is interrupted, and resumes playing.
+
Browser API extensions
+
The Browser API will also be including some audio channels features, for putting audio content inside a browser instance into audio channels, controlling its volume, etc., but it doesn't look like these have yet been implemented. This should occur soon.
+
+ +

See also

+ + -- cgit v1.2.3-54-g00ecf