I have an Observable, source, that may emit items at unpredictable times. I'm trying to use it to build another Observable that reliably emits its values every 500ms.
Let's say that source emits values at these times:
- 100ms - first item
- 980ms - second item
- 1020ms - third item
- 1300ms - fourth item, etc.
I'd like to "smooth" this stream, so that I get outputs like:
- 500ms - first item
- 1000ms - second item
- 1500ms - third item
- 2000ms - fourth item
A naive approach might be to just add a delay in between emissions of source items. But, that won't create evenly spaced intervals, like I want.
I've tried various combinations of .timer(), .interval(), and .flatMap(), but nothing promising, yet.
