File tree Expand file tree Collapse file tree
common/src/main/java/com/liskovsoft/smartyoutubetv2/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ public final class Video {
8686 public long startTimeMs ;
8787 public long pendingPosMs ;
8888 public boolean fromQueue ;
89+ public boolean fromCrashRestorer ;
8990 public boolean isPending ;
9091 public boolean finishOnEnded ;
9192 public boolean incognito ;
Original file line number Diff line number Diff line change @@ -334,6 +334,11 @@ private void resetPositionIfNeeded(Video item) {
334334 return ;
335335 }
336336
337+ if (item .fromCrashRestorer ) {
338+ item .fromCrashRestorer = false ;
339+ return ;
340+ }
341+
337342 State state = getStateService ().getByVideoId (item .videoId );
338343
339344 // Reset position of music videos
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public void restorePlayback() {
6161 VideoStateService stateService = VideoStateService .instance (mContext );
6262 boolean isVideoStateSynced = mSelectedVideo == null || stateService .getByVideoId (mSelectedVideo .videoId ) != null ;
6363 State lastState = stateService .getLastState ();
64- PlaybackPresenter . instance ( mContext ). openVideo (lastState != null && isVideoStateSynced ? lastState .video : mSelectedVideo );
64+ openVideo (lastState != null && isVideoStateSynced ? lastState .video : mSelectedVideo );
6565 }
6666
6767 // Restore can be called only once
@@ -76,4 +76,12 @@ public void restoreHeader(OnRestoreHeader onRestoreHeader) {
7676 // Restore can be called only once
7777 mSelectedHeaderIndex = -1 ;
7878 }
79+
80+ private void openVideo (Video video ) {
81+ if (video != null ) {
82+ video .fromCrashRestorer = true ; // tell the state controller to not reset the position
83+ }
84+
85+ PlaybackPresenter .instance (mContext ).openVideo (video );
86+ }
7987}
You can’t perform that action at this time.
0 commit comments