From a9a4d39864a22d496e4afc0ef5d3cb0cfefc4e78 Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 20 Nov 2023 17:05:18 +0100 Subject: [PATCH 1/2] Fix AudioRenderProvider.kt it was broken. Class names and constructor usage were not matching the current media3 implementation --- .../renderer/provider/AudioRenderProvider.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt b/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt index 02484cc1..046ca653 100644 --- a/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt +++ b/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt @@ -19,9 +19,9 @@ open class AudioRenderProvider : RenderProvider { override fun rendererClasses(): List { return listOf( - "androidx.media3.exoplayer.ext.opus.LibopusAudioRenderer", - "androidx.media3.exoplayer.ext.flac.LibflacAudioRenderer", - "androidx.media3.exoplayer.ext.ffmpeg.FfmpegAudioRenderer", + "androidx.media3.decoder.opus.LibopusAudioRenderer", + "androidx.media3.decoder.flac.LibflacAudioRenderer", + "androidx.media3.decoder.ffmpeg.FfmpegAudioRenderer", ) } @@ -57,11 +57,14 @@ open class AudioRenderProvider : RenderProvider { ): Renderer { val rendererClass = Class.forName(className) + val audioProcessorVarArg = Array.newInstance(AudioProcessor::class.java, 0) + val constructor = rendererClass.getConstructor( - Long::class.javaPrimitiveType, - AudioRendererEventListener::class.java + Handler::class.java, + AudioRendererEventListener::class.java, + audioProcessorVarArg::class.java ) - return constructor.newInstance(handler, listener) as Renderer + return constructor.newInstance(handler, listener, audioProcessorVarArg) as Renderer } -} \ No newline at end of file +} From fa12f7655fc42084a69a234df6343968c2833722 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 21 Nov 2023 08:50:49 +0100 Subject: [PATCH 2/2] added missing imports --- .../exomedia/core/renderer/provider/AudioRenderProvider.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt b/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt index 046ca653..d287e666 100644 --- a/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt +++ b/library/src/main/kotlin/com/devbrackets/android/exomedia/core/renderer/provider/AudioRenderProvider.kt @@ -1,8 +1,10 @@ package com.devbrackets.android.exomedia.core.renderer.provider import android.content.Context +import java.lang.reflect.Array import android.os.Handler import androidx.annotation.OptIn +import androidx.media3.common.audio.AudioProcessor import androidx.media3.common.util.UnstableApi import androidx.media3.exoplayer.Renderer import androidx.media3.exoplayer.audio.AudioCapabilities