正在显示
4 个修改的文件
包含
15 行增加
和
15 行删除
| @@ -176,10 +176,10 @@ constructor( | @@ -176,10 +176,10 @@ constructor( | ||
| 176 | fun onIceReconnected() | 176 | fun onIceReconnected() |
| 177 | fun onAddTrack(track: MediaStreamTrack, streams: Array<out MediaStream>) | 177 | fun onAddTrack(track: MediaStreamTrack, streams: Array<out MediaStream>) |
| 178 | fun onUpdateParticipants(updates: List<LivekitModels.ParticipantInfo>) | 178 | fun onUpdateParticipants(updates: List<LivekitModels.ParticipantInfo>) |
| 179 | - fun onUpdateSpeakers(speakers: List<LivekitRtc.SpeakerInfo>) | 179 | + fun onUpdateSpeakers(speakers: List<LivekitModels.SpeakerInfo>) |
| 180 | fun onDisconnect(reason: String) | 180 | fun onDisconnect(reason: String) |
| 181 | fun onFailToConnect(error: Exception) | 181 | fun onFailToConnect(error: Exception) |
| 182 | - fun onUserPacket(packet: LivekitRtc.UserPacket, kind: LivekitRtc.DataPacket.Kind) | 182 | + fun onUserPacket(packet: LivekitModels.UserPacket, kind: LivekitModels.DataPacket.Kind) |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | companion object { | 185 | companion object { |
| @@ -369,7 +369,7 @@ constructor( | @@ -369,7 +369,7 @@ constructor( | ||
| 369 | listener?.onUpdateParticipants(updates) | 369 | listener?.onUpdateParticipants(updates) |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | - override fun onActiveSpeakersChanged(speakers: List<LivekitRtc.SpeakerInfo>) { | 372 | + override fun onActiveSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>) { |
| 373 | listener?.onUpdateSpeakers(speakers) | 373 | listener?.onUpdateSpeakers(speakers) |
| 374 | } | 374 | } |
| 375 | 375 | ||
| @@ -400,15 +400,15 @@ constructor( | @@ -400,15 +400,15 @@ constructor( | ||
| 400 | if (buffer == null) { | 400 | if (buffer == null) { |
| 401 | return | 401 | return |
| 402 | } | 402 | } |
| 403 | - val dp = LivekitRtc.DataPacket.parseFrom(buffer.data) | 403 | + val dp = LivekitModels.DataPacket.parseFrom(buffer.data) |
| 404 | when (dp.valueCase) { | 404 | when (dp.valueCase) { |
| 405 | - LivekitRtc.DataPacket.ValueCase.SPEAKER -> { | 405 | + LivekitModels.DataPacket.ValueCase.SPEAKER -> { |
| 406 | listener?.onUpdateSpeakers(dp.speaker.speakersList) | 406 | listener?.onUpdateSpeakers(dp.speaker.speakersList) |
| 407 | } | 407 | } |
| 408 | - LivekitRtc.DataPacket.ValueCase.USER -> { | 408 | + LivekitModels.DataPacket.ValueCase.USER -> { |
| 409 | listener?.onUserPacket(dp.user, dp.kind) | 409 | listener?.onUserPacket(dp.user, dp.kind) |
| 410 | } | 410 | } |
| 411 | - LivekitRtc.DataPacket.ValueCase.VALUE_NOT_SET, | 411 | + LivekitModels.DataPacket.ValueCase.VALUE_NOT_SET, |
| 412 | null -> { | 412 | null -> { |
| 413 | Timber.v { "invalid value for data packet" } | 413 | Timber.v { "invalid value for data packet" } |
| 414 | } | 414 | } |
| @@ -109,7 +109,7 @@ constructor( | @@ -109,7 +109,7 @@ constructor( | ||
| 109 | return participant | 109 | return participant |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | - private fun handleSpeakerUpdate(speakerInfos: List<LivekitRtc.SpeakerInfo>) { | 112 | + private fun handleSpeakerUpdate(speakerInfos: List<LivekitModels.SpeakerInfo>) { |
| 113 | val speakers = mutableListOf<Participant>() | 113 | val speakers = mutableListOf<Participant>() |
| 114 | val seenSids = mutableSetOf<String>() | 114 | val seenSids = mutableSetOf<String>() |
| 115 | val localParticipant = localParticipant | 115 | val localParticipant = localParticipant |
| @@ -289,14 +289,14 @@ constructor( | @@ -289,14 +289,14 @@ constructor( | ||
| 289 | /** | 289 | /** |
| 290 | * @suppress | 290 | * @suppress |
| 291 | */ | 291 | */ |
| 292 | - override fun onUpdateSpeakers(speakers: List<LivekitRtc.SpeakerInfo>) { | 292 | + override fun onUpdateSpeakers(speakers: List<LivekitModels.SpeakerInfo>) { |
| 293 | handleSpeakerUpdate(speakers) | 293 | handleSpeakerUpdate(speakers) |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | /** | 296 | /** |
| 297 | * @suppress | 297 | * @suppress |
| 298 | */ | 298 | */ |
| 299 | - override fun onUserPacket(packet: LivekitRtc.UserPacket, kind: LivekitRtc.DataPacket.Kind) { | 299 | + override fun onUserPacket(packet: LivekitModels.UserPacket, kind: LivekitModels.DataPacket.Kind) { |
| 300 | val participant = remoteParticipants[packet.participantSid] ?: return | 300 | val participant = remoteParticipants[packet.participantSid] ?: return |
| 301 | val data = packet.payload.toByteArray() | 301 | val data = packet.payload.toByteArray() |
| 302 | 302 |
| @@ -347,7 +347,7 @@ constructor( | @@ -347,7 +347,7 @@ constructor( | ||
| 347 | fun onTrickle(candidate: IceCandidate, target: LivekitRtc.SignalTarget) | 347 | fun onTrickle(candidate: IceCandidate, target: LivekitRtc.SignalTarget) |
| 348 | fun onLocalTrackPublished(response: LivekitRtc.TrackPublishedResponse) | 348 | fun onLocalTrackPublished(response: LivekitRtc.TrackPublishedResponse) |
| 349 | fun onParticipantUpdate(updates: List<LivekitModels.ParticipantInfo>) | 349 | fun onParticipantUpdate(updates: List<LivekitModels.ParticipantInfo>) |
| 350 | - fun onActiveSpeakersChanged(speakers: List<LivekitRtc.SpeakerInfo>) | 350 | + fun onActiveSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>) |
| 351 | fun onClose(reason: String, code: Int) | 351 | fun onClose(reason: String, code: Int) |
| 352 | fun onLeave() | 352 | fun onLeave() |
| 353 | fun onError(error: Exception) | 353 | fun onError(error: Exception) |
| @@ -159,21 +159,21 @@ internal constructor( | @@ -159,21 +159,21 @@ internal constructor( | ||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | val kind = when (reliability) { | 161 | val kind = when (reliability) { |
| 162 | - DataPublishReliability.RELIABLE -> LivekitRtc.DataPacket.Kind.RELIABLE | ||
| 163 | - DataPublishReliability.LOSSY -> LivekitRtc.DataPacket.Kind.LOSSY | 162 | + DataPublishReliability.RELIABLE -> LivekitModels.DataPacket.Kind.RELIABLE |
| 163 | + DataPublishReliability.LOSSY -> LivekitModels.DataPacket.Kind.LOSSY | ||
| 164 | } | 164 | } |
| 165 | val channel = when (reliability) { | 165 | val channel = when (reliability) { |
| 166 | DataPublishReliability.RELIABLE -> engine.reliableDataChannel | 166 | DataPublishReliability.RELIABLE -> engine.reliableDataChannel |
| 167 | DataPublishReliability.LOSSY -> engine.lossyDataChannel | 167 | DataPublishReliability.LOSSY -> engine.lossyDataChannel |
| 168 | } ?: throw TrackException.PublishException("data channel not established") | 168 | } ?: throw TrackException.PublishException("data channel not established") |
| 169 | 169 | ||
| 170 | - val packetBuilder = LivekitRtc.UserPacket.newBuilder(). | 170 | + val packetBuilder = LivekitModels.UserPacket.newBuilder(). |
| 171 | setPayload(ByteString.copyFrom(data)). | 171 | setPayload(ByteString.copyFrom(data)). |
| 172 | setParticipantSid(sid) | 172 | setParticipantSid(sid) |
| 173 | if (destination != null) { | 173 | if (destination != null) { |
| 174 | packetBuilder.addAllDestinationSids(destination) | 174 | packetBuilder.addAllDestinationSids(destination) |
| 175 | } | 175 | } |
| 176 | - val dataPacket = LivekitRtc.DataPacket.newBuilder(). | 176 | + val dataPacket = LivekitModels.DataPacket.newBuilder(). |
| 177 | setUser(packetBuilder). | 177 | setUser(packetBuilder). |
| 178 | setKind(kind). | 178 | setKind(kind). |
| 179 | build() | 179 | build() |
-
请 注册 或 登录 后发表评论