func toIngestionMeetingEvent()

in AmazonChimeSDK/AmazonChimeSDK/ingestion/IngestionEventConverter.swift [20:56]


    func toIngestionMeetingEvent(event: SDKEvent,
                                 ingestionConfiguration: IngestionConfiguration) -> IngestionMeetingEvent {
        let eventAttributes = event.eventAttributes
        let clientConfig = ingestionConfiguration.clientConfiguration

        var meetingStatus: String?
        if let status = eventAttributes[EventAttributeName.meetingStatus] as? MeetingSessionStatusCode {
            meetingStatus = String(describing: status)
        }

        var videoErrorStr: String?
        if let videoError = eventAttributes[EventAttributeName.videoInputError] as? CaptureSourceError {
            videoErrorStr = String(describing: videoError)
        }

        var attributes = [String:AnyCodable]()
        attributes[EAName.timestampMs.description] = AnyCodable(eventAttributes[EAName.timestampMs])
        attributes[EAName.maxVideoTileCount.description] = AnyCodable(eventAttributes[EAName.maxVideoTileCount])
        attributes[EAName.meetingStartDurationMs.description] = AnyCodable(
            eventAttributes[EAName.meetingStartDurationMs]
        )
        attributes[EAName.meetingDurationMs.description] = AnyCodable(eventAttributes[EAName.meetingDurationMs])
        attributes[EAName.meetingErrorMessage.description] = AnyCodable(eventAttributes[EAName.meetingErrorMessage])
        attributes[EAName.meetingStatus.description] = AnyCodable(meetingStatus)
        attributes[EAName.poorConnectionCount.description] = AnyCodable(eventAttributes[EAName.poorConnectionCount])
        attributes[EAName.retryCount.description] = AnyCodable(eventAttributes[EAName.retryCount])
        attributes[EAName.videoInputError.description] = AnyCodable(videoErrorStr)
        
        clientConfig.metadataAttributes.forEach({ (key: String, value: Any) in
            attributes[key] = AnyCodable(value)
        })
        
        // Some meta data like meetingId is needed
        // Since these meta data changes from meeting to meeting
        return IngestionMeetingEvent(name: String(describing: event.name),
                                     eventAttributes: attributes)
    }