-Fixed failed media source not treated as ready.
This commit is contained in:
parent
9ee668d7e8
commit
a878470bc5
2 changed files with 5 additions and 4 deletions
|
|
@ -4,10 +4,8 @@ import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.ExoPlayer;
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
import com.google.android.exoplayer2.source.MediaPeriod;
|
import com.google.android.exoplayer2.source.MediaPeriod;
|
||||||
import com.google.android.exoplayer2.source.MediaSource;
|
|
||||||
import com.google.android.exoplayer2.upstream.Allocator;
|
import com.google.android.exoplayer2.upstream.Allocator;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|
||||||
import org.schabi.newpipe.playlist.PlayQueueItem;
|
import org.schabi.newpipe.playlist.PlayQueueItem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
||||||
|
|
@ -219,13 +219,16 @@ public class MediaSourceManager {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
private boolean isPlayQueueReady() {
|
private boolean isPlayQueueReady() {
|
||||||
|
if (playQueue == null) return false;
|
||||||
|
|
||||||
final boolean isWindowLoaded = playQueue.size() - playQueue.getIndex() > windowSize;
|
final boolean isWindowLoaded = playQueue.size() - playQueue.getIndex() > windowSize;
|
||||||
return playQueue.isComplete() || isWindowLoaded;
|
return playQueue.isComplete() || isWindowLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks if the current playback media source is a placeholder, if so, then it is not ready
|
||||||
private boolean isPlaybackReady() {
|
private boolean isPlaybackReady() {
|
||||||
return sources.getSize() > 0 &&
|
return sources != null && playQueue != null && sources.getSize() > playQueue.getIndex() &&
|
||||||
sources.getMediaSource(playQueue.getIndex()) instanceof LoadedMediaSource;
|
!(sources.getMediaSource(playQueue.getIndex()) instanceof PlaceholderMediaSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryBlock() {
|
private void tryBlock() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue