Committed by
GitHub
use participant tracks in update subscription (#49)
正在显示
3 个修改的文件
包含
9 行增加
和
4 行删除
| @@ -346,9 +346,9 @@ constructor( | @@ -346,9 +346,9 @@ constructor( | ||
| 346 | sendRequest(request) | 346 | sendRequest(request) |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | - fun sendUpdateSubscription(sid: String, subscribe: Boolean) { | 349 | + fun sendUpdateSubscription(subscribe: Boolean, vararg participantTracks: LivekitModels.ParticipantTracks) { |
| 350 | val subscription = LivekitRtc.UpdateSubscription.newBuilder() | 350 | val subscription = LivekitRtc.UpdateSubscription.newBuilder() |
| 351 | - .addTrackSids(sid) | 351 | + .addAllParticipantTracks(participantTracks.toList()) |
| 352 | .setSubscribe(subscribe) | 352 | .setSubscribe(subscribe) |
| 353 | 353 | ||
| 354 | val request = LivekitRtc.SignalRequest.newBuilder() | 354 | val request = LivekitRtc.SignalRequest.newBuilder() |
| @@ -99,7 +99,12 @@ class RemoteTrackPublication( | @@ -99,7 +99,12 @@ class RemoteTrackPublication( | ||
| 99 | fun setSubscribed(subscribed: Boolean) { | 99 | fun setSubscribed(subscribed: Boolean) { |
| 100 | unsubscribed = !subscribed | 100 | unsubscribed = !subscribed |
| 101 | val participant = this.participant.get() as? RemoteParticipant ?: return | 101 | val participant = this.participant.get() as? RemoteParticipant ?: return |
| 102 | - participant.signalClient.sendUpdateSubscription(sid, !unsubscribed) | 102 | + val participantTracks = with(LivekitModels.ParticipantTracks.newBuilder()) { |
| 103 | + participantSid = participant.sid | ||
| 104 | + addTrackSids(sid) | ||
| 105 | + build() | ||
| 106 | + } | ||
| 107 | + participant.signalClient.sendUpdateSubscription(!unsubscribed, participantTracks) | ||
| 103 | } | 108 | } |
| 104 | 109 | ||
| 105 | /** | 110 | /** |
-
请 注册 或 登录 后发表评论