override fun onRemoteVideoSourceAvailable()

in amazon-chime-sdk/src/main/java/com/amazonaws/services/chime/sdk/meetings/internal/video/DefaultVideoClientObserver.kt [269:284]


    override fun onRemoteVideoSourceAvailable(sourcesInternal: Array<RemoteVideoSourceInternal>?) {
        if (sourcesInternal == null) return
        val sources = sourcesInternal.map { internalSource ->
            // Find the cached source if exists (see comment above cachedRemoveVideoSources)
            for (cachedSource in cachedRemoveVideoSources) {
                if (cachedSource.attendeeId == internalSource.attendeeId) {
                    return@map cachedSource
                }
            }
            // Otherwise create a new one and add to cached set
            val newSource = RemoteVideoSource(internalSource.attendeeId)
            cachedRemoveVideoSources.add(newSource)
            newSource
        }
        forEachVideoClientStateObserver { observer -> observer.onRemoteVideoSourceAvailable(sources) }
    }