Don't save stream and store recovery position from StreamInfo
This commit is contained in:
parent
b3c49ac86b
commit
2b281c4357
|
@ -28,14 +28,12 @@ public class PlayQueueItem implements Serializable {
|
||||||
private long recoveryPosition;
|
private long recoveryPosition;
|
||||||
private Throwable error;
|
private Throwable error;
|
||||||
|
|
||||||
private transient Single<StreamInfo> stream;
|
|
||||||
private StreamInfo info;
|
|
||||||
|
|
||||||
PlayQueueItem(@NonNull final StreamInfo info) {
|
PlayQueueItem(@NonNull final StreamInfo info) {
|
||||||
this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(),
|
this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(),
|
||||||
info.getThumbnailUrl(), info.getUploaderName(), info.getStreamType());
|
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) {
|
PlayQueueItem(@NonNull final StreamInfoItem item) {
|
||||||
|
@ -102,18 +100,7 @@ public class PlayQueueItem implements Serializable {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public Single<StreamInfo> getStream() {
|
public Single<StreamInfo> getStream() {
|
||||||
return stream == null ? stream = getInfo() : stream;
|
return ExtractorHelper.getStreamInfo(this.serviceId, this.url, false)
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private Single<StreamInfo> getInfo() {
|
|
||||||
Single<StreamInfo> single;
|
|
||||||
if (this.info != null){
|
|
||||||
single = Single.just(info);
|
|
||||||
} else {
|
|
||||||
single = ExtractorHelper.getStreamInfo(this.serviceId, this.url, false);
|
|
||||||
}
|
|
||||||
return single
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.doOnError(throwable -> error = throwable);
|
.doOnError(throwable -> error = throwable);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue