Add TURN server to android webRtc native
up vote
2
down vote
favorite
I'm working on WebRtc native android application. Im also compiling io.pristine lib. Im able to establish calls between two devices only if both of them are connected to the wifi. In case when one of the devices is connected to the cellular network im not able to establish call. I read any possible forum out there and its look like I need TURN server. I already run my own TURN server but idk how I can force the app to use this server. Any help is welcome. Thank you!!
android webrtc turn
add a comment |
up vote
2
down vote
favorite
I'm working on WebRtc native android application. Im also compiling io.pristine lib. Im able to establish calls between two devices only if both of them are connected to the wifi. In case when one of the devices is connected to the cellular network im not able to establish call. I read any possible forum out there and its look like I need TURN server. I already run my own TURN server but idk how I can force the app to use this server. Any help is welcome. Thank you!!
android webrtc turn
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm working on WebRtc native android application. Im also compiling io.pristine lib. Im able to establish calls between two devices only if both of them are connected to the wifi. In case when one of the devices is connected to the cellular network im not able to establish call. I read any possible forum out there and its look like I need TURN server. I already run my own TURN server but idk how I can force the app to use this server. Any help is welcome. Thank you!!
android webrtc turn
I'm working on WebRtc native android application. Im also compiling io.pristine lib. Im able to establish calls between two devices only if both of them are connected to the wifi. In case when one of the devices is connected to the cellular network im not able to establish call. I read any possible forum out there and its look like I need TURN server. I already run my own TURN server but idk how I can force the app to use this server. Any help is welcome. Thank you!!
android webrtc turn
android webrtc turn
asked Jun 16 '17 at 2:27
Alexander
53111
53111
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19
add a comment |
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
You need to set the TURN server when creating the PeerConnection.
It will go something like this:
// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:xxx.xxx.xxx.xxx"));
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:3478", "username", "credential"));
// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
PeerConnectionFactory factory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
MediaConstraints constraints = new MediaConstraints();
PeerConnection peerConnection = factory.createPeerConnection(iceServers, constraints, new YourPeerConnectionObserver());
I have not run this code, but you should get the idea.
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
add a comment |
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%2f44579855%2fadd-turn-server-to-android-webrtc-native%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
up vote
3
down vote
accepted
You need to set the TURN server when creating the PeerConnection.
It will go something like this:
// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:xxx.xxx.xxx.xxx"));
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:3478", "username", "credential"));
// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
PeerConnectionFactory factory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
MediaConstraints constraints = new MediaConstraints();
PeerConnection peerConnection = factory.createPeerConnection(iceServers, constraints, new YourPeerConnectionObserver());
I have not run this code, but you should get the idea.
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
add a comment |
up vote
3
down vote
accepted
You need to set the TURN server when creating the PeerConnection.
It will go something like this:
// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:xxx.xxx.xxx.xxx"));
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:3478", "username", "credential"));
// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
PeerConnectionFactory factory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
MediaConstraints constraints = new MediaConstraints();
PeerConnection peerConnection = factory.createPeerConnection(iceServers, constraints, new YourPeerConnectionObserver());
I have not run this code, but you should get the idea.
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
You need to set the TURN server when creating the PeerConnection.
It will go something like this:
// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:xxx.xxx.xxx.xxx"));
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:3478", "username", "credential"));
// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
PeerConnectionFactory factory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
MediaConstraints constraints = new MediaConstraints();
PeerConnection peerConnection = factory.createPeerConnection(iceServers, constraints, new YourPeerConnectionObserver());
I have not run this code, but you should get the idea.
You need to set the TURN server when creating the PeerConnection.
It will go something like this:
// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:xxx.xxx.xxx.xxx"));
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:3478", "username", "credential"));
// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
PeerConnectionFactory factory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
MediaConstraints constraints = new MediaConstraints();
PeerConnection peerConnection = factory.createPeerConnection(iceServers, constraints, new YourPeerConnectionObserver());
I have not run this code, but you should get the idea.
edited Jan 7 at 8:39
answered Aug 3 '17 at 21:01
Mikko
8781623
8781623
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
add a comment |
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
1
1
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
just add bracket in the end of the 2nd and 3rd line.
– Uriel Frankel
Dec 24 '17 at 10:17
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
Hey @Mikko, my ICE servers looks like: "stun:URL", "turns:URL:433?transport=tcp", "turns:URL:5349?transport=tcp" But I see only typ host and typ srflx Ice Candidates in signaling channel. I'm able to establish call when devices are connected to same hotspot but gets onIceConnectionChange: state=FAILED when one of them uses cellular network
– Dimaslviv
Oct 22 at 20:09
add a comment |
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%2f44579855%2fadd-turn-server-to-android-webrtc-native%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
could you guide me how to build io.pristine lib.
– M.Hefny
Aug 16 '17 at 23:33
Strictly speaking, just a STUN server will be enough, but TURN will also provide a fallback if your clients are not able to establish a peer-to-peer connection. There are free public STUN servers out there, e.g. stun.l.google.com:19302.
– jamix
Jan 3 at 10:19