VB: Make the view model aware of every chunk new coming

this reactive approach will help to cache and reorder them by sequence
This commit is contained in:
manuroe
2022-10-19 17:28:08 +02:00
committed by yostyle
parent c606db5d02
commit 736cde698b
3 changed files with 32 additions and 13 deletions
@@ -65,9 +65,6 @@ class VoiceBroadcastPlaybackViewModel: VoiceBroadcastPlaybackViewModelType, Voic
private func play() {
MXLog.debug("[VoiceBroadcastPlaybackViewModel] play")
// TODO: But what?
let requiredNumberOfSamples = 100// playbackView.getRequiredNumberOfSamples() ?
guard let voiceBroadcast = voiceBroadcastAggregator.voiceBroadcast else {
assert(false, "Cannot play. No voice broadcast data")
}
@@ -77,7 +74,8 @@ class VoiceBroadcastPlaybackViewModel: VoiceBroadcastPlaybackViewModelType, Voic
return
}
cacheManager.loadAttachment(attachment, numberOfSamples: requiredNumberOfSamples) { [weak self] result in
// numberOfSamples is for the equalizer view we do not support yet
cacheManager.loadAttachment(attachment, numberOfSamples: 1) { [weak self] result in
guard let self = self else {
return
@@ -137,6 +135,10 @@ extension VoiceBroadcastPlaybackViewModel: VoiceBroadcastAggregatorDelegate {
MXLog.debug("AAAA voiceBroadcastAggregatordidFailWithError")
}
func voiceBroadcastAggregator(_ aggregator: VoiceBroadcastAggregator, didReceiveChunk: VoiceBroadcastChunk) {
MXLog.debug("AAAA voiceBroadcastAggregatorDidReceiveChunk")
}
func voiceBroadcastAggregatorDidUpdateData(_ aggregator: VoiceBroadcastAggregator) {
MXLog.debug("AAAA voiceBroadcastAggregatorDidUpdateData")
}