Skip to content

Commit 8ec9865

Browse files
committed
player error fixer: don't show ui on reload/restart
1 parent e868f5a commit 8ec9865

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoLoaderController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ private void processFormatInfo(MediaItemFormatInfo formatInfo) {
381381
bgImageUrl = getVideo().getBackgroundUrl();
382382

383383
// 18+ video or the video is hidden/removed
384+
player.showOverlay(true);
384385
scheduleNextVideoTimer(5_000);
385386

386387
//if (formatInfo.isUnknownError()) { // the bot error or the video not available
@@ -414,6 +415,7 @@ private void processFormatInfo(MediaItemFormatInfo formatInfo) {
414415
player.showProgressBar(false);
415416
mSuggestionsController.loadSuggestions(getVideo());
416417
bgImageUrl = getVideo().getBackgroundUrl();
418+
player.showOverlay(true);
417419
scheduleReloadVideoTimer(30 * 1_000);
418420
}
419421

@@ -427,7 +429,6 @@ private void scheduleReloadVideoTimer(int delayMs) {
427429

428430
if (getPlayer().isEngineInitialized()) {
429431
Log.d(TAG, "Reloading the video...");
430-
getPlayer().showOverlay(true);
431432
Utils.postDelayed(mReloadVideo, delayMs);
432433
}
433434
}
@@ -439,23 +440,20 @@ private void scheduleNextVideoTimer(int delayMs) {
439440

440441
if (getPlayer().isEngineInitialized()) {
441442
Log.d(TAG, "Starting the next video...");
442-
getPlayer().showOverlay(true);
443443
Utils.postDelayed(mLoadNext, delayMs);
444444
}
445445
}
446446

447447
private void scheduleRebootAppTimer(int delayMs) {
448448
if (getPlayer() != null) {
449449
Log.d(TAG, "Rebooting the app...");
450-
getPlayer().showOverlay(true);
451450
Utils.postDelayed(mRebootApp, delayMs);
452451
}
453452
}
454453

455454
private void scheduleRestartEngineTimer(int delayMs) {
456455
if (getPlayer() != null) {
457456
Log.d(TAG, "Restarting the engine...");
458-
getPlayer().showOverlay(true);
459457
Utils.postDelayed(mRestartEngine, delayMs);
460458
}
461459
}
@@ -489,10 +487,12 @@ private void disposeActions() {
489487
}
490488

491489
private void runFormatErrorAction(Throwable error) {
490+
if (getPlayer() == null) {
491+
return;
492+
}
493+
492494
if (isEmbedPlayer()) {
493-
if (getPlayer() != null) {
494-
getPlayer().finish();
495-
}
495+
getPlayer().finish();
496496
return;
497497
}
498498

smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/common/LeanbackActivity.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.liskovsoft.smartyoutubetv2.common.misc.MotherActivity;
1212
import com.liskovsoft.smartyoutubetv2.common.misc.PlayerKeyTranslator;
1313
import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData;
14-
import com.liskovsoft.smartyoutubetv2.common.prefs.RemoteControlData;
1514
import com.liskovsoft.smartyoutubetv2.common.utils.Utils;
1615
import com.liskovsoft.smartyoutubetv2.tv.ui.common.keyhandler.DoubleBackManager2;
1716
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.PlaybackActivity;
@@ -134,10 +133,8 @@ public void finishReally() {
134133
}
135134

136135
private void finishTheApp() {
137-
Utils.properlyFinishTheApp(this);
136+
getViewManager().addOnFinish(sOnFinish);
138137

139-
if (!RemoteControlData.instance(this).isConnectedBefore()) {
140-
getViewManager().addOnFinish(sOnFinish);
141-
}
138+
Utils.properlyFinishTheApp(this);
142139
}
143140
}

0 commit comments

Comments
 (0)