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-11-08 20:53:28 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
25f08b899efba80a3a167c152f0ec3bcc8b13bd2
25f08b89
1 parent
28fe82b7
publish and unpublish events for local participant
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
45 行增加
和
4 行删除
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/LocalParticipant.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Participant.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
查看文件 @
25f08b8
...
...
@@ -76,7 +76,7 @@ constructor(
}
val lp = localParticipantFactory.create(response.participant)
lp.
l
istener = this
lp.
internalL
istener = this
localParticipant = lp
if (response.otherParticipantsList.isNotEmpty()) {
response.otherParticipantsList.forEach {
...
...
@@ -366,7 +366,7 @@ constructor(
listener?.onFailedToConnect(this, error)
}
//-------------------------------
RemoteParticipant.
Listener --------------------------------//
//-------------------------------
Participant
Listener --------------------------------//
/**
* This is called for both Local and Remote participants
* @suppress
...
...
@@ -402,6 +402,20 @@ constructor(
/**
* @suppress
*/
override fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant) {
listener?.onTrackPublished(publication, participant, this)
}
/**
* @suppress
*/
override fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant) {
listener?.onTrackUnpublished(publication, participant, this)
}
/**
* @suppress
*/
override fun onTrackSubscribed(track: Track, publication: RemoteTrackPublication, participant: RemoteParticipant) {
listener?.onTrackSubscribed(track, publication, participant, this)
}
...
...
@@ -531,6 +545,16 @@ interface RoomListener {
fun onTrackUnpublished(publication: TrackPublication, participant: RemoteParticipant, room: Room) {}
/**
* When a new track is published to room after the local participant has joined.
*/
fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant, room: Room) {}
/**
* [LocalParticipant] has unpublished a track
*/
fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant, room: Room) {}
/**
* The [LocalParticipant] has subscribed to a new track. This event will always fire as
* long as new tracks are ready for use.
*/
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/LocalParticipant.kt
查看文件 @
25f08b8
...
...
@@ -34,7 +34,9 @@ internal constructor(
}
private val localTrackPublications
get() = tracks.values.toList()
get() = tracks.values
.mapNotNull { it as? LocalTrackPublication }
.toList()
/**
* Creates an audio track, recording audio through the microphone with the given [options].
...
...
@@ -133,6 +135,7 @@ internal constructor(
val publication = LocalTrackPublication(trackInfo, track, this)
addTrackPublication(publication)
publishListener?.onPublishSuccess(publication)
internalListener?.onTrackPublished(publication, this)
}
suspend fun publishVideoTrack(
...
...
@@ -180,6 +183,7 @@ internal constructor(
val publication = LocalTrackPublication(trackInfo, track, this)
addTrackPublication(publication)
publishListener?.onPublishSuccess(publication)
internalListener?.onTrackPublished(publication, this)
}
private fun computeVideoEncodings(
...
...
@@ -282,7 +286,8 @@ internal constructor(
when (publication.kind) {
Track.Kind.AUDIO -> audioTracks.remove(sid)
Track.Kind.VIDEO -> videoTracks.remove(sid)
else -> {}
else -> {
}
}
val senders = engine.publisher.peerConnection.senders ?: return
for (sender in senders) {
...
...
@@ -292,6 +297,7 @@ internal constructor(
}
}
track.stop()
internalListener?.onTrackUnpublished(publication, this)
}
/**
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Participant.kt
查看文件 @
25f08b8
...
...
@@ -123,6 +123,17 @@ interface ParticipantListener {
fun onTrackUnmuted(publication: TrackPublication, participant: Participant) {}
// local participants
/**
* When a new track is published by the local participant.
*/
fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant) {}
/**
* A [LocalParticipant] has unpublished a track
*/
fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant) {}
// remote participants
/**
* When a new track is published to room after the local participant has joined.
...
...
请
注册
或
登录
后发表评论