Recover after a streaming error.

This commit is contained in:
John Preston 2022-03-30 14:08:36 +04:00
parent 2e2aed5002
commit dd9e317257
2 changed files with 10 additions and 2 deletions

View file

@ -62,12 +62,17 @@ Document::Document(
, _radial(
[=] { waitingCallback(); },
st::defaultInfiniteRadialAnimation) {
_player.updates(
resubscribe();
}
void Document::resubscribe() {
_subscription = _player.updates(
) | rpl::start_with_next_error([=](Update &&update) {
handleUpdate(std::move(update));
}, [=](Streaming::Error &&error) {
handleError(std::move(error));
}, _player.lifetime());
resubscribe();
});
}
Player &Document::player() {

View file

@ -62,12 +62,15 @@ private:
void waitingChange(bool waiting);
void validateGoodThumbnail();
void resubscribe();
DocumentData *_document = nullptr;
PhotoData *_photo = nullptr;
Player _player;
Information _info;
rpl::lifetime _subscription;
bool _waiting = false;
mutable Ui::InfiniteRadialAnimation _radial;
Ui::Animations::Simple _fading;