非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
msAudioCategory
特性在 HTML
<audio>
element, is a read/write proprietary attribute, specific to Internet Explorer and Microsoft Edge.
msAudioCategory
specifies the purpose of the audio or video media, such as background audio or alerts.
<audio controls="controls" msaudiocategory="BackgroundCapableMedia"> </audio>
msAudioCategory
property offers a variety of values that can enhance the behavior of your audio-aware app.
Note that you must set the
msAudioCategory
before setting the
src
property in code.
Include a description of the property's value, including data type and what it represents.
| 值 | 描述 | Background Capable? |
|---|---|---|
| Alert |
Looping or longer running alert sounds:
|
No |
| BackgroundCapableMedia |
For audio that needs to continue playing in the background. Examples include the following local media playback scenarios:
|
Yes |
| Communications |
For streaming communication audio such as the following:
msAudioCategory
被设为
Communications
,
msRealtime
is automatically set to true.
|
Yes |
| ForeGroundOnlyMedia |
|
No |
| GameEffects |
|
No |
| GameMedia | Background music played by a game | No |
| SoundEffects |
|
No |
| 其它 | Default audio type, and recommended for all audio media that does not need to continue playing in the background. | No |
若
msAudioDeviceType
is not explicitly set,
msAudioDeviceType
会被设为
Communications
.
For hardware audio offload to be automatically applied, the audio category must be set to ForegroundOnlyMedia or BackgroundCapableMedia . Hardware audio offload optimizes audio rendering which can improve functionality and battery life.
<audio msAudioCategory="BackgroundCapableMedia" controls="controls">
<source src="song.mp3"/>
</audio>