Skip to content

Instantly share code, notes, and snippets.

@skydoves
Last active January 27, 2023 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/3f19e7c84da07e0784087718dbbfca92 to your computer and use it in GitHub Desktop.
Save skydoves/3f19e7c84da07e0784087718dbbfca92 to your computer and use it in GitHub Desktop.
StreamPeerConnectionFactory STUN
// Copyright 2023 Stream.IO, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
class StreamPeerConnectionFactory constructor(
private val context: Context
) {
// rtcConfig contains STUN and TURN servers list
val rtcConfig = PeerConnection.RTCConfiguration(
arrayListOf(
// adding google's standard server
PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer()
)
).apply {
// it's very important to use new unified sdp semantics PLAN_B is deprecated
sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN
}
..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment