in AmazonChimeSDKDemo/AmazonChimeSDKDemo/VideoModel.swift [376:402]
func updateAllRemoteVideosInCurrentPageExceptUserPausedVideos() {
var updatedSources:[RemoteVideoSource: VideoSubscriptionConfiguration] = [:]
let attendeeKeyMap = remoteVideoSourceConfigurations.keys.reduce(into: [String: RemoteVideoSource]()) {
$0[$1.attendeeId] = $1
}
let attendeeIds = Set(remoteVideoSourceConfigurations.keys.map { $0.attendeeId })
for remoteVideoTileState in remoteVideoStatesInCurrentPage{
let attendeeId = String(remoteVideoTileState.1.attendeeId)
if attendeeIds.contains(attendeeId), let key = attendeeKeyMap[attendeeId]{
updatedSources[key] = remoteVideoSourceConfigurations[key]
}
}
var videoCount:Int = remoteVideoCountInCurrentPage
if videoCount < remoteVideoTileCountPerPage {
for (source, _) in pendingRemoteVideoSourceConfigurations {
updatedSources[source] = pendingRemoteVideoSourceConfigurations[source]
videoCount += 1
if videoCount == remoteVideoTileCountPerPage {
break
}
}
}
addVideoSourcesToBeSubscribed(toBeAddedOrUpdated: updatedSources)
}