非标
此特征是非标准的,且不在标准轨道中。不要在面向 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:
  • Alarms
  • Ring tones
  • Ringing notification
  • Sounds that need to attenuate existing audio
No
BackgroundCapableMedia For audio that needs to continue playing in the background. Examples include the following local media playback scenarios:
  • Local playlist
  • Streaming radio
  • Streaming playlist
  • Music videos
  • Streaming audio/radio, YouTube, Netflix, etc.
Yes
Communications For streaming communication audio such as the following:
  • VOIP
  • Real time chat or other type of phone calls
Should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback startup latency is affected. *Note that if msAudioCategory 被设为 Communications , msRealtime is automatically set to true.
Yes
ForeGroundOnlyMedia
  • Games or other sounds designed only to work in the foreground, but will mute existing background media sounds.
  • Game audio needed for the game experience (dancing games, music games)
  • Feature films (designed to pause when they go to the background)
No
GameEffects
  • Game sound effects designed to mix with existing audio
  • Characters talking
  • All non-music sounds
No
GameMedia Background music played by a game No
SoundEffects
  • Game or other sound effects designed to mix with existing audio:
  • Characters talking
  • Beeps, dings, brief sounds
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>
					

元数据

  • 最后修改: