- WebRTC技术详解:从0到1构建多人视频会议系统
- 栗伟
- 150字
- 2021-04-20 11:41:28
2.3.1 约束类型
媒体约束包括媒体流约束(MediaStreamConstraints)和媒体轨道约束(MediaTrackCon-straints)。
MediaStreamConstraints的定义如代码清单2-26所示。
代码清单2-26 MediaStreamConstraints的定义
dictionary MediaStreamConstraints { (boolean or MediaTrackConstraints) video = false; (boolean or MediaTrackConstraints) audio = false; };
MediaStreamConstraints属性说明如表2-1所示。
表2-1 MediaStreamConstraints属性说明
MediaTrackConstraints的定义如代码清单2-27所示。
代码清单2-27 MediaTrackConstraints的定义
dictionary MediaTrackConstraints : MediaTrackConstraintSet { sequence<MediaTrackConstraintSet> advanced; }; dictionary MediaTrackConstraintSet { ConstrainULong width; ConstrainULong height; ConstrainDouble aspectRatio; ConstrainDouble frameRate; ConstrainDOMString facingMode; ConstrainDOMString resizeMode; ConstrainULong sampleRate; ConstrainULong sampleSize; ConstrainBoolean echoCancellation; ConstrainBoolean autoGainControl; ConstrainBoolean noiseSuppression; ConstrainDouble latency; ConstrainULong channelCount; ConstrainDOMString deviceId; ConstrainDOMString groupId; };