Updated PeerConnection samples so they run on FF.
R=braveyao@webrtc.org Review URL: https://webrtc-codereview.appspot.com/6359004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5340 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -89,9 +89,9 @@ function createConnection() {
|
|||||||
pcConstraint = null;
|
pcConstraint = null;
|
||||||
dataConstraint = null;
|
dataConstraint = null;
|
||||||
if (sctp_select.checked &&
|
if (sctp_select.checked &&
|
||||||
webrtcDetectedBrowser === 'chrome' &&
|
(webrtcDetectedBrowser === 'chrome' && webrtcDetectedVersion >= 31) ||
|
||||||
webrtcDetectedVersion >= 31) {
|
webrtcDetectedBrowser === 'firefox'){
|
||||||
// SCTP is supported from Chrome M31.
|
// SCTP is supported from Chrome M31 and is supported in FF.
|
||||||
// No need to pass DTLS constraint as it is on by default in Chrome M31.
|
// No need to pass DTLS constraint as it is on by default in Chrome M31.
|
||||||
// For SCTP, reliable and ordered is true by default.
|
// For SCTP, reliable and ordered is true by default.
|
||||||
trace('Using SCTP based Data Channels');
|
trace('Using SCTP based Data Channels');
|
||||||
@ -129,7 +129,7 @@ function createConnection() {
|
|||||||
pc2.onicecandidate = iceCallback2;
|
pc2.onicecandidate = iceCallback2;
|
||||||
pc2.ondatachannel = receiveChannelCallback;
|
pc2.ondatachannel = receiveChannelCallback;
|
||||||
|
|
||||||
pc1.createOffer(gotDescription1);
|
pc1.createOffer(gotDescription1, null, null);
|
||||||
startButton.disabled = true;
|
startButton.disabled = true;
|
||||||
closeButton.disabled = false;
|
closeButton.disabled = false;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ function gotDescription1(desc) {
|
|||||||
pc1.setLocalDescription(desc);
|
pc1.setLocalDescription(desc);
|
||||||
trace('Offer from pc1 \n' + desc.sdp);
|
trace('Offer from pc1 \n' + desc.sdp);
|
||||||
pc2.setRemoteDescription(desc);
|
pc2.setRemoteDescription(desc);
|
||||||
pc2.createAnswer(gotDescription2);
|
pc2.createAnswer(gotDescription2, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotDescription2(desc) {
|
function gotDescription2(desc) {
|
||||||
|
@ -62,7 +62,7 @@ function gotStream(stream){
|
|||||||
pc1.addStream(localstream);
|
pc1.addStream(localstream);
|
||||||
trace("Adding Local Stream to peer connection");
|
trace("Adding Local Stream to peer connection");
|
||||||
|
|
||||||
pc1.createOffer(gotDescription1);
|
pc1.createOffer(gotDescription1, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function call() {
|
function call() {
|
||||||
|
@ -89,11 +89,11 @@ function call() {
|
|||||||
|
|
||||||
pc1_local.addStream(localstream);
|
pc1_local.addStream(localstream);
|
||||||
trace("Adding local stream to pc1_local");
|
trace("Adding local stream to pc1_local");
|
||||||
pc1_local.createOffer(gotDescription1Local);
|
pc1_local.createOffer(gotDescription1Local, null, sdpConstraints);
|
||||||
|
|
||||||
pc2_local.addStream(localstream);
|
pc2_local.addStream(localstream);
|
||||||
trace("Adding local stream to pc2_local");
|
trace("Adding local stream to pc2_local");
|
||||||
pc2_local.createOffer(gotDescription2Local);
|
pc2_local.createOffer(gotDescription2Local, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotDescription1Local(desc) {
|
function gotDescription1Local(desc) {
|
||||||
|
@ -39,7 +39,7 @@ function gotStream(stream){
|
|||||||
pc1.addStream(localstream);
|
pc1.addStream(localstream);
|
||||||
trace("Adding Local Stream to peer connection");
|
trace("Adding Local Stream to peer connection");
|
||||||
|
|
||||||
pc1.createOffer(gotDescription1);
|
pc1.createOffer(gotDescription1, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function call() {
|
function call() {
|
||||||
|
@ -82,7 +82,7 @@ function call() {
|
|||||||
pc1.addStream(localstream);
|
pc1.addStream(localstream);
|
||||||
trace("Adding Local Stream to peer connection");
|
trace("Adding Local Stream to peer connection");
|
||||||
|
|
||||||
pc1.createOffer(gotDescription1);
|
pc1.createOffer(gotDescription1, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotDescription1(desc){
|
function gotDescription1(desc){
|
||||||
|
@ -95,10 +95,10 @@ var sdpConstraints = {'mandatory': {
|
|||||||
refreshSources();
|
refreshSources();
|
||||||
|
|
||||||
function refreshSources() {
|
function refreshSources() {
|
||||||
if (webrtcDetectedVersion >= 30) {
|
if (webrtcDetectedBrowser === 'chrome' && webrtcDetectedVersion >= 30) {
|
||||||
MediaStreamTrack.getSources(gotSources);
|
MediaStreamTrack.getSources(gotSources);
|
||||||
} else {
|
} else {
|
||||||
alert('Make sure that you have Chrome M30 to test device enumeration api.');
|
alert('Failed to enumerate devices, you need Chrome version 30 or higher');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ function maybeAddLineBreakToEnd(sdp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createOffer(){
|
function createOffer(){
|
||||||
pc1.createOffer(gotDescription1,null,null);
|
pc1.createOffer(gotDescription1, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOffer(){
|
function setOffer(){
|
||||||
|
@ -129,7 +129,7 @@ function call() {
|
|||||||
pc2.onaddstream = gotRemoteStream;
|
pc2.onaddstream = gotRemoteStream;
|
||||||
pc1.addStream(localstream);
|
pc1.addStream(localstream);
|
||||||
trace("Adding Local Stream to peer connection");
|
trace("Adding Local Stream to peer connection");
|
||||||
pc1.createOffer(gotDescription1);
|
pc1.createOffer(gotDescription1, null, sdpConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotDescription1(desc){
|
function gotDescription1(desc){
|
||||||
|
Reference in New Issue
Block a user