Skip to content

Commit

Permalink
Clean up the player and made playing videos better
Browse files Browse the repository at this point in the history
  • Loading branch information
brahmkshatriya committed Dec 13, 2024
1 parent 2552ee0 commit ef208bb
Show file tree
Hide file tree
Showing 23 changed files with 162 additions and 797 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ dependencies {

implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
implementation("androidx.paging:paging-common-ktx:3.3.4")
implementation("androidx.paging:paging-runtime-ktx:3.3.4")
implementation("androidx.paging:paging-common-ktx:3.3.5")
implementation("androidx.paging:paging-runtime-ktx:3.3.5")
implementation("androidx.preference:preference-ktx:1.2.1")

implementation("androidx.room:room-runtime:2.6.1")
Expand Down Expand Up @@ -84,7 +84,6 @@ dependencies {
implementation("com.github.bosphere.android-fadingedgelayout:fadingedgelayout:1.0.0")
implementation("me.zhanghai.android.fastscroll:library:1.3.0")
implementation("com.flaviofaria:kenburnsview:1.0.7")
implementation("com.github.paramsen:noise:2.0.0")

testImplementation("org.jetbrains.kotlin:kotlin-reflect:1.9.24")
testImplementation("junit:junit:4.13.2")
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/dev/brahmkshatriya/echo/PlayerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import dev.brahmkshatriya.echo.playback.listeners.PlayerEventListener
import dev.brahmkshatriya.echo.playback.listeners.Radio
import dev.brahmkshatriya.echo.playback.listeners.TrackingListener
import dev.brahmkshatriya.echo.playback.loading.StreamableMediaSource
import dev.brahmkshatriya.echo.playback.render.FFTAudioProcessor
import dev.brahmkshatriya.echo.playback.render.PlayerBitmapLoader
import dev.brahmkshatriya.echo.playback.render.RenderersFactory
import dev.brahmkshatriya.echo.ui.settings.AudioFragment.AudioPreference.Companion.CLOSE_PLAYER
Expand Down Expand Up @@ -69,9 +68,6 @@ class PlayerService : MediaLibraryService() {
@Inject
lateinit var currentServers: MutableStateFlow<Map<String, Streamable.Media.Server>>

@Inject
lateinit var fftAudioProcessor: FFTAudioProcessor

private val scope = CoroutineScope(Dispatchers.Main)

@OptIn(UnstableApi::class)
Expand All @@ -93,7 +89,7 @@ class PlayerService : MediaLibraryService() {
)

ExoPlayer.Builder(this, factory)
.setRenderersFactory(RenderersFactory(this, fftAudioProcessor))
.setRenderersFactory(RenderersFactory(this))
.setHandleAudioBecomingNoisy(true)
.setWakeMode(C.WAKE_MODE_NETWORK)
.setSkipSilenceEnabled(settings.getBoolean(SKIP_SILENCE, true))
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/dev/brahmkshatriya/echo/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import dev.brahmkshatriya.echo.common.models.Streamable
import dev.brahmkshatriya.echo.db.models.UserEntity
import dev.brahmkshatriya.echo.playback.Current
import dev.brahmkshatriya.echo.playback.listeners.Radio
import dev.brahmkshatriya.echo.playback.render.FFTAudioProcessor
import dev.brahmkshatriya.echo.ui.settings.AudioFragment.AudioPreference.Companion.CACHE_SIZE
import dev.brahmkshatriya.echo.viewmodels.SnackBar
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -77,8 +76,4 @@ class AppModule {
@Provides
@Singleton
fun provideExtensionListFlow() = MutableStateFlow<Radio.State>(Radio.State.Empty)

@Provides
@Singleton
fun providesAudioProcessor() = FFTAudioProcessor()
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class TestExtension : ExtensionClient, LoginClient.UsernamePassword, TrackClient
Streamable.MediaType.Server -> {
val srcs = Srcs.valueOf(streamable.id)
when (srcs) {
Srcs.Single -> throw Exception("Single source not supported")
Srcs.Single -> FUN.toServerMedia()
Srcs.Merged -> Streamable.Media.Server(
listOf(
BUNNY.toSource(),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dev.brahmkshatriya.echo.playback.render

import android.content.Context
import androidx.annotation.OptIn
import androidx.media3.common.audio.AudioProcessor
import androidx.media3.common.audio.SonicAudioProcessor
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.DefaultRenderersFactory
Expand All @@ -11,8 +10,7 @@ import androidx.media3.exoplayer.audio.SilenceSkippingAudioProcessor

@OptIn(UnstableApi::class)
class RenderersFactory(
context: Context,
private val audioProcessor: AudioProcessor
context: Context
) : DefaultRenderersFactory(context) {
override fun buildAudioSink(
context: Context,
Expand All @@ -32,7 +30,7 @@ class RenderersFactory(
.setEnableAudioTrackPlaybackParams(enableAudioTrackPlaybackParams)
.setAudioProcessorChain(
DefaultAudioSink.DefaultAudioProcessorChain(
arrayOf(audioProcessor), silenceSkippingAudioProcessor, SonicAudioProcessor()
emptyArray(), silenceSkippingAudioProcessor, SonicAudioProcessor()
)
)
.build()
Expand Down
Loading

0 comments on commit ef208bb

Please sign in to comment.