msAudioCategory - Web APIs 编辑
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The msAudioCategory
property of the 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.
Syntax
<audio controls="controls" msaudiocategory="BackgroundCapableMedia"> </audio>
The 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.
Value
Include a description of the property's value, including data type and what it represents.
Value | Description | 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 is set to Communications, msRealtime is automatically set to true. | Yes |
ForeGroundOnlyMedia |
| No |
GameEffects |
| No |
GameMedia | Background music played by a game | No |
SoundEffects |
| No |
Other | Default audio type, and recommended for all audio media that does not need to continue playing in the background. | No |
If msAudioDeviceType
is not explicitly set, msAudioDeviceType
will be set to 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.
Example
<audio msAudioCategory="BackgroundCapableMedia" controls="controls"> <source src="song.mp3"/> </audio>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论