@@ -47,10 +47,6 @@ const supportsSetCodecPreferences = window.RTCRtpTransceiver &&
47
47
let localStream ;
48
48
let pc1 ;
49
49
let pc2 ;
50
- const offerOptions = {
51
- offerToReceiveAudio : 1 ,
52
- offerToReceiveVideo : 1
53
- } ;
54
50
55
51
function getName ( pc ) {
56
52
return ( pc === pc1 ) ? 'pc1' : 'pc2' ;
@@ -64,7 +60,7 @@ async function start() {
64
60
console . log ( 'Requesting local stream' ) ;
65
61
startButton . disabled = true ;
66
62
try {
67
- const stream = await navigator . mediaDevices . getUserMedia ( { audio : true , video : true } ) ;
63
+ const stream = await navigator . mediaDevices . getUserMedia ( { video : true } ) ;
68
64
console . log ( 'Received local stream' ) ;
69
65
localVideo . srcObject = stream ;
70
66
localStream = stream ;
@@ -93,13 +89,9 @@ async function call() {
93
89
console . log ( 'Starting call' ) ;
94
90
startTime = window . performance . now ( ) ;
95
91
const videoTracks = localStream . getVideoTracks ( ) ;
96
- const audioTracks = localStream . getAudioTracks ( ) ;
97
92
if ( videoTracks . length > 0 ) {
98
93
console . log ( `Using video device: ${ videoTracks [ 0 ] . label } ` ) ;
99
94
}
100
- if ( audioTracks . length > 0 ) {
101
- console . log ( `Using audio device: ${ audioTracks [ 0 ] . label } ` ) ;
102
- }
103
95
const configuration = { } ;
104
96
console . log ( 'RTCPeerConnection configuration:' , configuration ) ;
105
97
pc1 = new RTCPeerConnection ( configuration ) ;
@@ -116,7 +108,7 @@ async function call() {
116
108
117
109
try {
118
110
console . log ( 'pc1 createOffer start' ) ;
119
- const offer = await pc1 . createOffer ( offerOptions ) ;
111
+ const offer = await pc1 . createOffer ( ) ;
120
112
await onCreateOfferSuccess ( offer ) ;
121
113
} catch ( e ) {
122
114
onCreateSessionDescriptionError ( e ) ;
@@ -146,9 +138,6 @@ async function onCreateOfferSuccess(desc) {
146
138
}
147
139
148
140
console . log ( 'pc2 createAnswer start' ) ;
149
- // Since the 'remote' side has no media stream we need
150
- // to pass in the right constraints in order for it to
151
- // accept the incoming offer of audio and video.
152
141
try {
153
142
const answer = await pc2 . createAnswer ( ) ;
154
143
await onCreateAnswerSuccess ( answer ) ;
0 commit comments