Save playback state even if stream is finished and add isFinished()

This commit is contained in:
Stypox 2021-03-26 11:27:25 +01:00
parent e846f69e38
commit 360f5ac6f7
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
4 changed files with 38 additions and 13 deletions

View file

@ -215,7 +215,7 @@ public class HistoryRecordManager {
.flatMapPublisher(streamStateTable::getState)
.firstElement()
.flatMap(list -> list.isEmpty() ? Maybe.empty() : Maybe.just(list.get(0)))
.filter(state -> state.isValid((int) queueItem.getDuration()))
.filter(StreamStateEntity::isValid)
.subscribeOn(Schedulers.io());
}
@ -224,7 +224,7 @@ public class HistoryRecordManager {
.flatMapPublisher(streamStateTable::getState)
.firstElement()
.flatMap(list -> list.isEmpty() ? Maybe.empty() : Maybe.just(list.get(0)))
.filter(state -> state.isValid((int) info.getDuration()))
.filter(StreamStateEntity::isValid)
.subscribeOn(Schedulers.io());
}
@ -232,7 +232,7 @@ public class HistoryRecordManager {
return Completable.fromAction(() -> database.runInTransaction(() -> {
final long streamId = streamTable.upsert(new StreamEntity(info));
final StreamStateEntity state = new StreamStateEntity(streamId, progressTime);
if (state.isValid((int) info.getDuration())) {
if (state.isValid()) {
streamStateTable.upsert(state);
} else {
streamStateTable.deleteState(streamId);