androidx / androidx/media

CastPlayer crashes when Receiver has error in LOAD message interceptor

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

@marcbaechinger is already working on this.

Since Oct 9, 2023.

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

Description

Version

Media3 1.1.1

More version details

When our Cast Receiver has an internal exception/error inside a LOAD message interceptor, the CastPlayer on the Sender app is crashing like so:

// Cast Receiver error, unsure if this is helpful.  This is our bug that needs to be fixed
playerManager.setMessageInterceptor(
  cast.framework.messages.MessageType.LOAD,
  request => {
      // do something bad here that causes an exception in the JavaScript
  }
);

// Cast Sender crashes here
java.lang.IllegalStateException
	at androidx.media3.common.util.Assertions.checkStateNotNull(Assertions.java:117)
	at androidx.media3.cast.CastTimelineTracker.getCastTimeline(CastTimelineTracker.java:113)
	at androidx.media3.cast.CastPlayer.updateTimeline(CastPlayer.java:1031)
	at androidx.media3.cast.CastPlayer.updateTimelineAndNotifyIfChanged(CastPlayer.java:956)
	at androidx.media3.cast.CastPlayer.updateInternalStateAndNotifyIfChanged(CastPlayer.java:832)
	at androidx.media3.cast.CastPlayer.access$800(CastPlayer.java:84)
	at androidx.media3.cast.CastPlayer$StatusListener.onStatusUpdated(CastPlayer.java:1370)
	at com.google.android.gms.cast.framework.media.zzbn.zzm(com.google.android.gms:play-services-cast-framework@@21.3.0:6)
	at com.google.android.gms.cast.internal.zzaq.zzY(com.google.android.gms:play-services-cast@@21.3.0:1)
	at com.google.android.gms.cast.internal.zzaq.zzO(com.google.android.gms:play-services-cast@@21.3.0:59)
	at com.google.android.gms.cast.framework.media.RemoteMediaClient.onMessageReceived(com.google.android.gms:play-services-cast-framework@@21.3.0:1)
	at com.google.android.gms.cast.zzbq.run(com.google.android.gms:play-services-cast@@21.3.0:4)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7918)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Devices that reproduce the issue

Pixel 7 Pro running Android 13

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Have a Cast Receiver that throws an exception within its LOAD messageInterceptor

Expected result

Cast Sender (CastPlayer) should not crash the app

Actual result

CastPlayer crashes the app on a borked timeline

Media

Any

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.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.