in app/src/main/java/com/amazon/ivs/broadcast/ui/fragments/autoconfiguration/AutoConfigurationViewModel.kt [35:68]
fun startTest(
endpointUrl: String?,
streamKey: String?,
context: Context,
) = launchMain {
startTimer()
BroadcastSession(context, null, BroadcastConfiguration(), emptyArray()).apply {
testSession = this
recommendedVideoSettings(
endpointUrl,
streamKey
) { result ->
launchMain {
if (!shouldTestContinue) stopTest()
result.recommendations.firstOrNull()?.run {
val recommendation = Recommendation(
size.x,
size.y,
targetFramerate,
minBitrate,
initialBitrate,
maxBitrate
)
onRecommendationReceived.postConsumable(recommendation)
Timber.d("Result: $recommendation")
}
testProgress.postConsumable((result.progress * 100).toInt())
Timber.d("Progress: ${(result.progress * 100).toInt()} ${result.exception}")
testStatus.postConsumable(result.status)
}
}
}
}