Skip to content

[CastPlayer] AddMediaItems does nothing when there is no media items #2402

Closed

Description

@StaehliJ

Version

Media3 1.6.1

More version details

No response

Devices that reproduce the issue

Any

Devices that do not reproduce the issue

none

Reproducible in the demo app?

Yes

Reproduction steps

In the demo-cast replace in PlayerManager.setCurrentPlayer

 // Media queue management.
    //currentPlayer.setMediaItems(mediaQueue, currentItemIndex, playbackPositionMs);
    currentPlayer.addMediaItems(mediaQueue);
    currentPlayer.seekTo(playbackPositionMs);
    currentPlayer.setPlayWhenReady(playWhenReady);
    currentPlayer.prepare();

Expected result

When using addMediaItems with empty playlist those media items should be sent to the receiver or at least the command COMMAND_CHANGE_MEDIA_ITEMS should not be available when playlist is empty.

Actual result

No data are sent to the cast receiver.

Media

The item from the demo

Bug Report

Activity

  1. self-assigned this
    on May 7, 2025
  2. icbaker commented on May 7, 2025

    @icbaker
    Collaborator

    When using addMediaItems with empty playlist

    I'm not sure I understand this part: Are you passing an empty list to addMediaItems, or passing a non-empty list to addMediaItems when currentPlayer.getMediaItemCount() == 0?

  3. StaehliJ commented on May 7, 2025

    @StaehliJ
    Author

    @icbaker your second point

    passing a non-empty list to addMediaItems when currentPlayer.getMediaItemCount() == 0?

  4. tanay187 commented on Oct 9, 2026

    @tanay187
    Contributor

    @StaehliJ thanks for reporting the issue! The fix for this has been submitted and will be available in the next Media3 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions