From 2b281c43575b7cdb1943bf2150509954388b7bc4 Mon Sep 17 00:00:00 2001 From: Aris Poloway Date: Thu, 5 Apr 2018 23:47:20 -0400 Subject: [PATCH] Don't save stream and store recovery position from StreamInfo --- .../newpipe/playlist/PlayQueueItem.java | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/playlist/PlayQueueItem.java b/app/src/main/java/org/schabi/newpipe/playlist/PlayQueueItem.java index 4b7f96ce9..2d543fb4e 100644 --- a/app/src/main/java/org/schabi/newpipe/playlist/PlayQueueItem.java +++ b/app/src/main/java/org/schabi/newpipe/playlist/PlayQueueItem.java @@ -28,14 +28,12 @@ public class PlayQueueItem implements Serializable { private long recoveryPosition; private Throwable error; - private transient Single stream; - private StreamInfo info; - PlayQueueItem(@NonNull final StreamInfo info) { this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(), info.getThumbnailUrl(), info.getUploaderName(), info.getStreamType()); - this.stream = Single.just(info); - this.info = info; + + if (info.getStartPosition() > 0) + setRecoveryPosition(info.getStartPosition() * 1000); } PlayQueueItem(@NonNull final StreamInfoItem item) { @@ -102,18 +100,7 @@ public class PlayQueueItem implements Serializable { @NonNull public Single getStream() { - return stream == null ? stream = getInfo() : stream; - } - - @NonNull - private Single getInfo() { - Single single; - if (this.info != null){ - single = Single.just(info); - } else { - single = ExtractorHelper.getStreamInfo(this.serviceId, this.url, false); - } - return single + return ExtractorHelper.getStreamInfo(this.serviceId, this.url, false) .subscribeOn(Schedulers.io()) .doOnError(throwable -> error = throwable); }