From c5a839c3a986ad52526f5778b98cf5c12b8dccf9 Mon Sep 17 00:00:00 2001 From: "vikasmarwaha@webrtc.org" Date: Fri, 7 Feb 2014 19:08:38 +0000 Subject: [PATCH] Updated demos so they work on FF, the createOffer api cannot have null parameters according to spec. Same applies to createAnswer. R=juberti@google.com Review URL: https://webrtc-codereview.appspot.com/8219004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5503 4adac7df-926f-26a2-2b94-8c16560cd09d --- samples/js/demos/html/dc1.html | 8 ++++++-- samples/js/demos/html/dtmf1.html | 9 +++++++-- samples/js/demos/html/multiple.html | 14 ++++++++++---- samples/js/demos/html/pc1-audio.html | 9 +++++++-- samples/js/demos/html/pc1.html | 9 +++++++-- samples/js/demos/html/pc1_sdp_munge.html | 9 +++++++-- samples/js/demos/html/pranswer.html | 9 +++++++-- samples/js/demos/html/states.html | 13 +++++++++---- 8 files changed, 60 insertions(+), 20 deletions(-) diff --git a/samples/js/demos/html/dc1.html b/samples/js/demos/html/dc1.html index 694ca5df04..abfc3ef92c 100644 --- a/samples/js/demos/html/dc1.html +++ b/samples/js/demos/html/dc1.html @@ -129,10 +129,14 @@ function createConnection() { pc2.onicecandidate = iceCallback2; pc2.ondatachannel = receiveChannelCallback; - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); startButton.disabled = true; closeButton.disabled = false; } + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); +} function sendData() { var data = dataChannelSend.value; @@ -163,7 +167,7 @@ function gotDescription1(desc) { pc1.setLocalDescription(desc); trace('Offer from pc1 \n' + desc.sdp); pc2.setRemoteDescription(desc); - pc2.createAnswer(gotDescription2, null, null); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError); } function gotDescription2(desc) { diff --git a/samples/js/demos/html/dtmf1.html b/samples/js/demos/html/dtmf1.html index 1e2abbe852..5141410dc0 100644 --- a/samples/js/demos/html/dtmf1.html +++ b/samples/js/demos/html/dtmf1.html @@ -62,7 +62,11 @@ function gotStream(stream){ pc1.addStream(localstream); trace("Adding Local Stream to peer connection"); - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); +} + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); } function call() { @@ -94,7 +98,8 @@ function gotDescription1(desc){ // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio. - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } function gotDescription2(desc){ diff --git a/samples/js/demos/html/multiple.html b/samples/js/demos/html/multiple.html index a4caf4832e..79b37fd799 100644 --- a/samples/js/demos/html/multiple.html +++ b/samples/js/demos/html/multiple.html @@ -89,11 +89,15 @@ function call() { pc1_local.addStream(localstream); trace("Adding local stream to pc1_local"); - pc1_local.createOffer(gotDescription1Local, null, null); + pc1_local.createOffer(gotDescription1Local, onCreateSessionDescriptionError); pc2_local.addStream(localstream); trace("Adding local stream to pc2_local"); - pc2_local.createOffer(gotDescription2Local, null, null); + pc2_local.createOffer(gotDescription2Local, onCreateSessionDescriptionError); +} + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); } function gotDescription1Local(desc) { @@ -103,7 +107,8 @@ function gotDescription1Local(desc) { // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio and video. - pc1_remote.createAnswer(gotDescription1Remote, null, sdpConstraints); + pc1_remote.createAnswer(gotDescription1Remote, + onCreateSessionDescriptionError, sdpConstraints); } function gotDescription1Remote(desc) { @@ -119,7 +124,8 @@ function gotDescription2Local(desc) { // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio and video. - pc2_remote.createAnswer(gotDescription2Remote, null, sdpConstraints); + pc2_remote.createAnswer(gotDescription2Remote, + onCreateSessionDescriptionError, sdpConstraints); } function gotDescription2Remote(desc) { diff --git a/samples/js/demos/html/pc1-audio.html b/samples/js/demos/html/pc1-audio.html index 38c06676a6..74f38dc328 100644 --- a/samples/js/demos/html/pc1-audio.html +++ b/samples/js/demos/html/pc1-audio.html @@ -39,7 +39,11 @@ function gotStream(stream){ pc1.addStream(localstream); trace("Adding Local Stream to peer connection"); - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); +} + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); } function call() { @@ -68,7 +72,8 @@ function gotDescription1(desc){ // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio. - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } function gotDescription2(desc){ diff --git a/samples/js/demos/html/pc1.html b/samples/js/demos/html/pc1.html index b82938d9f6..f2cf4d0335 100644 --- a/samples/js/demos/html/pc1.html +++ b/samples/js/demos/html/pc1.html @@ -82,7 +82,11 @@ function call() { pc1.addStream(localstream); trace("Adding Local Stream to peer connection"); - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); +} + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); } function gotDescription1(desc){ @@ -92,7 +96,8 @@ function gotDescription1(desc){ // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio and video. - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } function gotDescription2(desc){ diff --git a/samples/js/demos/html/pc1_sdp_munge.html b/samples/js/demos/html/pc1_sdp_munge.html index 330e1ab19b..6396f72d2e 100644 --- a/samples/js/demos/html/pc1_sdp_munge.html +++ b/samples/js/demos/html/pc1_sdp_munge.html @@ -215,7 +215,11 @@ function maybeAddLineBreakToEnd(sdp) { } function createOffer(){ - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); +} + +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); } function setOffer(){ @@ -240,7 +244,8 @@ function createAnswer(){ // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio and video. - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } function setAnswer(){ diff --git a/samples/js/demos/html/pranswer.html b/samples/js/demos/html/pranswer.html index be4d2da80d..36e0d2dd5f 100644 --- a/samples/js/demos/html/pranswer.html +++ b/samples/js/demos/html/pranswer.html @@ -65,10 +65,14 @@ function start() { pc1.addStream(localstream); trace("Adding Local Stream to peer connection"); - pc1.createOffer(gotDescription1); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); } +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); +} + function gotDescription1(desc) { pc1.setLocalDescription(desc); trace("Offer from pc1 \n" + desc.sdp); @@ -76,7 +80,8 @@ function gotDescription1(desc) { // Since the "remote" side has no media stream we need // to pass in the right constraints in order for it to // accept the incoming offer of audio and video. - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } function gotDescription2(desc) { diff --git a/samples/js/demos/html/states.html b/samples/js/demos/html/states.html index a89db07b2b..ab7f7cb0d0 100644 --- a/samples/js/demos/html/states.html +++ b/samples/js/demos/html/states.html @@ -129,17 +129,22 @@ function call() { pc2.onaddstream = gotRemoteStream; pc1.addStream(localstream); trace("Adding Local Stream to peer connection"); - pc1.createOffer(gotDescription1, null, null); + pc1.createOffer(gotDescription1, onCreateSessionDescriptionError); } -function gotDescription1(desc){ +function onCreateSessionDescriptionError(error) { + trace('Failed to create session description: ' + error.toString()); +} + +function gotDescription1(desc) { pc1.setLocalDescription(desc); trace("Offer from pc1 \n" + desc.sdp); pc2.setRemoteDescription(desc); - pc2.createAnswer(gotDescription2, null, sdpConstraints); + pc2.createAnswer(gotDescription2, onCreateSessionDescriptionError, + sdpConstraints); } -function gotDescription2(desc){ +function gotDescription2(desc) { pc2.setLocalDescription(desc); trace("Answer from pc2 \n" + desc.sdp); pc1.setRemoteDescription(desc);