Hello,
All is in the title. Below, javaScript code to reproduce the issue.
If you change the code to use same media type for both PeerConnection
and GetUserMedia then, the code work.
var o_webkitGetUserMediaHasType = { audio: true, video: false };
var o_MediaContraintsHasType = { audio: true, video: false };
== JAVASCRIPT CODE ==
var o_stream = null;
var o_pc;
var o_webkitGetUserMediaHasType = { audio: true, video: false };
var o_MediaContraintsHasType = { audio: true, video: true };
var o_media_constraints =
{ 'mandatory':
{
'OfferToReceiveAudio': o_MediaContraintsHasType.audio,
'OfferToReceiveVideo': o_MediaContraintsHasType.video
}
};
window.onload = function () {
if (navigator.webkitGetUserMedia) {
navigator.webkitGetUserMedia({ audio:
o_webkitGetUserMediaHasType.audio, video:
o_webkitGetUserMediaHasType.video },
function (stream) {
o_stream = stream;
},
function (e) {
console.error(e.toString());
});
}
};
var s_answer = "v=0\r\n" +
"o=root 1899020397 1899020397 IN IP4 87.106.69.240\r\n" +
"s=Asterisk PBX SVN-trunk-r376131M\r\n" +
"c=IN IP4 87.106.69.240\r\n" +
"t=0 0\r\n" +
"m=audio 16872 RTP/SAVPF 0 8 101\r\n" +
"a=rtpmap:0 PCMU/8000\r\n" +
"a=rtpmap:8 PCMA/8000\r\n" +
"a=rtpmap:101 telephone-event/8000\r\n" +
"a=fmtp:101 0-16\r\n" +
"a=silenceSupp:off - - - -\r\n" +
"a=ptime:20\r\n" +
"a=ice-ufrag:4d41d1d24fe82de138e9871d4905fbbe\r\n" +
"a=ice-pwd:71454c1b48845b8b37b6f9875d5d844f\r\n" +
"a=candidate:H576a45f0 1 udp 2130706431 87.106.69.240 16872
typ host generation 0 svn 25\r\n" +
"a=candidate:S576a45f0 1 udp 1694498815 87.106.69.240 16872
typ srflx generation 0 svn 25\r\n" +
"a=candidate:H576a45f0 2 udp 2130706430 87.106.69.240 16873
typ host generation 0 svn 25\r\n" +
"a=candidate:S576a45f0 2 udp 1694498814 87.106.69.240 16872
typ srflx generation 0 svn 25\r\n" +
"a=sendrecv\r\n" +
"a=crypto:1 AES_CM_128_HMAC_SHA1_80
inline:DPm7A6pyoRY1ctub98B92/j/dqFO4yuSgD+Gbx9m\r\n";
o_pc = new webkitRTCPeerConnection(
{ iceServers: [{ url: 'stun:
stun.l.google.com:
19302'}] },
o_media_constraints
);
o_pc.onicecandidate = function (o_event) {
console.info("onicecandidate = " + o_pc.iceState);
if (o_pc.iceState == "completed" || (o_event && !
o_event.candidate)) {
console.info("ICE COMPLETED");
o_pc.setRemoteDescription(
new RTCSessionDescription({ type: "answer", sdp:
s_answer }),
function () { // success callback
console.info("setRemoteDescription ok");
},
function (s_error) { // error callback
console.error("setRemoteDescription nok");
}
);
}
else if (o_pc.iceState == "failed") {
console.error("Ice state is 'failed'");
}
}
o_pc.onopen = function () {
console.info("onopen");
}
o_pc.addStream(o_stream);
o_pc.createOffer(
function (desc) {
o_pc.setLocalDescription(desc);
},
function (s_error) {
console.error("createAnswer nok: " + s_error);
},
o_media_constraints
);
Regards,