@@ -47,10 +47,6 @@ const supportsSetCodecPreferences = window.RTCRtpTransceiver &&
4747let localStream ;
4848let pc1 ;
4949let pc2 ;
50- const offerOptions = {
51- offerToReceiveAudio : 1 ,
52- offerToReceiveVideo : 1
53- } ;
5450
5551function getName ( pc ) {
5652 return ( pc === pc1 ) ? 'pc1' : 'pc2' ;
@@ -64,7 +60,7 @@ async function start() {
6460 console . log ( 'Requesting local stream' ) ;
6561 startButton . disabled = true ;
6662 try {
67- const stream = await navigator . mediaDevices . getUserMedia ( { audio : true , video : true } ) ;
63+ const stream = await navigator . mediaDevices . getUserMedia ( { video : true } ) ;
6864 console . log ( 'Received local stream' ) ;
6965 localVideo . srcObject = stream ;
7066 localStream = stream ;
@@ -93,13 +89,9 @@ async function call() {
9389 console . log ( 'Starting call' ) ;
9490 startTime = window . performance . now ( ) ;
9591 const videoTracks = localStream . getVideoTracks ( ) ;
96- const audioTracks = localStream . getAudioTracks ( ) ;
9792 if ( videoTracks . length > 0 ) {
9893 console . log ( `Using video device: ${ videoTracks [ 0 ] . label } ` ) ;
9994 }
100- if ( audioTracks . length > 0 ) {
101- console . log ( `Using audio device: ${ audioTracks [ 0 ] . label } ` ) ;
102- }
10395 const configuration = { } ;
10496 console . log ( 'RTCPeerConnection configuration:' , configuration ) ;
10597 pc1 = new RTCPeerConnection ( configuration ) ;
@@ -116,7 +108,7 @@ async function call() {
116108
117109 try {
118110 console . log ( 'pc1 createOffer start' ) ;
119- const offer = await pc1 . createOffer ( offerOptions ) ;
111+ const offer = await pc1 . createOffer ( ) ;
120112 await onCreateOfferSuccess ( offer ) ;
121113 } catch ( e ) {
122114 onCreateSessionDescriptionError ( e ) ;
@@ -146,9 +138,6 @@ async function onCreateOfferSuccess(desc) {
146138 }
147139
148140 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.
152141 try {
153142 const answer = await pc2 . createAnswer ( ) ;
154143 await onCreateAnswerSuccess ( answer ) ;
0 commit comments