RTCPeerConnection.onaddstream
当类型为 MediaStreamEvent
的 addstream
事件发生时,通过RTCPeerConnection
触发 RTCPeerConnection.onaddstream
事件处理函数。当远程媒体流MediaStream
添加到连接后发送事件。当RTCPeerConnection.setRemoteDescription()
后此事件立即被调用而不需要等待 SDP 交换完成。
语法
peerconnection.onaddstream = function;
值
function
是用户自定义的一个函数,写法上不带()
和任何参数,也可以是一个匿名函数,例如function(event) {...}
。事件处理函数通常有个 event 做参数,类型为MediaStreamEvent
.
示例
js
pc.onaddstream = function (ev) {
alert("onaddstream event detected!");
};
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
addstream event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Non-standard. Check cross-browser support before using.
- Deprecated. Not for use in new websites.
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.