diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/audiochannels_api/index.html | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/api/audiochannels_api/index.html')
-rw-r--r-- | files/ko/web/api/audiochannels_api/index.html | 121 |
1 files changed, 121 insertions, 0 deletions
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 +--- +<p>{{DefaultAPISidebar("Audio Channels API")}}</p> + +<div class="blockIndicator nonStandard"> +<p><strong>Non-standard</strong><br> + 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.</p> +</div> + +<p class="summary">The <strong>Audio Channels API</strong> 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.</p> + +<p>Use case examples:</p> + +<ul> + <li>You want your audio player app to continue playing audio even when it is running in the background so you can do other things as it plays, but you want it to pause when someone rings your phone.</li> + <li>When you mute your phone you don't want to also mute your wake up alarm for the next morning.</li> +</ul> + +<div class="note"> +<p><strong>Note</strong>: 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 <a href="/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API">Page Visibility API</a>, or perhaps <a href="/en-US/docs/Web/API/Window/onfocus" title="The onfocus property returns the onFocus event handler code on the current element."><code>window.onfocus</code></a>/<a href="/en-US/docs/Web/API/Window/onblur" title="The onblur property returns the onBlur event handler code, if any, that exists on the current element."><code>window.onblur</code></a>. AudioChannels are mainly useful for more complex phone uses cases involving telephony, etc.</p> +</div> + +<h2 id="Concepts_and_usage">Concepts and usage</h2> + +<p>The AudioChannels API extends the <a href="/en-US/docs/Web/API/HTMLMediaElement" title="The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video."><code>HTMLMediaElement</code></a> and <a href="/en-US/docs/Web/API/AudioContext" title="The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context."><code>AudioContext</code></a> interfaces with (among other things) a <code>mozAudioChannelType</code> property that can be set to the channel you want your audio to be played in. The <a href="/en-US/docs/Web/HTML/Element/audio" title="The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream."><code><audio></code></a> and <a href="/en-US/docs/Web/HTML/Element/video" title="Use the HTML <video> element to embed video content in a document."><code><video></code></a> elements can also be used to set this value via the <code>mozaudiochannel</code> 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 — <code>normal</code> — 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:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Channel name</th> + <th scope="col">importance</th> + <th scope="col">Used for</th> + <th scope="col">App permission level</th> + </tr> + </thead> + <tbody> + <tr> + <td>normal</td> + <td>1</td> + <td>UI sounds, app and web content</td> + <td>Normal</td> + </tr> + <tr> + <td>content</td> + <td>2</td> + <td>Music, radio, video</td> + <td>Normal</td> + </tr> + <tr> + <td>notification</td> + <td>3</td> + <td>New email, incoming SMS</td> + <td>Privileged</td> + </tr> + <tr> + <td>alarm</td> + <td>4</td> + <td>Alarm clock, calendar alarms</td> + <td>Privileged</td> + </tr> + <tr> + <td>ringer</td> + <td>5</td> + <td>Incoming phone calls</td> + <td>Certified</td> + </tr> + <tr> + <td>telephony</td> + <td>6</td> + <td>Ongoing phone calls, VOIP calls</td> + <td>Certified</td> + </tr> + <tr> + <td>publicnotification</td> + <td>7</td> + <td>Forced camera shutter sounds</td> + <td>Certified</td> + </tr> + </tbody> +</table> + +<p>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 <a href="/en-US/docs/Web/API/MozAudioChannelManager" title="The documentation about this has not yet been written; please consider contributing!"><code>mozAudioChannelManager</code></a> object via the <a href="/en-US/docs/Web/API/Navigator/mozAudioChannelManager" title="The documentation about this has not yet been written; please consider contributing!"><code>navigator.mozAudioChannelManager</code></a> property.</p> + +<div class="note"> +<p><strong>Note</strong>: 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.</p> +</div> + +<div class="note"> +<p><strong>Note</strong>: Find more out about how to use the AudioChannels API in our <a href="/en-US/docs/Web/API/AudioChannels_API/Using_the_AudioChannels_API">Using the AudioChannels API</a> guide.</p> +</div> + +<h2 id="AudioChannels_interfaces">AudioChannels interfaces</h2> + +<dl> + <dt><a href="/en-US/docs/Web/API/AudioChannelManager" title="The documentation about this has not yet been written; please consider contributing!"><code>AudioChannelManager</code></a></dt> + <dd>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.</dd> + <dt><a href="/en-US/docs/Web/API/HTMLMediaElement" title="The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video."><code>HTMLMediaElement</code></a> and <a href="/en-US/docs/Web/API/AudioContext" title="The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context."><code>AudioContext</code></a> extensions</dt> + <dd><code>HTMLMediaElement</code> and <code>AudioContext</code> 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.</dd> + <dt><a href="/en-US/docs/Web/API/Using_the_Browser_API">Browser API</a> extensions</dt> + <dd>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.</dd> +</dl> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/Apps/Build/App_permissions">App permissions for Firefox OS</a></li> + <li><a href="/en-US/docs/Web/API/AudioChannels_API/Using_the_AudioChannels_API">Using the Audio Channels API</a></li> + <li><a href="/en-US/docs/Web/API/Navigator/mozAudioChannelManager" title="The documentation about this has not yet been written; please consider contributing!"><code>navigator.mozAudioChannelManager</code></a></li> + <li><a href="/en-US/docs/Web/API/HTMLMediaElement" title="The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video."><code>HTMLMediaElement</code></a></li> +</ul> |