-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2 API changes #280
v2 API changes #280
Changes from all commits
b3c712a
de175f6
601833c
1c080ca
e1d41e7
b784d49
c39c5a1
8f35eb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ public class LocalParticipant: Participant { | |
private var trackPermissions: [ParticipantTrackPermission] = [] | ||
|
||
init(room: Room) { | ||
super.init(sid: "", room: room) | ||
super.init(sid: "", identity: "", room: room) | ||
} | ||
|
||
func getTrackPublication(sid: Sid) -> LocalTrackPublication? { | ||
|
@@ -307,7 +307,7 @@ public class LocalParticipant: Participant { | |
@objc | ||
public func publish(data: Data, | ||
reliability: Reliability = .reliable, | ||
destinations: [Sid]? = nil, | ||
destinationIdentities: [Identity]? = nil, | ||
topic: String? = nil, | ||
options: DataPublishOptions? = nil) async throws | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to simplify the API here, could we give |
||
{ | ||
|
@@ -316,7 +316,7 @@ public class LocalParticipant: Participant { | |
let userPacket = Livekit_UserPacket.with { | ||
$0.participantSid = self.sid | ||
$0.payload = data | ||
$0.destinationSids = destinations ?? options.destinations | ||
$0.destinationIdentities = destinationIdentities ?? options.destinationIdentities | ||
$0.topic = topic ?? options.topic ?? "" | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ public class Participant: NSObject, ObservableObject, Loggable { | |
public var sid: Sid { _state.sid } | ||
|
||
@objc | ||
public var identity: String? { _state.identity } | ||
public var identity: String { _state.identity } | ||
|
||
@objc | ||
public var name: String? { _state.name } | ||
|
@@ -53,7 +53,7 @@ public class Participant: NSObject, ObservableObject, Loggable { | |
public var joinedAt: Date? { _state.joinedAt } | ||
|
||
@objc | ||
public var tracks: [String: TrackPublication] { _state.tracks } | ||
public var tracksPublications: [Sid: TrackPublication] { _state.tracks } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: in the JS version this is called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, this is a refactoring typo |
||
|
||
@objc | ||
public var audioTracks: [TrackPublication] { | ||
|
@@ -74,7 +74,7 @@ public class Participant: NSObject, ObservableObject, Loggable { | |
|
||
struct State: Equatable, Hashable { | ||
var sid: Sid | ||
var identity: String? | ||
var identity: String | ||
var name: String? | ||
var audioLevel: Float = 0.0 | ||
var isSpeaking: Bool = false | ||
|
@@ -87,11 +87,11 @@ public class Participant: NSObject, ObservableObject, Loggable { | |
|
||
var _state: StateSync<State> | ||
|
||
init(sid: String, room: Room) { | ||
init(sid: Sid, identity: Identity, room: Room) { | ||
self.room = room | ||
|
||
// initial state | ||
_state = StateSync(State(sid: sid)) | ||
_state = StateSync(State(sid: sid, identity: identity)) | ||
|
||
super.init() | ||
|
||
|
@@ -153,7 +153,7 @@ public class Participant: NSObject, ObservableObject, Loggable { | |
func cleanUp(notify _notify: Bool = true) async { | ||
await unpublishAll(notify: _notify) | ||
// Reset state | ||
_state.mutate { $0 = State(sid: "") } | ||
_state.mutate { $0 = State(sid: "", identity: "") } | ||
} | ||
|
||
func unpublishAll(notify _: Bool = true) async { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this to
publishData
, too, so that it's easier to refer to the same API in the docs?