Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Incubo4u/fix-endpoints-metadata (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
incubo4u authored Jan 12, 2024
1 parent 5eceb72 commit 31e481a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Sources/MembraneRTC/Events/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public enum Events {
Sendable events
*/
struct ConnectEvent: SendableEvent {
let metadata: Metadata
let metadata: Metadata?

func serialize() -> Payload {
return .init([
Expand All @@ -195,7 +195,7 @@ struct ConnectEvent: SendableEvent {

struct SdpOfferEvent: SendableEvent {
let sdp: String
let trackIdToTrackMetadata: [String: Metadata]
let trackIdToTrackMetadata: [String: Metadata?]
let midToTrackId: [String: String]

func serialize() -> Payload {
Expand Down Expand Up @@ -264,7 +264,7 @@ struct SelectEncodingEvent: SendableEvent {
}

struct UpdateEndpointMetadata: SendableEvent {
let metadata: Metadata
let metadata: Metadata?

func serialize() -> Payload {
return .init([
Expand All @@ -276,7 +276,7 @@ struct UpdateEndpointMetadata: SendableEvent {

struct UpdateTrackMetadata: SendableEvent {
let trackId: String
let trackMetadata: Metadata
let trackMetadata: Metadata?

func serialize() -> Payload {
return .init([
Expand Down Expand Up @@ -304,7 +304,7 @@ struct EndpointAddedEvent: ReceivableEvent, Codable {
struct Data: Codable {
let id: String
let type: String
let metadata: Metadata
let metadata: Metadata?
let trackIdToMetadata: [String: Metadata]?
}

Expand All @@ -324,7 +324,7 @@ struct EndpointRemovedEvent: ReceivableEvent, Codable {
struct EndpointUpdatedEvent: ReceivableEvent, Codable {
struct Data: Codable {
let endpointId: String
let metadata: Metadata
let metadata: Metadata?
}

let type: ReceivableEventType
Expand Down Expand Up @@ -373,7 +373,7 @@ struct TracksUpdatedEvent: ReceivableEvent, Codable {
struct Data: Codable {
let endpointId: String
let trackId: String
let metadata: Metadata
let metadata: Metadata?
}

let type: ReceivableEventType
Expand Down
4 changes: 2 additions & 2 deletions Sources/MembraneRTC/RTCEngineCommunication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal class RTCEngineCommunication {
case .EndpointUpdated:
let endpointUpdated = event as! EndpointUpdatedEvent
engineListener.onEndpointUpdated(
endpointId: endpointUpdated.data.endpointId, metadata: endpointUpdated.data.metadata)
endpointId: endpointUpdated.data.endpointId, metadata: endpointUpdated.data.metadata ?? AnyJson())
case .OfferData:
let offerData = event as! OfferDataEvent
engineListener.onOfferData(
Expand All @@ -89,7 +89,7 @@ internal class RTCEngineCommunication {
let tracksUpdated = event as! TracksUpdatedEvent
engineListener.onTrackUpdated(
endpointId: tracksUpdated.data.endpointId, trackId: tracksUpdated.data.trackId,
metadata: tracksUpdated.data.metadata)
metadata: tracksUpdated.data.metadata ?? AnyJson())
case .SdpAnswer:
let sdpAnswer = event as! SdpAnswerEvent
engineListener.onSdpAnswer(
Expand Down

0 comments on commit 31e481a

Please sign in to comment.