livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences on iOS, macOS, tvOS, and visionOS.
https://livekit.io
Apache License 2.0
198 stars 97 forks source link

subscription and unsubscription track in Objective-C #277

Closed cl252738669 closed 8 months ago

cl252738669 commented 10 months ago

In Swift, i can achieve subscription and unsubscription like this: /// Subscribe or unsubscribe from this track. @discardableResult public func set(subscribed newValue: Bool) -> Promise {

guard _state.preferSubscribed != newValue else { return Promise(()) }

guard let participant = participant else {
    log("Participant is nil", .warning)
    return Promise(EngineError.state(message: "Participant is nil"))
}

_state.mutate { $0.preferSubscribed = newValue }

return participant.room.engine.signalClient.sendUpdateSubscription(
    participantSid: participant.sid,
    trackSid: sid,
    subscribed: newValue
)

}

How to implement this in Objective-C

hiroshihorie commented 8 months ago

Thanks for the report, I think this commit fixes this: https://github.com/livekit/client-sdk-swift/commit/8e1043d197ce11b835d948a14807fd4b001a7c3e Will be in v2.