Skip to content

macOS: audio-only media fails to open ("Failed to retrieve video size") #267

Open

Description

@rocketraman

Description

On macOS (JVM desktop), media without a video track never plays. Opening an audio-only file such as an .m4a or .mp3 ends with error set to "Failed to retrieve video size", and hasMedia stays false. The same files play on Linux, Windows and the web.

Steps to reproduce

  1. On macOS, create a VideoPlayerState with rememberVideoPlayerState().
  2. Open an audio-only file: state.openUri("/path/to/music.m4a").
  3. Call state.play().

Expected behavior

The audio plays, with duration and currentTime reported as for any other media.

Actual behavior

Nothing plays. The console prints Error loading video tracks: Unknown, and after about five seconds the state's error is "Failed to retrieve video size".

Environment

  • ComposeMediaPlayer 0.11.4, and the same code on master
  • macOS, JVM desktop target

Cause

In NativeVideoPlayer.swift, openUri loads the asset's video tracks and returns early when there is none, before setupVideoOutputAndPlayer, so no AVPlayer is ever created. MacVideoPlayerState then polls for a frame size that never comes, and fails the open.

I have a fix that plays such media through an AVPlayer with no video output, and will open a PR for it.

Activity

  1. rocketraman commented on Nov 9, 2026

    @rocketraman
    Author

    #266 fixes this.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions