• 创建媒体
function getStream(){var constraints = {audio:true,video:true}navigator.mediaDevices.getUserMedia(constraints).then(getMediaStream).catch(handError);}
  • 创建媒体协商
function getMediaStream(stream){stream.getTracks().forEach((track)=>{pc.addTrack(track); });var options={//offerToReceiveAudio:1,offerToReceiveVideo:1,//该选项会重启ICE,重新进行Candidate收集iceRestart:false}pc.createOffer(options).then(getOffer).catch(handError);
}
  • 创建 offer
function getOffer(desc){console.log(desc.sdp);pc.setLocalDescription(desc);pc2.setRemoteDescription(desc);pc2.createAnswer().then(getAnswer).catch(handError);
}
  • 创建answer
function getAnswer(desc){console.log(desc.sdp);pc2.setLocalDescription(desc);pc.setRemoteDescription(desc);
}

效果

  • offer的sdp
v=0
o=- 2101118154984444130 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS 47acc35a-4237-48a0-ae6a-3e85580756a6 d4f6e8b0-25d4-4cb8-8908-0a8cdb7fa604
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:7xq1
a=ice-pwd:E6bbfqYkVZ7d1gtufAN8aw3J
a=ice-options:trickle
a=fingerprint:sha-256 50:DF:63:7A:1F:84:2F:29:19:03:E5:38:17:32:5F:A1:21:B4:3A:79:38:53:4A:C6:BB:73:AB:3B:B2:70:F7:4F
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:2607611722 cname:FAqcPi+z2lLzPXYa
a=ssrc:2607611722 msid:47acc35a-4237-48a0-ae6a-3e85580756a6 05fd88c1-6fe5-4739-9300-2b15ee8108f6
a=ssrc:2607611722 mslabel:47acc35a-4237-48a0-ae6a-3e85580756a6
a=ssrc:2607611722 label:05fd88c1-6fe5-4739-9300-2b15ee8108f6
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:7xq1
a=ice-pwd:E6bbfqYkVZ7d1gtufAN8aw3J
a=ice-options:trickle
a=fingerprint:sha-256 50:DF:63:7A:1F:84:2F:29:19:03:E5:38:17:32:5F:A1:21:B4:3A:79:38:53:4A:C6:BB:73:AB:3B:B2:70:F7:4F
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=sendrecv
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 x-google-profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 H264/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 H264/90000
a=rtcp-fb:124 goog-remb
a=rtcp-fb:124 transport-cc
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtpmap:120 rtx/90000
a=fmtp:120 apt=124
a=rtpmap:123 red/90000
a=rtpmap:119 rtx/90000
a=fmtp:119 apt=123
a=rtpmap:114 ulpfec/90000
a=ssrc-group:FID 3742035796 1130647485
a=ssrc:3742035796 cname:FAqcPi+z2lLzPXYa
a=ssrc:3742035796 msid:d4f6e8b0-25d4-4cb8-8908-0a8cdb7fa604 c3107fbf-bb10-4a9e-8188-fe356636e2a5
a=ssrc:3742035796 mslabel:d4f6e8b0-25d4-4cb8-8908-0a8cdb7fa604
a=ssrc:3742035796 label:c3107fbf-bb10-4a9e-8188-fe356636e2a5
a=ssrc:1130647485 cname:FAqcPi+z2lLzPXYa
a=ssrc:1130647485 msid:d4f6e8b0-25d4-4cb8-8908-0a8cdb7fa604 c3107fbf-bb10-4a9e-8188-fe356636e2a5
a=ssrc:1130647485 mslabel:d4f6e8b0-25d4-4cb8-8908-0a8cdb7fa604
a=ssrc:1130647485 label:c3107fbf-bb10-4a9e-8188-fe356636e2a5
  • answer的sdp
v=0
o=- 5774749671480282566 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:XTpb
a=ice-pwd:QNFmVMKggS8kNE3lcvoV3xGl
a=ice-options:trickle
a=fingerprint:sha-256 07:D7:40:64:2F:5D:7D:05:42:30:D8:25:C4:F7:A1:38:C8:B3:5E:E4:03:AF:2C:AD:A3:C3:11:82:4F:F2:71:76
a=setup:active
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:XTpb
a=ice-pwd:QNFmVMKggS8kNE3lcvoV3xGl
a=ice-options:trickle
a=fingerprint:sha-256 07:D7:40:64:2F:5D:7D:05:42:30:D8:25:C4:F7:A1:38:C8:B3:5E:E4:03:AF:2C:AD:A3:C3:11:82:4F:F2:71:76
a=setup:active
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 x-google-profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 H264/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 H264/90000
a=rtcp-fb:124 goog-remb
a=rtcp-fb:124 transport-cc
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtpmap:120 rtx/90000
a=fmtp:120 apt=124
a=rtpmap:123 red/90000
a=rtpmap:119 rtx/90000
a=fmtp:119 apt=123
a=rtpmap:114 ulpfec/90000

测试地址:https://www.huangxiaoguo.club/testCreateOffer/index.html

webRTC(八):查看offer/answer 的 SDP相关推荐

  1. WebRTC offer - answer交换sdp流程分析

    被WebRTC自带oc版本的例子恶心到了,不做笔记还真不行. 两端开启音视频通讯时,一方做为offer主动发出邀请,另一方做为answer被动等待offer的邀请做出反应. 代码中的流程: Offer ...

  2. java sip 携带sdp_SIP中的SDP offer/answer交换初探

    1.早期媒体 无论是在PSTN还是在VoIP网络中,一个呼叫的最终目的让两个用户进行交谈(conversation).这里我们将由用户之间的交谈所产生的媒体称为常规媒体("regular m ...

  3. SIP中的SDP offer/answer交换初探

    1.引言 SDP的offer/answer模型本身独立与于使用它的高层协议.SIP是使用offer/answer模型的应用之一.RFC 3264 [3] 定义了offer/answer模型,但没有规定 ...

  4. ROAP (RTCWeb Offer/Answer Protocol) 实时网页提议应答协议

    ROAP ROAP 就是 RTCWeb Offer/Answer Protocol 实时网页提议应答协议 这是一个新协议, 目的是为了搭建媒体通道, 由思科,谷歌及Mozilla的几位工程师提出, 还 ...

  5. 基于SDP的提议/应答(offer/answer)模型简介

    1.引入 在松耦合会议中,会话参数完全由会议创建者来确定,参与者能做的仅仅是根据这些会话参数来加入会议(当然也可以选择不加入).这种情况下,主要要做的就是会话描述,在这里SDP本身就足够了. 但是在更 ...

  6. WebRTC源码-信令之六:SDP协议与协商流程

    一.SDP协议概述 SDP(Session Description Protocol)是一个用来描述多媒体会话的应用层控制协议, 它是一个基于文本的协议,用于会话建立过程中的媒体类型和编码方案的协商等 ...

  7. webrtc笔记-信令部分(SDP)

    webrtc处理两种数据,一种是协议相关的信令和媒体传输数据,一种是帧数据(主要是数字信号处理,将话筒.摄像设备采集的数字信号通过语音前端3A,编解码G711/H264/V8,渲染等算法进行处理).主 ...

  8. 流媒体学习-WebRTC全面入门学习-1

    一.初始WebRTC 1.WebRTC 就是音视频处理+即时通讯的开源库 音视频处理中ffmpeg和WebRTC是两个很重要的一部分,ffmpeg注重与数据音视频的编解码,文件的后处理.WebRTC整 ...

  9. WebRTC 学习资料整理一

    官网永远是最重要,但同时也是最容易忽略的学习途径.So you should look official websites firtsly.. 先看一看基础概念的解释 WebRTC 相關縮寫名詞簡介 ...

  10. WebRtc学习资料整理

    很久没有写了,尤其是技术文章,总感觉很难受.这里总结一下最近的学习内容. 官网永远是最重要,但同时也是最容易忽略的学习途径.So you should look official websites f ...

最新文章

  1. 强烈推荐一款Python可视化神器!
  2. 插值法在计算机中的应用,常见的插值法及其应用.pdf
  3. Python—自动化部署工具:Fabric
  4. TensorFlow机器学习实战指南之第一章
  5. 文献学习(part9)--基于模型分解的小样本学习
  6. 初学者计算机_初学者极客:如何在计算机上重新安装Windows
  7. [css] 举例说明css有哪些简写的属性和属性值?
  8. 树叶节点_茶,一片树叶的旅程
  9. Python学习笔记:序列之字符串
  10. (转)淘淘商城系列——商品搜索功能Service实现
  11. 如何使用敏捷开发来赢得太阳能竞速赛
  12. 从零学ELK系列(四):Docker安装Elasticsearch(超详细图文教程)
  13. cross_val_score 如何对孤立森林_泸县九中开展 “森林草原防灭火”主题班会活动...
  14. 华为eSight网管平台折腾
  15. 兴趣 程序猿宅必备超级好看的动漫
  16. 程序员小抄——GitHub 热点速览 Vol.44
  17. html修改progress背景色,html5progress标签如何更改进度条颜色?progress进度条详解
  18. CAP定理以及BASE定理详解
  19. Linux下rsync安装与配置
  20. 软件测试工程师-面试如何使用代码进行接口测试?

热门文章

  1. 曾经决心永不做游戏 但为何阿里巴巴的游戏之心一直死不了?
  2. 如何在linux系统下的抓包文件保存在u盘里,在xp系统中打开,【Linux】Wireshark在Linux系统下的安装及使用...
  3. [教程] 写号+上3G成功,附个人经验补充,写号看此一贴即可,二楼附上radio恢复方法和recovery (来源于http://www.in189.com/thread-94957-1-1.htm)
  4. pandas学习之df.sample
  5. 什么是云计算,什么是网格计算,他们之间有什么区别
  6. 红色警戒2修改器原理百科(四)
  7. spring事务REQUIRED REQUIRES_NEW区别
  8. Windows 10简单搭建一个局域网Web下载分享界面
  9. 【网络流24题23】火星探险问题
  10. IT人二十年后再定位