diff --git a/src/musikdroid/app/build.gradle b/src/musikdroid/app/build.gradle index 64309fd15..782c0b1d4 100644 --- a/src/musikdroid/app/build.gradle +++ b/src/musikdroid/app/build.gradle @@ -55,7 +55,7 @@ dependencies { exclude group: 'com.android.support', module: 'support-annotations' }) - implementation 'com.google.firebase:firebase-core:17.1.0' + implementation 'com.google.firebase:firebase-core:17.2.1' implementation(name:'android-taskrunner-0.5', ext:'aar') implementation(name:'exoplayer-extension-flac-release-v2', ext:'aar') @@ -63,35 +63,35 @@ dependencies { implementation 'org.slf4j:slf4j-android:1.7.21' - implementation "androidx.room:room-runtime:2.1.0" - kapt "androidx.room:room-compiler:2.1.0" + implementation "androidx.room:room-runtime:2.2.3" + kapt "androidx.room:room-compiler:2.2.3" - implementation "androidx.lifecycle:lifecycle-runtime:2.0.0" - implementation "androidx.lifecycle:lifecycle-extensions:2.0.0" - implementation "androidx.lifecycle:lifecycle-common-java8:2.0.0" + implementation "androidx.lifecycle:lifecycle-runtime:2.1.0" + implementation "androidx.lifecycle:lifecycle-extensions:2.1.0" + implementation "androidx.lifecycle:lifecycle-common-java8:2.1.0" compileOnly 'org.glassfish:javax.annotation:10.0-b28' implementation 'com.google.dagger:dagger:2.19' kapt 'com.google.dagger:dagger-compiler:2.19' implementation 'com.neovisionaries:nv-websocket-client:1.31' - implementation 'com.squareup.okhttp3:okhttp:3.12.1' - implementation 'com.github.bumptech.glide:glide:4.9.0' - implementation "com.github.bumptech.glide:okhttp3-integration:4.9.0" - kapt 'com.github.bumptech.glide:compiler:4.9.0' - implementation 'io.reactivex.rxjava2:rxjava:2.2.6' - implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' - implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0' - implementation 'com.google.android.exoplayer:exoplayer:2.10.4' - implementation 'com.google.android.exoplayer:extension-okhttp:2.10.4' + implementation 'com.squareup.okhttp3:okhttp:3.12.5' + implementation 'com.github.bumptech.glide:glide:4.10.0' + implementation "com.github.bumptech.glide:okhttp3-integration:4.10.0" + kapt 'com.github.bumptech.glide:compiler:4.10.0' + implementation 'io.reactivex.rxjava2:rxjava:2.2.16' + implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' + implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0' + implementation 'com.google.android.exoplayer:exoplayer:2.11.1' + implementation 'com.google.android.exoplayer:extension-okhttp:2.11.1' implementation 'com.simplecityapps:recyclerview-fastscroll:2.0.0' - implementation 'com.github.wooplr:Spotlight:1.2.3' + implementation 'com.github.wooplr:Spotlight:1.3' implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1' - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.recyclerview:recyclerview:1.0.0' - implementation 'com.google.android.material:material:1.1.0-alpha09' - implementation 'androidx.media:media:1.0.1' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'com.google.android.material:material:1.2.0-alpha03' + implementation 'androidx.media:media:1.1.0' implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/player/GaplessExoPlayerWrapper.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/player/GaplessExoPlayerWrapper.kt index 9d1b6ec93..47d511c54 100644 --- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/player/GaplessExoPlayerWrapper.kt +++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/player/GaplessExoPlayerWrapper.kt @@ -5,17 +5,9 @@ import android.content.SharedPreferences import android.net.Uri import com.danikula.videocache.CacheListener import com.google.android.exoplayer2.* -import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory -import com.google.android.exoplayer2.source.ConcatenatingMediaSource -import com.google.android.exoplayer2.source.ExtractorMediaSource -import com.google.android.exoplayer2.source.MediaSource -import com.google.android.exoplayer2.source.TrackGroupArray -import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection -import com.google.android.exoplayer2.trackselection.DefaultTrackSelector +import com.google.android.exoplayer2.source.* import com.google.android.exoplayer2.trackselection.TrackSelectionArray -import com.google.android.exoplayer2.upstream.DataSource -import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory -import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory +import com.google.android.exoplayer2.upstream.* import com.google.android.exoplayer2.util.Util import io.casey.musikcube.remote.Application import io.casey.musikcube.remote.service.playback.PlayerWrapper @@ -23,10 +15,11 @@ import io.casey.musikcube.remote.service.websocket.model.ITrack import io.casey.musikcube.remote.ui.settings.constants.Prefs import io.casey.musikcube.remote.util.Preconditions import java.io.File +import kotlin.math.max +import kotlin.math.min class GaplessExoPlayerWrapper : PlayerWrapper() { private var sourceFactory: DataSource.Factory - private val extractorsFactory = DefaultExtractorsFactory() private var source: MediaSource? = null private var metadata: ITrack? = null private var prefetch: Boolean = false @@ -61,9 +54,8 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { addCacheListener() - this.source = ExtractorMediaSource + this.source = ProgressiveMediaSource .Factory(sourceFactory) - .setExtractorsFactory(extractorsFactory) .createMediaSource(Uri.parse(proxyUri)) addPlayer(this, this.source!!) @@ -83,9 +75,8 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { this.proxyUri = streamProxy.getProxyUrl(uri) this.prefetch = true - this.source = ExtractorMediaSource + this.source = ProgressiveMediaSource .Factory(sourceFactory) - .setExtractorsFactory(extractorsFactory) .createMediaSource(Uri.parse(proxyUri)) addCacheListener() @@ -117,8 +108,12 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { } State.Error -> { gaplessPlayer?.playWhenReady = lastPosition == -1L - gaplessPlayer?.prepare(source) - state = State.Preparing + source?.let { + gaplessPlayer?.prepare(it) + state = State.Preparing + } ?: run { + state = State.Error + } } else -> { } } @@ -146,10 +141,10 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { to here, we want to wait until we are able to pickup where we left off. */ if (!isInitialSeek && transcoding && percentAvailable != 100) { /* give ourselves 2% wiggle room! */ - val percent = Math.max(0, percentAvailable - 2).toFloat() / 100.0f + val percent = max(0, percentAvailable - 2).toFloat() / 100.0f val totalMs = gaplessPlayer?.duration val available = (totalMs!!.toFloat() * percent).toLong() - offset = Math.min(millis.toLong(), available) + offset = min(millis.toLong(), available) } initialOffsetMs = 0 @@ -309,7 +304,6 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { const val TIMEOUT = 1000 * 60 * 2 /* 2 minutes; makes seeking an incomplete transcode work most of the time */ private val prefs: SharedPreferences by lazy { Application.instance.getSharedPreferences(Prefs.NAME, Context.MODE_PRIVATE) } private val context: Context by lazy { Application.instance } - private val trackSelector = DefaultTrackSelector(AdaptiveTrackSelection.Factory()) private var all = mutableListOf() private lateinit var dcms: ConcatenatingMediaSource private var gaplessPlayer: SimpleExoPlayer? = null @@ -333,7 +327,9 @@ class GaplessExoPlayerWrapper : PlayerWrapper() { all.clear() gaplessPlayer?.stop() gaplessPlayer?.release() - gaplessPlayer = ExoPlayerFactory.newSimpleInstance(context, trackSelector) + gaplessPlayer = SimpleExoPlayer.Builder(context) + .setBandwidthMeter(DefaultBandwidthMeter.Builder(context).build()) + .build() dcms = ConcatenatingMediaSource() } diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt index d7fb8bbc8..9d0ea2d9d 100644 --- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt +++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt @@ -79,7 +79,7 @@ class SystemService : Service() { channel.setSound(null, null) channel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC - val nm = getSystemService(Service.NOTIFICATION_SERVICE) as NotificationManager + val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager nm.deleteNotificationChannel(NOTIFICATION_CHANNEL) nm.createNotificationChannel(channel) } diff --git a/src/musikdroid/build.gradle b/src/musikdroid/build.gradle index 682b4a14b..f4046b30d 100644 --- a/src/musikdroid/build.gradle +++ b/src/musikdroid/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.2.0' }