Closed stanmots closed 7 years ago
This isn't an issue in ExoMedia itself, nor is the fix something that would be owned by ExoMedia (as it requires Activity modifications). I can make the changes to the demo app though
Yes, you are right. It's one of the Android's bugs. I just thought it would be better to change the context
to the application context to prevent LeakCanary warnings.
Currently I'm using a VideoView
subclass where I'm overriding the setup
method for this purpose:
override fun setup(context: Context, attrs: AttributeSet?) {
if (isInEditMode) {
return
}
audioManager = context.applicationContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
val attributeContainer = AttributeContainer(context, attrs)
initView(context, attributeContainer)
postInit(attributeContainer)
}
Oh, yeah I can do that; or you can change it in the dev_v4
branch and create a PR
Ok, I'll do it
Include the following:
4.0.0-preview4
and3.1.1
Reproduction Steps
Activity
with ExoMedia video player several times when LeakCanary is enabled.This is a known issue of the Android's
AudioManager
. It was added to the LeakCanary excluded list since it was officially fixed in Android M. More info here. However, there is a fix for older API which you can find here.I've looked through the ExoMedia source code and it seems that you just need to replace this line with
i.d. the audio manager should use the application context.
Here is the LeakCanary relevant logcat snippet: