androidx / androidx/media

Video loaded from resources is stuck at BUFFERING state

Open
#1,132 5 comments 2 reactions 1 assignee View on GitHub

@microkatz is already working on this.

Since Feb 29, 2024.

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

Description

Version

Media3 1.2.0

More version details

No response

Devices that reproduce the issue
  • Xiaomi Mi 10T Lite 5G, Android 12
  • Samsung Galaxy A12, Android 12
Devices that do not reproduce the issue
  • Samsung Galaxy A34
Reproducible in the demo app?

Yes

Reproduction steps

I am playing video as a background of the app. The app is using Jetpack Compose. The video is located in the raw folder in the resources and it is played automatically when the app is started. Sometimes the video is not playing and a black screen is shown. I've attached EventLogger and saw that the player is stuck at BUFFERING state.

EventLogger when the video is working:

 22:37:20.524   surfaceSize [eventTime=0.26, mediaPos=0.00, window=0, 0, 0]
 22:37:20.527   playWhenReady [eventTime=0.26, mediaPos=0.00, window=0, true, USER_REQUEST]
 22:37:20.584   surfaceSize [eventTime=0.32, mediaPos=0.00, window=0, 1080, 2400]
 22:37:20.793   videoEnabled [eventTime=0.53, mediaPos=0.00, window=0, period=0]
 22:37:20.795   downstreamFormat [eventTime=0.53, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902]
 22:37:20.797   videoDecoderInitialized [eventTime=0.53, mediaPos=0.00, window=0, period=0, OMX.qcom.video.decoder.avc]
 22:37:20.798   videoInputFormat [eventTime=0.53, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902]
 22:37:20.800   timeline [eventTime=0.54, mediaPos=0.10, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
 22:37:20.801     period [33.92]
 22:37:20.801     window [33.92, seekable=true, dynamic=false]
 22:37:20.801   ]
 22:37:20.801   tracks [eventTime=0.54, mediaPos=0.10, window=0, period=0
 22:37:20.801     group [
 22:37:20.802       [X] Track:0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902, supported=YES
 22:37:20.802     ]
 22:37:20.802     Metadata [
 22:37:20.802       Creation time: 1678563673000
 22:37:20.802     ]
 22:37:20.802   ]
 22:37:20.803   loading [eventTime=0.54, mediaPos=0.10, window=0, period=0, true]
 22:37:20.804   state [eventTime=0.54, mediaPos=0.10, window=0, period=0, READY]
 22:37:20.805   isPlaying [eventTime=0.54, mediaPos=0.10, window=0, period=0, true]
 22:37:20.810   videoSize [eventTime=0.55, mediaPos=0.10, window=0, period=0, 1920, 1080]
 22:37:20.812   renderedFirstFrame [eventTime=0.55, mediaPos=0.10, window=0, period=0, Surface(name=null)/@0x1f08f15]
 22:37:20.817   loading [eventTime=0.55, mediaPos=0.28, window=0, period=0, false]
 22:37:20.873   surfaceSize [eventTime=0.61, mediaPos=0.34, window=0, period=0, 4266, 2400]
 22:37:22.106   surfaceSize [eventTime=1.84, mediaPos=1.58, window=0, period=0, 0, 0]

EventLogger when the video is not working

 22:37:23.533    surfaceSize [eventTime=0.23, mediaPos=0.00, window=0, 0, 0]
 22:37:23.536    playWhenReady [eventTime=0.23, mediaPos=0.00, window=0, true, USER_REQUEST]
 22:37:23.586    surfaceSize [eventTime=0.28, mediaPos=0.00, window=0, 1080, 2400]
 22:37:23.786    videoEnabled [eventTime=0.49, mediaPos=0.00, window=0, period=0]
 22:37:23.788    downstreamFormat [eventTime=0.49, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902]
 22:37:23.792    videoDecoderInitialized [eventTime=0.49, mediaPos=0.00, window=0, period=0, OMX.qcom.video.decoder.avc]
 22:37:23.793    videoInputFormat [eventTime=0.49, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902]
 22:37:23.795    timeline [eventTime=0.49, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
 22:37:23.795      period [33.92]
 22:37:23.796      window [33.92, seekable=true, dynamic=false]
 22:37:23.796    ]
 22:37:23.796    tracks [eventTime=0.50, mediaPos=0.00, window=0, period=0
 22:37:23.796      group [
 22:37:23.797        [X] Track:0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, color=BT709/Limited range/SDR SMPTE 170M, fps=23.876902, supported=YES
 22:37:23.797      ]
 22:37:23.797      Metadata [
 22:37:23.797        Creation time: 1678563673000
 22:37:23.797      ]
 22:37:23.797    ]
 22:37:23.798    loading [eventTime=0.50, mediaPos=0.00, window=0, period=0, true]
 22:37:23.801    state [eventTime=0.50, mediaPos=0.06, window=0, period=0, READY]
 22:37:23.802    isPlaying [eventTime=0.50, mediaPos=0.06, window=0, period=0, true]
 22:37:23.806    loading [eventTime=0.50, mediaPos=0.06, window=0, period=0, false]
 22:37:23.808    loading [eventTime=0.51, mediaPos=0.12, window=0, period=0, true]
 22:37:23.896    loading [eventTime=0.60, mediaPos=0.27, window=0, period=0, false]
 22:37:26.244    loading [eventTime=2.94, mediaPos=2.61, window=0, period=0, true]
 22:37:26.270    loading [eventTime=2.97, mediaPos=2.65, window=0, period=0, false]
 22:37:28.633    state [eventTime=5.33, mediaPos=5.01, window=0, period=0, BUFFERING]
 22:37:28.635    isPlaying [eventTime=5.33, mediaPos=5.01, window=0, period=0, false]
 22:37:45.397    surfaceSize [eventTime=22.10, mediaPos=5.01, window=0, period=0, 0, 0]
 22:37:45.701    state [eventTime=22.40, mediaPos=5.31, window=0, period=0, READY]
 22:37:45.702    isPlaying [eventTime=22.40, mediaPos=5.31, window=0, period=0, true]
 22:37:49.188    surfaceSize [eventTime=25.89, mediaPos=8.80, window=0, period=0, 1080, 2400]
 22:37:52.510    loading [eventTime=29.21, mediaPos=12.12, window=0, period=0, true]
 22:37:52.539    loading [eventTime=29.24, mediaPos=12.15, window=0, period=0, false]
 22:37:52.551    loading [eventTime=29.25, mediaPos=12.16, window=0, period=0, true]
 22:37:52.560    loading [eventTime=29.26, mediaPos=12.17, window=0, period=0, false]
 22:37:54.204    state [eventTime=30.90, mediaPos=13.81, window=0, period=0, BUFFERING]
 22:37:54.207    isPlaying [eventTime=30.91, mediaPos=13.81, window=0, period=0, false]

This issue is happening sometimes on different devices. On Xiaomi Mi10 Lite is happening once in 20-30 startups, while on Samsung A12 almost whenever the app is opened. I tried reproducing it on an emulator with low RAM and memory, but the video was still playing.

Note: This is a copy of https://github.com/androidx/media/issues/944 because the other issue was not reopened after I've sent the media.

Expected result

Play the video all the time.

Actual result

Video is not played sometimes.

Media

I've send the media file to the email

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.