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

Video loaded from resources is stuck at BUFFERING state #1132

Open
1 task done
DenislavNedev opened this issue Feb 26, 2024 · 4 comments
Open
1 task done

Video loaded from resources is stuck at BUFFERING state #1132

DenislavNedev opened this issue Feb 26, 2024 · 4 comments
Assignees

Comments

@DenislavNedev
Copy link

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 #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

@peterstickermaker
Copy link

peterstickermaker commented Jul 11, 2024

@DenislavNedev
I am not sure it is related to my issue or not but I got the same issue on Android 12 (Samsung device) .
I was able to resolve it by following this google/ExoPlayer#10021 (comment)
Hope this help

@Ste-RH
Copy link

Ste-RH commented Jul 15, 2024

Hi all. As you can see from the mention in the timeline, I think we are seeing an issue in AVPro Video (a Unity video playback asset) that maybe a manifestation of this issue. I think we are only seeing it when we create a new ExoPlayer object every time we play a video (opening the same video over and over on a persistent ExoPlayer object seems fine), destroying the previous one before the creation of the new one. Also, I think it is only seen with a video that has no audio tracks. The issue was not 100% reproducible, but we can make it happen often.

What led me here is that the player was getting stuck in the buffering state, and we would get no 'onVideoSizeChanged(...)' callback firing when the video was getting stuck...and the times it was playing as expected I was seeing this fire and then moving out of the buffering state.

Devices tested (issue seen on all of them):

  • Xiaomi Mi 10T Lite 5G, Android 12
  • Oculus Quest 2 (latest Oculus version)
  • Samsung 850, Android 11

@peterstickermaker
Copy link

peterstickermaker commented Aug 1, 2024

@DenislavNedev I am not sure it is related to my issue or not but I got the same issue on Android 12 (Samsung device) . I was able to resolve it by following this google/ExoPlayer#10021 (comment) Hope this help

It seems this only resolve for some videos only
i was able to reproduce it with some other videos. it happens randomly, not 100%
@Ste-RH
Do you find any solution for this ?

@Ste-RH
Copy link

Ste-RH commented Sep 9, 2024

@peterstickermaker For us, deferral our surface creation/attach by two frames from where we were doing it (which was in a callback) seems to have fixed the issue. Strange it is 2 frames...1 frame made things better, but did not completely eradicate the problem.

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

4 participants