DisplayMediaStreamConstraints.audio - Web APIs 编辑

The DisplayMediaStreamConstraints dictionary's audio property is used to specify whether or not to request that the MediaStream containing screen display contents also include an audio track. This value may be a Boolean, where true indicates that an audio track should be included an false (the default) indicates that no audio should be included in the stream.

More precise control over the audio data may be exercised by instead providing a MediaTrackConstraints object, which is used to process the audio prior to adding it to the stream.

Note: The specification for the Screen Capture API does not define what the contents of the audio track should be. This is left up to the user agent to decide. Likely sources are the computer's system audio output and the user's microphone, but there is no way to specify which source to use.

Syntax

displayMediaStreamConstraints.audio = allowAudioFlag;
displayMediaStreamConstraints.audio = mediaTrackConstraints;

displayMediaStreamConstraints = {
  audio: allowAudioFlag|mediaTrackConstraints;
}

Value

The value may be either a Boolean or a MediaTrackConstraints object.

If a Boolean is specified, a value of true indicates that an audio track should be included in the stream returned by getDisplayMedia(), if an appropriate audio source exists and the user agent supports audio on display media. A value of false—the default—indicates that no audio track is to be included in the stream.

If a MediaTrackConstraints object is given, and an audio source is available, an audio track matching the settings given in the constraints object is included in the MediaStream returned by getDisplayMedia().

If no audio source is available, or the user agent doesn't support audio tracks with getDisplayMedia(), the returned MediaStream has no audio track, but no error occurs. The audio track is always considered optional.

Example

Specifications

SpecificationStatusComment
Screen Capture
The definition of 'DisplayMediaStreamConstraints.audio' in that specification.
Working DraftInitial definition

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:32 次

字数:3930

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文