RTCPeerConnection: phương thức setRemoteDescription()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
Phương thức setRemoteDescription() của giao diện RTCPeerConnection đặt mô tả phiên được chỉ định làm offer hoặc answer hiện tại của máy ngang hàng từ xa.
Mô tả này chỉ định các thuộc tính của đầu từ xa của kết nối, bao gồm định dạng media.
Nó trả về một Promise được thực thi khi mô tả đã được thay đổi, theo cách bất đồng bộ.
Cú pháp
js
setRemoteDescription(sessionDescription)
setRemoteDescription(sessionDescription, successCallback, errorCallback) // deprecated
Tham số
sessionDescription-
Một đối tượng
RTCSessionDescriptionhoặc từ điển mô tả phiên sẽ được đặt làm mô tả từ xa.
Giá trị trả về
Một Promise được thực thi khi mô tả từ xa đã được đặt thành công.
Ví dụ
js
pc.setRemoteDescription(new RTCSessionDescription(desc));
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-peerconnection-setremotedescription> |