Recover after a streaming error.
This commit is contained in:
parent
2e2aed5002
commit
dd9e317257
2 changed files with 10 additions and 2 deletions
|
@ -62,12 +62,17 @@ Document::Document(
|
||||||
, _radial(
|
, _radial(
|
||||||
[=] { waitingCallback(); },
|
[=] { waitingCallback(); },
|
||||||
st::defaultInfiniteRadialAnimation) {
|
st::defaultInfiniteRadialAnimation) {
|
||||||
_player.updates(
|
resubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Document::resubscribe() {
|
||||||
|
_subscription = _player.updates(
|
||||||
) | rpl::start_with_next_error([=](Update &&update) {
|
) | rpl::start_with_next_error([=](Update &&update) {
|
||||||
handleUpdate(std::move(update));
|
handleUpdate(std::move(update));
|
||||||
}, [=](Streaming::Error &&error) {
|
}, [=](Streaming::Error &&error) {
|
||||||
handleError(std::move(error));
|
handleError(std::move(error));
|
||||||
}, _player.lifetime());
|
resubscribe();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Player &Document::player() {
|
Player &Document::player() {
|
||||||
|
|
|
@ -62,12 +62,15 @@ private:
|
||||||
void waitingChange(bool waiting);
|
void waitingChange(bool waiting);
|
||||||
|
|
||||||
void validateGoodThumbnail();
|
void validateGoodThumbnail();
|
||||||
|
void resubscribe();
|
||||||
|
|
||||||
DocumentData *_document = nullptr;
|
DocumentData *_document = nullptr;
|
||||||
PhotoData *_photo = nullptr;
|
PhotoData *_photo = nullptr;
|
||||||
Player _player;
|
Player _player;
|
||||||
Information _info;
|
Information _info;
|
||||||
|
|
||||||
|
rpl::lifetime _subscription;
|
||||||
|
|
||||||
bool _waiting = false;
|
bool _waiting = false;
|
||||||
mutable Ui::InfiniteRadialAnimation _radial;
|
mutable Ui::InfiniteRadialAnimation _radial;
|
||||||
Ui::Animations::Simple _fading;
|
Ui::Animations::Simple _fading;
|
||||||
|
|
Loading…
Reference in a new issue