diff --git a/owncloudApp/build.gradle b/owncloudApp/build.gradle index 6878a2bcdc03..df79141426b2 100644 --- a/owncloudApp/build.gradle +++ b/owncloudApp/build.gradle @@ -16,7 +16,7 @@ dependencies { implementation "androidx.annotation:annotation:1.1.0" implementation 'com.google.android.material:material:1.3.0' implementation 'com.jakewharton:disklrucache:2.0.2' - implementation 'com.google.android.exoplayer:exoplayer:r2.2.0' + implementation 'com.google.android.exoplayer:exoplayer:2.13.1' implementation 'com.andrognito.patternlockview:patternlockview:1.0.0' implementation "androidx.appcompat:appcompat:$appCompat" implementation 'com.getbase:floatingactionbutton:1.10.1' diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/CustomHttpDataSourceFactory.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/CustomHttpDataSourceFactory.java index 9ca2f2e65c43..8307ca7bfc79 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/CustomHttpDataSourceFactory.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/CustomHttpDataSourceFactory.java @@ -4,7 +4,8 @@ * ownCloud Android client application * * @author David González Verdugo - * Copyright (C) 2017 ownCloud GmbH. + * @author Christian Schabesberger + * Copyright (C) 2021 ownCloud GmbH. *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
@@ -21,6 +22,7 @@
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
+import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.upstream.HttpDataSource.BaseFactory;
import com.google.android.exoplayer2.upstream.HttpDataSource.Factory;
import com.google.android.exoplayer2.upstream.TransferListener;
@@ -33,7 +35,7 @@
public final class CustomHttpDataSourceFactory extends BaseFactory {
private final String userAgent;
- private final TransferListener super DataSource> listener;
+ private final TransferListener listener;
private final int connectTimeoutMillis;
private final int readTimeoutMillis;
private final boolean allowCrossProtocolRedirects;
@@ -52,7 +54,7 @@ public final class CustomHttpDataSourceFactory extends BaseFactory {
* Map
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
@@ -35,15 +35,12 @@
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
-import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
-import com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection;
+import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
-import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
-import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
-import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
+import com.google.android.exoplayer2.ui.PlayerView;
import com.owncloud.android.R;
import com.owncloud.android.ui.activity.FileActivity;
import timber.log.Timber;
@@ -60,10 +57,8 @@ public class PreviewVideoActivity extends FileActivity implements ExoPlayer.Even
/** Key to receive the position of the playback where the video should be put at start */
public static final String EXTRA_START_POSITION = "START_POSITION";
- private final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
-
private Handler mainHandler;
- private SimpleExoPlayerView simpleExoPlayerView;
+ private PlayerView exoPlayerView;
private SimpleExoPlayer player;
private DefaultTrackSelector trackSelector;
@@ -84,7 +79,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.video_preview);
- simpleExoPlayerView = findViewById(R.id.video_player);
+ exoPlayerView = findViewById(R.id.video_player);
// Hide sync bar
ProgressBar syncProgressBar = findViewById(R.id.syncProgressBar);
@@ -154,12 +149,12 @@ private void preparePlayer() {
// Create a default TrackSelector
mainHandler = new Handler();
- TrackSelection.Factory videoTrackSelectionFactory =
- new AdaptiveVideoTrackSelection.Factory(BANDWIDTH_METER);
+ AdaptiveTrackSelection.Factory videoTrackSelectionFactory =
+ new AdaptiveTrackSelection.Factory();
trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, new DefaultLoadControl());
player.addListener(this);
- simpleExoPlayerView.setPlayer(player);
+ exoPlayerView.setPlayer(player);
player.seekTo(mPlaybackPosition);
player.setPlayWhenReady(mAutoplay);
@@ -232,16 +227,6 @@ public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
// Do nothing.
}
- @Override
- public void onPositionDiscontinuity() {
- // Do nothing
- }
-
- @Override
- public void onTimelineChanged(Timeline timeline, Object manifest) {
- // Do nothing
- }
-
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
// Do nothing
diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java
index 326fcd830682..85ba207dccf0 100644
--- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java
+++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java
@@ -5,7 +5,7 @@
* @author David González Verdugo
* @author Christian Schabesberger
* @author Shashvat Kedia
- * Copyright (C) 2020 ownCloud GmbH.
+ * Copyright (C) 2021 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
@@ -42,14 +42,12 @@
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
-import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
-import com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection;
+import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
-import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
-import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
+import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -91,7 +89,7 @@ public class PreviewVideoFragment extends FileFragment implements View.OnClickLi
private TransferProgressController mProgressController;
private Handler mainHandler;
- private SimpleExoPlayerView simpleExoPlayerView;
+ private PlayerView exoPlayerView;
private SimpleExoPlayer player;
private DefaultTrackSelector trackSelector;
@@ -169,7 +167,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mProgressBar = view.findViewById(R.id.syncProgressBar);
mProgressBar.setVisibility(View.GONE);
- simpleExoPlayerView = view.findViewById(R.id.video_player);
+ exoPlayerView = view.findViewById(R.id.video_player);
fullScreenButton = view.findViewById(R.id.fullscreen_button);
@@ -378,7 +376,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
case R.id.action_remove_file: {
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(getFile());
- dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
+ dialog.show(getParentFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
return true;
}
case R.id.action_see_details: {
@@ -423,8 +421,8 @@ private void preparePlayer() {
// Create a default TrackSelector
mainHandler = new Handler();
- TrackSelection.Factory videoTrackSelectionFactory =
- new AdaptiveVideoTrackSelection.Factory(BANDWIDTH_METER);
+ AdaptiveTrackSelection.Factory videoTrackSelectionFactory =
+ new AdaptiveTrackSelection.Factory();
trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
// Video streaming is only supported at Jelly Bean or higher Android versions (>= API 16)
@@ -436,7 +434,7 @@ private void preparePlayer() {
player.addListener(this);
// Bind the player to the view.
- simpleExoPlayerView.setPlayer(player);
+ exoPlayerView.setPlayer(player);
// Prepare video player asynchronously
new PrepareVideoPlayerAsyncTask(getActivity(), this,
@@ -528,16 +526,6 @@ public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
}
}
- @Override
- public void onPositionDiscontinuity() {
- // Do nothing
- }
-
- @Override
- public void onTimelineChanged(Timeline timeline, Object manifest) {
- // Do nothing
- }
-
// File extra methods
@Override
public void onFileMetadataChanged(OCFile updatedFile) {
diff --git a/owncloudApp/src/main/res/layout/custom_playback_control.xml b/owncloudApp/src/main/res/layout/custom_playback_control.xml
index 58278f7f0ef1..3c9f55e8e107 100644
--- a/owncloudApp/src/main/res/layout/custom_playback_control.xml
+++ b/owncloudApp/src/main/res/layout/custom_playback_control.xml
@@ -82,7 +82,7 @@
android:includeFontPadding="false"
android:textColor="#FFBEBEBE" />
-