From f71aeb2cf1db521e7dc0805b4319ed22ab16ba05 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Fri, 1 Oct 2021 21:07:21 +0200 Subject: [PATCH] fix: android update --- app/build.gradle | 4 +-- app/src/main/AndroidManifest.xml | 6 ++-- .../peertube/service/VideoPlayerService.java | 29 +++++-------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 88f0550..4b03035 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -94,7 +94,7 @@ android { def room_version = "2.3.0" def lifecycleVersion = '2.3.1' -def exoplayer = '2.15.1' +def exoplayer = '2.12.3' def fragment_version = "1.3.6" dependencies { @@ -152,13 +152,11 @@ dependencies { kapt "androidx.room:room-compiler:$room_version" // Lifecycle components - implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion" kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" - implementation 'androidx.preference:preference-ktx:1.1.1' // testing diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a872992..a18f528 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,7 +25,8 @@ + android:theme="@style/AppTheme.NoActionBar" + android:exported="true"> @@ -68,7 +69,8 @@ - + diff --git a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java index a118a5f..9dd13cf 100644 --- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java +++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java @@ -16,36 +16,33 @@ */ package net.schueller.peertube.service; +import static android.media.session.PlaybackState.ACTION_PAUSE; +import static android.media.session.PlaybackState.ACTION_PLAY; +import static com.google.android.exoplayer2.ui.PlayerNotificationManager.ACTION_STOP; +import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID; +import static net.schueller.peertube.network.UnsafeOkHttpClient.getUnsafeOkHttpClientBuilder; + import android.app.Notification; import android.app.PendingIntent; -import android.app.PictureInPictureParams; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.AudioManager; import android.net.Uri; import android.os.Binder; -import android.os.Build; -import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; -import android.webkit.URLUtil; -import androidx.annotation.Nullable; - import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.session.MediaSessionCompat; import android.util.Log; -import android.util.Rational; +import android.webkit.URLUtil; import android.widget.Toast; - +import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; -import com.google.android.exoplayer2.ExoPlayer; -import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; @@ -53,18 +50,14 @@ import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector; import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator; -import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource; import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory; -import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.hls.HlsMediaSource; import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.ui.PlayerNotificationManager; import com.google.android.exoplayer2.upstream.DataSource; -import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.util.Util; - import net.schueller.peertube.R; import net.schueller.peertube.activity.VideoPlayActivity; import net.schueller.peertube.helper.APIUrlHelper; @@ -72,12 +65,6 @@ import net.schueller.peertube.helper.MetaDataHelper; import net.schueller.peertube.model.Video; import okhttp3.OkHttpClient; -import static android.media.session.PlaybackState.ACTION_PAUSE; -import static android.media.session.PlaybackState.ACTION_PLAY; -import static com.google.android.exoplayer2.ui.PlayerNotificationManager.ACTION_STOP; -import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID; -import static net.schueller.peertube.network.UnsafeOkHttpClient.getUnsafeOkHttpClientBuilder; - public class VideoPlayerService extends Service { private static final String TAG = "VideoPlayerService";