WebRTC both remote and local video is displayed with local stream
hello i am newbie in WebRTC and i tried this code
const yourVideo = document.querySelector("#face_cam_vid");
const theirVideo = document.querySelector("#thevid");
(async () => {
if (!("mediaDevices" in navigator) || !("RTCPeerConnection" in window)) {
alert("Sorry, your browser does not support WebRTC.");
return;
}
const stream = await navigator.mediaDevices.getUserMedia({video: true,
audio: true});
yourVideo.srcObject = stream;
const configuration = {
iceServers: [{urls: "stun:stun.1.google.com:19302"}]
};
const yours = new RTCPeerConnection(configuration);
const theirs = new RTCPeerConnection(configuration);
for (const track of stream.getTracks()) {
yours.addTrack(track, stream);
}
theirs.ontrack = e => theirVideo.srcObject = e.streams[0];
yours.onicecandidate = e => theirs.addIceCandidate(e.candidate);
theirs.onicecandidate = e => yours.addIceCandidate(e.candidate);
const offer = await yours.createOffer();
await yours.setLocalDescription(offer);
await theirs.setRemoteDescription(offer);
const answer = await theirs.createAnswer();
await theirs.setLocalDescription(answer);
await yours.setRemoteDescription(answer);
})();
and it works but partly https://imgur.com/a/nG7Xif6 . in short i am creating ONE-to-ONE random video chatting like in omegle but this code displays both "remote"(stranger's) and "local"("mine") video with my local stream but all i want is , user wait for second user to have video chat and when third user enters it should wait for fourth and etc. i hope someone will help me with that
javascript webrtc
add a comment |
hello i am newbie in WebRTC and i tried this code
const yourVideo = document.querySelector("#face_cam_vid");
const theirVideo = document.querySelector("#thevid");
(async () => {
if (!("mediaDevices" in navigator) || !("RTCPeerConnection" in window)) {
alert("Sorry, your browser does not support WebRTC.");
return;
}
const stream = await navigator.mediaDevices.getUserMedia({video: true,
audio: true});
yourVideo.srcObject = stream;
const configuration = {
iceServers: [{urls: "stun:stun.1.google.com:19302"}]
};
const yours = new RTCPeerConnection(configuration);
const theirs = new RTCPeerConnection(configuration);
for (const track of stream.getTracks()) {
yours.addTrack(track, stream);
}
theirs.ontrack = e => theirVideo.srcObject = e.streams[0];
yours.onicecandidate = e => theirs.addIceCandidate(e.candidate);
theirs.onicecandidate = e => yours.addIceCandidate(e.candidate);
const offer = await yours.createOffer();
await yours.setLocalDescription(offer);
await theirs.setRemoteDescription(offer);
const answer = await theirs.createAnswer();
await theirs.setLocalDescription(answer);
await yours.setRemoteDescription(answer);
})();
and it works but partly https://imgur.com/a/nG7Xif6 . in short i am creating ONE-to-ONE random video chatting like in omegle but this code displays both "remote"(stranger's) and "local"("mine") video with my local stream but all i want is , user wait for second user to have video chat and when third user enters it should wait for fourth and etc. i hope someone will help me with that
javascript webrtc
add a comment |
hello i am newbie in WebRTC and i tried this code
const yourVideo = document.querySelector("#face_cam_vid");
const theirVideo = document.querySelector("#thevid");
(async () => {
if (!("mediaDevices" in navigator) || !("RTCPeerConnection" in window)) {
alert("Sorry, your browser does not support WebRTC.");
return;
}
const stream = await navigator.mediaDevices.getUserMedia({video: true,
audio: true});
yourVideo.srcObject = stream;
const configuration = {
iceServers: [{urls: "stun:stun.1.google.com:19302"}]
};
const yours = new RTCPeerConnection(configuration);
const theirs = new RTCPeerConnection(configuration);
for (const track of stream.getTracks()) {
yours.addTrack(track, stream);
}
theirs.ontrack = e => theirVideo.srcObject = e.streams[0];
yours.onicecandidate = e => theirs.addIceCandidate(e.candidate);
theirs.onicecandidate = e => yours.addIceCandidate(e.candidate);
const offer = await yours.createOffer();
await yours.setLocalDescription(offer);
await theirs.setRemoteDescription(offer);
const answer = await theirs.createAnswer();
await theirs.setLocalDescription(answer);
await yours.setRemoteDescription(answer);
})();
and it works but partly https://imgur.com/a/nG7Xif6 . in short i am creating ONE-to-ONE random video chatting like in omegle but this code displays both "remote"(stranger's) and "local"("mine") video with my local stream but all i want is , user wait for second user to have video chat and when third user enters it should wait for fourth and etc. i hope someone will help me with that
javascript webrtc
hello i am newbie in WebRTC and i tried this code
const yourVideo = document.querySelector("#face_cam_vid");
const theirVideo = document.querySelector("#thevid");
(async () => {
if (!("mediaDevices" in navigator) || !("RTCPeerConnection" in window)) {
alert("Sorry, your browser does not support WebRTC.");
return;
}
const stream = await navigator.mediaDevices.getUserMedia({video: true,
audio: true});
yourVideo.srcObject = stream;
const configuration = {
iceServers: [{urls: "stun:stun.1.google.com:19302"}]
};
const yours = new RTCPeerConnection(configuration);
const theirs = new RTCPeerConnection(configuration);
for (const track of stream.getTracks()) {
yours.addTrack(track, stream);
}
theirs.ontrack = e => theirVideo.srcObject = e.streams[0];
yours.onicecandidate = e => theirs.addIceCandidate(e.candidate);
theirs.onicecandidate = e => yours.addIceCandidate(e.candidate);
const offer = await yours.createOffer();
await yours.setLocalDescription(offer);
await theirs.setRemoteDescription(offer);
const answer = await theirs.createAnswer();
await theirs.setLocalDescription(answer);
await yours.setRemoteDescription(answer);
})();
and it works but partly https://imgur.com/a/nG7Xif6 . in short i am creating ONE-to-ONE random video chatting like in omegle but this code displays both "remote"(stranger's) and "local"("mine") video with my local stream but all i want is , user wait for second user to have video chat and when third user enters it should wait for fourth and etc. i hope someone will help me with that
javascript webrtc
javascript webrtc
asked Nov 20 at 17:15
codR
517
517
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You're confusing a local-loop demo—what you have—with a chat room.
A local-loop demo is a short-circuit client-only proof-of-concept, linking two peer connections on the same page to each other. Utterly useless, except to prove the API works and the browser can talk to itself.
It contains localPeerConnection
and remotePeerConnection
—or pc1
and pc2
—and is not how one would typically write WebRTC code. It leaves out signaling.
Signaling is hard to demo without a server, but I show people this tab demo. Right-click and open it in two adjacent windows, and click the Call!
button on one to call the other. It uses localSocket
, a non-production hack I made using localStorage for signaling.
Just as useless, a tab-demo looks more like real code:
const pc = new RTCPeerConnection();
call.onclick = async () => {
video.srcObject = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
for (const track of video.srcObject.getTracks()) {
pc.addTrack(track, video.srcObject);
}
};
pc.ontrack = e => video.srcObject = e.streams[0];
pc.oniceconnectionstatechange = e => console.log(pc.iceConnectionState);
pc.onicecandidate = ({candidate}) => sc.send({candidate});
pc.onnegotiationneeded = async e => {
await pc.setLocalDescription(await pc.createOffer());
sc.send({sdp: pc.localDescription});
}
const sc = new localSocket();
sc.onmessage = async ({data: {sdp, candidate}}) => {
if (sdp) {
await pc.setRemoteDescription(sdp);
if (sdp.type == "offer") {
await pc.setLocalDescription(await pc.createAnswer());
sc.send({sdp: pc.localDescription});
}
} else if (candidate) await pc.addIceCandidate(candidate);
}
There's a single pc
—your half of the call—and there's an onmessage
signaling callback to handle the timing-critical asymmetric offer/answer negotiation correctly. Same JS on both sides.
This still isn't a chat-room. For that you need server logic to determine how people meet, and a web socket server for signaling. Try this tutorial on MDN which culminates in a chat demo.
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
|
show 5 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398178%2fwebrtc-both-remote-and-local-video-is-displayed-with-local-stream%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're confusing a local-loop demo—what you have—with a chat room.
A local-loop demo is a short-circuit client-only proof-of-concept, linking two peer connections on the same page to each other. Utterly useless, except to prove the API works and the browser can talk to itself.
It contains localPeerConnection
and remotePeerConnection
—or pc1
and pc2
—and is not how one would typically write WebRTC code. It leaves out signaling.
Signaling is hard to demo without a server, but I show people this tab demo. Right-click and open it in two adjacent windows, and click the Call!
button on one to call the other. It uses localSocket
, a non-production hack I made using localStorage for signaling.
Just as useless, a tab-demo looks more like real code:
const pc = new RTCPeerConnection();
call.onclick = async () => {
video.srcObject = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
for (const track of video.srcObject.getTracks()) {
pc.addTrack(track, video.srcObject);
}
};
pc.ontrack = e => video.srcObject = e.streams[0];
pc.oniceconnectionstatechange = e => console.log(pc.iceConnectionState);
pc.onicecandidate = ({candidate}) => sc.send({candidate});
pc.onnegotiationneeded = async e => {
await pc.setLocalDescription(await pc.createOffer());
sc.send({sdp: pc.localDescription});
}
const sc = new localSocket();
sc.onmessage = async ({data: {sdp, candidate}}) => {
if (sdp) {
await pc.setRemoteDescription(sdp);
if (sdp.type == "offer") {
await pc.setLocalDescription(await pc.createAnswer());
sc.send({sdp: pc.localDescription});
}
} else if (candidate) await pc.addIceCandidate(candidate);
}
There's a single pc
—your half of the call—and there's an onmessage
signaling callback to handle the timing-critical asymmetric offer/answer negotiation correctly. Same JS on both sides.
This still isn't a chat-room. For that you need server logic to determine how people meet, and a web socket server for signaling. Try this tutorial on MDN which culminates in a chat demo.
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
|
show 5 more comments
You're confusing a local-loop demo—what you have—with a chat room.
A local-loop demo is a short-circuit client-only proof-of-concept, linking two peer connections on the same page to each other. Utterly useless, except to prove the API works and the browser can talk to itself.
It contains localPeerConnection
and remotePeerConnection
—or pc1
and pc2
—and is not how one would typically write WebRTC code. It leaves out signaling.
Signaling is hard to demo without a server, but I show people this tab demo. Right-click and open it in two adjacent windows, and click the Call!
button on one to call the other. It uses localSocket
, a non-production hack I made using localStorage for signaling.
Just as useless, a tab-demo looks more like real code:
const pc = new RTCPeerConnection();
call.onclick = async () => {
video.srcObject = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
for (const track of video.srcObject.getTracks()) {
pc.addTrack(track, video.srcObject);
}
};
pc.ontrack = e => video.srcObject = e.streams[0];
pc.oniceconnectionstatechange = e => console.log(pc.iceConnectionState);
pc.onicecandidate = ({candidate}) => sc.send({candidate});
pc.onnegotiationneeded = async e => {
await pc.setLocalDescription(await pc.createOffer());
sc.send({sdp: pc.localDescription});
}
const sc = new localSocket();
sc.onmessage = async ({data: {sdp, candidate}}) => {
if (sdp) {
await pc.setRemoteDescription(sdp);
if (sdp.type == "offer") {
await pc.setLocalDescription(await pc.createAnswer());
sc.send({sdp: pc.localDescription});
}
} else if (candidate) await pc.addIceCandidate(candidate);
}
There's a single pc
—your half of the call—and there's an onmessage
signaling callback to handle the timing-critical asymmetric offer/answer negotiation correctly. Same JS on both sides.
This still isn't a chat-room. For that you need server logic to determine how people meet, and a web socket server for signaling. Try this tutorial on MDN which culminates in a chat demo.
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
|
show 5 more comments
You're confusing a local-loop demo—what you have—with a chat room.
A local-loop demo is a short-circuit client-only proof-of-concept, linking two peer connections on the same page to each other. Utterly useless, except to prove the API works and the browser can talk to itself.
It contains localPeerConnection
and remotePeerConnection
—or pc1
and pc2
—and is not how one would typically write WebRTC code. It leaves out signaling.
Signaling is hard to demo without a server, but I show people this tab demo. Right-click and open it in two adjacent windows, and click the Call!
button on one to call the other. It uses localSocket
, a non-production hack I made using localStorage for signaling.
Just as useless, a tab-demo looks more like real code:
const pc = new RTCPeerConnection();
call.onclick = async () => {
video.srcObject = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
for (const track of video.srcObject.getTracks()) {
pc.addTrack(track, video.srcObject);
}
};
pc.ontrack = e => video.srcObject = e.streams[0];
pc.oniceconnectionstatechange = e => console.log(pc.iceConnectionState);
pc.onicecandidate = ({candidate}) => sc.send({candidate});
pc.onnegotiationneeded = async e => {
await pc.setLocalDescription(await pc.createOffer());
sc.send({sdp: pc.localDescription});
}
const sc = new localSocket();
sc.onmessage = async ({data: {sdp, candidate}}) => {
if (sdp) {
await pc.setRemoteDescription(sdp);
if (sdp.type == "offer") {
await pc.setLocalDescription(await pc.createAnswer());
sc.send({sdp: pc.localDescription});
}
} else if (candidate) await pc.addIceCandidate(candidate);
}
There's a single pc
—your half of the call—and there's an onmessage
signaling callback to handle the timing-critical asymmetric offer/answer negotiation correctly. Same JS on both sides.
This still isn't a chat-room. For that you need server logic to determine how people meet, and a web socket server for signaling. Try this tutorial on MDN which culminates in a chat demo.
You're confusing a local-loop demo—what you have—with a chat room.
A local-loop demo is a short-circuit client-only proof-of-concept, linking two peer connections on the same page to each other. Utterly useless, except to prove the API works and the browser can talk to itself.
It contains localPeerConnection
and remotePeerConnection
—or pc1
and pc2
—and is not how one would typically write WebRTC code. It leaves out signaling.
Signaling is hard to demo without a server, but I show people this tab demo. Right-click and open it in two adjacent windows, and click the Call!
button on one to call the other. It uses localSocket
, a non-production hack I made using localStorage for signaling.
Just as useless, a tab-demo looks more like real code:
const pc = new RTCPeerConnection();
call.onclick = async () => {
video.srcObject = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
for (const track of video.srcObject.getTracks()) {
pc.addTrack(track, video.srcObject);
}
};
pc.ontrack = e => video.srcObject = e.streams[0];
pc.oniceconnectionstatechange = e => console.log(pc.iceConnectionState);
pc.onicecandidate = ({candidate}) => sc.send({candidate});
pc.onnegotiationneeded = async e => {
await pc.setLocalDescription(await pc.createOffer());
sc.send({sdp: pc.localDescription});
}
const sc = new localSocket();
sc.onmessage = async ({data: {sdp, candidate}}) => {
if (sdp) {
await pc.setRemoteDescription(sdp);
if (sdp.type == "offer") {
await pc.setLocalDescription(await pc.createAnswer());
sc.send({sdp: pc.localDescription});
}
} else if (candidate) await pc.addIceCandidate(candidate);
}
There's a single pc
—your half of the call—and there's an onmessage
signaling callback to handle the timing-critical asymmetric offer/answer negotiation correctly. Same JS on both sides.
This still isn't a chat-room. For that you need server logic to determine how people meet, and a web socket server for signaling. Try this tutorial on MDN which culminates in a chat demo.
edited Nov 20 at 23:54
answered Nov 20 at 23:48
jib
20.1k64389
20.1k64389
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
|
show 5 more comments
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
For your localSocket, just fast read it, but it sounds you are polling the Storage. You might be interested in the storage event which will let you know when an other window modified the current window's Storage Area. You can see a rough demo of such a window messaging system in this Q/A
– Kaiido
Nov 21 at 1:13
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
actually i cant understand which i cant get which one is MYVIDEO (local), and THEIRVIDEO (remote) and also i can not understand why do i need onmessage event
– codR
Nov 21 at 14:24
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
and actually i tried MDN but its kinda obscure because there is messaging system too , so because of that code is obscure thats why i posted here but thanks for that answer , i tried array of connections but it did not worked so i'll be very glad if i find answer here BTW thanks for answering me second time <3
– codR
Nov 21 at 14:29
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
A traditional message system and WebRTC share the same challenge of discovering participants, which is outside of WebRTC. Besides, the message system is needed anyway for signaling.
– jib
Nov 21 at 14:45
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
i also does not use usernames it is just pure javascript and this whole code is on usernames and coz i am newbie i can not transform MDN code like i work with users ,(i use document.hasFocus() method ) BTW that chat demo ain't workin' . i tried my best but coz i did not reach my aim i posted it here also what u mean with its hard to show people demo without server i thought only server u need is iceserver , do i need expressjs also?
– codR
Nov 21 at 16:21
|
show 5 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398178%2fwebrtc-both-remote-and-local-video-is-displayed-with-local-stream%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown