androidx / androidx/media

Logged RuntimeException when overriding controls drawables

Open
#220 1 comment 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Dec 12, 2022.

bug
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Media3 Version

1.0.0-beta03

Devices that reproduce the issue
  • Samsung Galaxy S21 FE 5G (running Android 13)
Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps
  1. Add following drawable resources to the demo app:

ic_outline_play_arrow_24.xml:

<vector android:height="24dp" android:tint="#FFFFFF"
    android:viewportHeight="24" android:viewportWidth="24"
    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="@android:color/white" android:pathData="M10,8.64L15.27,12 10,15.36V8.64M8,5v14l11,-7L8,5z"/>
</vector>

controls_gradient.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >
    <size
        android:width="40dp"
        android:height="40dp" />
    <gradient
        android:centerColor="#AAFF0000"
        android:endColor="#00FF0000"
        android:gradientRadius="50%p"
        android:startColor="#00FF0000"
        android:type="radial" />
</shape>

exo_styled_controls_play.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/controls_gradient"/>
    <item
        android:drawable="@drawable/ic_outline_play_arrow_24"
        android:top="3dp"
        android:left="3dp"
        android:right="3dp"
        android:bottom="3dp">
    </item>
</layer-list>
  1. Open any media so that controls with the play button is visible
Expected result

No logged exception

Actual result

Every time each overriden control is shown, following exception is logged:

Drawable androidx.media3.demo.main:drawable/exo_styled_controls_play has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).
java.lang.RuntimeException
	at android.content.res.Resources.getDrawable(Resources.java:967)
	at androidx.media3.ui.PlayerControlView.updatePlayPauseButton(PlayerControlView.java:965)
	at androidx.media3.ui.PlayerControlView.access$300(PlayerControlView.java:181)
	at androidx.media3.ui.PlayerControlView$ComponentListener.onEvents(PlayerControlView.java:1583)
	at androidx.media3.exoplayer.ExoPlayerImpl.lambda$new$0$androidx-media3-exoplayer-ExoPlayerImpl(ExoPlayerImpl.java:276)
	at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda18.invoke(Unknown Source:4)
	at androidx.media3.common.util.ListenerSet$ListenerHolder.iterationFinished(ListenerSet.java:295)
	at androidx.media3.common.util.ListenerSet.handleMessage(ListenerSet.java:246)
	at androidx.media3.common.util.ListenerSet.$r8$lambda$bio3pd12v5B_9b5UeFaPn9XBQ90(Unknown Source:0)
	at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda0.handleMessage(Unknown Source:2)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8741)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Media

Not applicable

Bug Report
  • You will email the zip file produced by adb bugreport to dev.exoplayer@gmail.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.