Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. MediaTrackSettings
  4. groupId

MediaTrackSettings: groupId property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2020⁩.

TheMediaTrackSettings dictionary'sgroupId property is a browsing-session uniquestring which identifies the group of devices which includes the sourcefor theMediaStreamTrack. This lets you determine what value was selectedto comply with your specified constraints for this property's value as described in theMediaTrackConstraints.groupId property you provided when calling eithergetUserMedia().

If needed, you can determine whether or not this constraint is supported by checkingthe value ofMediaTrackSupportedConstraints.groupId as returned by a calltoMediaDevices.getSupportedConstraints(). However, typically this isunnecessary since browsers will ignore any constraints they're unfamiliar with.

BecauseRTP doesn't include this information, tracks associated with aWebRTCRTCPeerConnectionwill never include this property.

Value

A string whose value is a browsing-session unique identifier for agroup of devices which includes the source of the track's contents. Two devices sharethe same group ID if they belong to the same physical hardware device. For example, aheadset has two devices on it: a microphone which can serve as a source for audio tracksand a speaker which can serve as an output for audio.

The group ID is not usable across multiple browsing sessions. However, it can be usedto ensure that audio input and output are both being performed on the same headset, forexample, or to ensure that the built-in camera and microphone on a phone are being usedfor video conferencing purposes.

The actual value of the string, however, is determined by the source of the track, andthere is no guarantee what form it will take, although the specification does recommendit be a GUID.

Since this property isn't stable across browsing sessions, its usefulness when callinggetUserMedia() is generally limited toensuring that tasks performed during the same browsing session use devices from the samegroup (or that they don't use devices from the same group). There is no situation inwhich the groupId is useful when callingapplyConstraints(), since thevalue can't be changed.

Examples

See theConstraint exerciser example.

Specifications

Specification
Media Capture and Streams
# dom-mediatrackconstraintset-groupid

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp