Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS videos in a playlist reports the size of the largest video played for all HLS videos #2047

Open
1 task done
tunjid opened this issue Jan 16, 2025 · 1 comment
Open
1 task done
Assignees

Comments

@tunjid
Copy link

tunjid commented Jan 16, 2025

Version

Media3 main branch

More version details

0d8e422

Devices that reproduce the issue

  • Emulator

Devices that do not reproduce the issue

  • Google Pixel Fold

Reproducible in the demo app?

Yes

Reproduction steps

If have two or more HLS videos in a playlist, the largest video size encountered is reported for consecutive HLS videos in the playlist.

This causes:

  • Smaller videos to not fit properly in the Surface it is displayed in.
  • The wrong video size to be reported in the onVideoSizeChanged callback of Player.Listener.

The proper video size is reported with the following however

            setVideoFrameMetadataListener { presentationTimeUs, releaseTimeNs, format, mediaFormat ->
                println("F: ${format.width}x ${format.height}")
            }

The only way things reset to normal is by playing a non HLS video.

Repro steps can be seen in the PR against my repo fork: https://github.com/tunjid/media/pull/1/files

Videos showing the bug have been attached in the actual result section.

Expected result

Each hls video reports its proper size to the Player.Listener and renders at that size in the Surface it is playing in.

Actual result

Case 1: Smaller video is played first

e1.mp4

Case 2: Larger video is played first

e2.mp4

Media

    "https://video.bsky.app/watch/did%3Aplc%3A6q4y7p2wft3tncsffspts3m5/bafkreiewtyjsdiu2nyf4bz5fhia2zuhtln6ebpfhprdzxgkdqo2xpdxzga/playlist.m3u8",
  "https://video.bsky.app/watch/did%3Aplc%3A6q4y7p2wft3tncsffspts3m5/bafkreias5sa7nq53pgjrkojrorfg7thvwgcesihw4ja2jygfhgrknljawe/playlist.m3u8",
  "https://video.bsky.app/watch/did%3Aplc%3A6q4y7p2wft3tncsffspts3m5/bafkreih735rj3aodv6nbmvutpsijrkvg3lamz5svjef7o4v2ddsrac75xm/playlist.m3u8"

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@oceanjules
Copy link
Contributor

Thank you so much for testing out our Compose Demo, it's still a WIP, so any Compose and Kotlin expertise are always welcome, especially from ex-devrels :)

I tried out your example and I cannot reproduce the problem. Here is me going back and forth in a playlist of 3 HLS videos:

2025-01-17 14:37:11.255 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(1036.0, 720.0)
2025-01-17 14:37:16.505 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(1036.0, 720.0)
2025-01-17 14:37:21.783 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(324.0, 720.0)
2025-01-17 14:37:27.623 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(1036.0, 720.0)
2025-01-17 14:37:30.150 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(1036.0, 720.0)
2025-01-17 14:37:31.577 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(1036.0, 720.0)
2025-01-17 14:37:32.500 27186-27186 PresentationState                   androidx.media3.demo.compose         D  videosize is Size(324.0, 720.0)

If you put a log statement in
https://github.com/androidx/media/blob/main/libraries/ui_compose/src/main/java/androidx/media3/ui/compose/state/PresentationState.kt#L99-L109 to log videoSize, you will see them.

This is the same video that we use to scale it up and down in https://github.com/androidx/media/blob/main/demos/compose/src/main/java/androidx/media3/demo/compose/MainActivity.kt#L115

val presentationState = rememberPresentationState(player)
val scaledModifier = Modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp)

Does it only happen to you when the ContentScale button shows FIT?

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

No branches or pull requests

2 participants