func getRemoteVideoSubscriptionsFromRemoteVideoTileStates()

in AmazonChimeSDKDemo/AmazonChimeSDKDemo/VideoModel.swift [427:440]


    func getRemoteVideoSubscriptionsFromRemoteVideoTileStates(remoteVideoTileStates: [(Int, VideoTileState)]) -> [RemoteVideoSource] {
        var remoteVideoSources: [RemoteVideoSource] = []
        let attendeeKeyMap = remoteVideoSourceConfigurations.keys.reduce(into: [String: RemoteVideoSource]()) {
            $0[$1.attendeeId] = $1
        }
        let attendeeIds = Set(remoteVideoSourceConfigurations.keys.map { $0.attendeeId })
        for remoteVideoTileState in remoteVideoTileStates {
                let attendeeId = String(remoteVideoTileState.1.attendeeId)
            if attendeeIds.contains(attendeeId), let key = attendeeKeyMap[attendeeId] {
                remoteVideoSources.append(key)
            }
        }
        return remoteVideoSources
    }