mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
PreviewMediaFragment: fix restoring seek position when returning from fullscreen stream
The stream asynctask was just ignoring the saved time Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
11e472b18b
commit
329dea57a3
1 changed files with 14 additions and 15 deletions
|
@ -473,15 +473,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|||
// load the video file in the video player
|
||||
// when done, VideoHelper#onPrepared() will be called
|
||||
if (getFile().isDown()) {
|
||||
binding.progress.setVisibility(View.GONE);
|
||||
|
||||
exoPlayer.addMediaItem(MediaItem.fromUri(getFile().getStorageUri()));
|
||||
exoPlayer.prepare();
|
||||
|
||||
if (savedPlaybackPosition >= 0) {
|
||||
exoPlayer.seekTo(savedPlaybackPosition);
|
||||
}
|
||||
exoPlayer.play();
|
||||
playVideoUri(getFile().getStorageUri());
|
||||
} else {
|
||||
try {
|
||||
new LoadStreamUrl(this, user, clientFactory).execute(getFile().getLocalId());
|
||||
|
@ -491,6 +483,18 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|||
}
|
||||
}
|
||||
|
||||
private void playVideoUri(final Uri uri) {
|
||||
binding.progress.setVisibility(View.GONE);
|
||||
|
||||
exoPlayer.addMediaItem(MediaItem.fromUri(uri));
|
||||
exoPlayer.prepare();
|
||||
|
||||
if (savedPlaybackPosition >= 0) {
|
||||
exoPlayer.seekTo(savedPlaybackPosition);
|
||||
}
|
||||
exoPlayer.play();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFullScreenModeChanged(boolean isFullScreen) {
|
||||
Log_OC.e(TAG, "Fullscreen: " + isFullScreen);
|
||||
|
@ -535,12 +539,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|||
if (previewMediaFragment != null && previewMediaFragment.binding != null && context != null) {
|
||||
if (uri != null) {
|
||||
previewMediaFragment.videoUri = uri;
|
||||
|
||||
previewMediaFragment.binding.progress.setVisibility(View.GONE);
|
||||
|
||||
previewMediaFragment.exoPlayer.addMediaItem(MediaItem.fromUri(uri));
|
||||
previewMediaFragment.exoPlayer.prepare();
|
||||
previewMediaFragment.exoPlayer.play();
|
||||
previewMediaFragment.playVideoUri(uri);
|
||||
} else {
|
||||
previewMediaFragment.emptyListView.setVisibility(View.VISIBLE);
|
||||
previewMediaFragment.setVideoErrorMessage(
|
||||
|
|
Loading…
Reference in a new issue