mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-01-05 21:40:47 -06:00
preload next video
This commit is contained in:
@@ -225,6 +225,11 @@ public class VideoLoaderController extends BasePlayerController {
|
||||
applyPlaybackMode(getPlaybackMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTickle() {
|
||||
preloadNextVideoIfNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuggestionItemClicked(Video item) {
|
||||
openVideoInt(item);
|
||||
@@ -936,4 +941,14 @@ public class VideoLoaderController extends BasePlayerController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void preloadNextVideoIfNeeded() {
|
||||
if (isEmbedPlayer() || getPlayer() == null || getVideo() == null || getVideo().isLive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPlayer().getDurationMs() - getPlayer().getPositionMs() < 50_000) {
|
||||
MediaServiceManager.instance().loadFormatInfo(mSuggestionsController.getNext(), formatInfo -> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user