Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
livekitAndroidXuningTest
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David Liu
2021-04-03 23:10:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
da14b7b1f9fa5a50d5a460e30e0b42fec1687cb2
da14b7b1
1 parent
951f29ec
use server provided ice servers if any
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
33 行增加
和
17 行删除
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt
查看文件 @
da14b7b
...
...
@@ -27,7 +27,7 @@ class RTCEngine
@Inject
constructor(
val client: RTCClient,
pctFactory: PeerConnectionTransport.Factory,
p
rivate val p
ctFactory: PeerConnectionTransport.Factory,
@Named(InjectionNames.DISPATCHER_IO) ioDispatcher: CoroutineDispatcher,
) : RTCClient.Listener {
...
...
@@ -49,26 +49,13 @@ constructor(
private val publisherObserver = PublisherTransportObserver(this)
private val subscriberObserver = SubscriberTransportObserver(this)
internal val publisher: PeerConnectionTransport
private val subscriber: PeerConnectionTransport
private var privateDataChannel: DataChannel
internal lateinit var publisher: PeerConnectionTransport
private lateinit var subscriber: PeerConnectionTransport
private lateinit var privateDataChannel: DataChannel
private val coroutineScope = CloseableCoroutineScope(SupervisorJob() + ioDispatcher)
init {
val rtcConfig = PeerConnection.RTCConfiguration(RTCClient.DEFAULT_ICE_SERVERS).apply {
sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN
continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
}
publisher = pctFactory.create(rtcConfig, publisherObserver)
subscriber = pctFactory.create(rtcConfig, subscriberObserver)
client.listener = this
privateDataChannel = publisher.peerConnection.createDataChannel(
PRIVATE_DATA_CHANNEL_LABEL,
DataChannel.Init()
)
}
fun join(url: String, token: String) {
...
...
@@ -166,6 +153,35 @@ constructor(
override fun onJoin(info: LivekitRtc.JoinResponse) {
joinResponse = info
val iceServers = mutableListOf<PeerConnection.IceServer>()
for(serverInfo in info.iceServersList){
val username = serverInfo.username ?: ""
val credential = serverInfo.credential ?: ""
iceServers.add(
PeerConnection.IceServer
.builder(serverInfo.urlsList)
.setUsername(username)
.setPassword(credential)
.createIceServer()
)
}
if(iceServers.isEmpty()){
iceServers.addAll(RTCClient.DEFAULT_ICE_SERVERS)
}
val rtcConfig = PeerConnection.RTCConfiguration(iceServers).apply {
sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN
continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
}
publisher = pctFactory.create(rtcConfig, publisherObserver)
subscriber = pctFactory.create(rtcConfig, subscriberObserver)
privateDataChannel = publisher.peerConnection.createDataChannel(
PRIVATE_DATA_CHANNEL_LABEL,
DataChannel.Init()
)
coroutineScope.launch {
val sdpOffer =
when (val outcome = publisher.peerConnection.createOffer(OFFER_CONSTRAINTS)) {
...
...
请
注册
或
登录
后发表评论