adapter for webrtc

2020-09-27   80 次阅读


浏览器直接调用webrtc相关api接口,比如调用PeerConnection
但是实际上不同浏览器上可能这个API不同:

W3C StandardChromeFirefox
getUserMediawebkitGetUserMediamozGetUserMedia
RTCPeerConnectionwebkitRTCPeerConnectionRTCPeerConnection
RTCSessionDescriptionRTCSessionDescriptionRTCSessionDescription
RTCIceCandidateRTCIceCandidateRTCIceCandidate

Note: 参考WebRTC APIs Interop页面的描述。

所以对于H5,推荐用一个adapter.js来支持各种浏览器。

adapter.js is a shim to insulate apps from spec changes and prefix differences in WebRTC. The prefix differences are mostly gone these days but differences in behaviour between browsers remain.

This repository used to be part of the WebRTC organisation on github but moved. We aim to keep the old repository updated with new releases.

这个库的API调用例子,参考Samples,比如PC应该用RTCPeerConnection

Q.E.D.

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

Do what i love and just do it !